From c6743ed565aa6fa5f6226cf4312cbcd7c123aafb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Romildo=20Malaquias?= Date: Thu, 16 Jul 2020 18:26:40 -0300 Subject: [PATCH 1/4] kde-frameworks.kdesu: search the daemon first in /run/wrappers/bin If looking first in libexec, the eventually wrapped one in /run/wrappers/bin can not be found. This allows wrapping the daemon so that it can be run with sgid privileges. --- ...desu-search-for-wrapped-daemon-first.patch | 38 +++++++++++++++++++ .../libraries/kde-frameworks/kdesu.nix | 1 + 2 files changed, 39 insertions(+) create mode 100644 pkgs/development/libraries/kde-frameworks/kdesu-search-for-wrapped-daemon-first.patch diff --git a/pkgs/development/libraries/kde-frameworks/kdesu-search-for-wrapped-daemon-first.patch b/pkgs/development/libraries/kde-frameworks/kdesu-search-for-wrapped-daemon-first.patch new file mode 100644 index 00000000000..ffc7edadfab --- /dev/null +++ b/pkgs/development/libraries/kde-frameworks/kdesu-search-for-wrapped-daemon-first.patch @@ -0,0 +1,38 @@ +From 01af4d2a098e5819c09bca37568941dcd4b89d0b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jos=C3=A9=20Romildo=20Malaquias?= +Date: Thu, 16 Jul 2020 13:21:42 -0300 +Subject: [PATCH] Search for the daemon first in /run/wrappers/bin + +If looking first in libexec, the eventually wrapped one in +/run/wrappers/bin can not be found. +--- + src/client.cpp | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/src/client.cpp b/src/client.cpp +index 44fbacd..6b5abf5 100644 +--- a/src/client.cpp ++++ b/src/client.cpp +@@ -378,11 +378,14 @@ int KDEsuClient::stopServer() + + static QString findDaemon() + { +- QString daemon = QFile::decodeName(CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 "/kdesud"); +- if (!QFile::exists(daemon)) { // if not in libexec, find it in PATH +- daemon = QStandardPaths::findExecutable(QStringLiteral("kdesud")); +- if (daemon.isEmpty()) { +- qWarning() << "kdesud daemon not found."; ++ QString daemon = QFile::decodeName("/run/wrappers/bin/kdesud"); ++ if (!QFile::exists(daemon)) { // if not in wrappers ++ daemon = QFile::decodeName(CMAKE_INSTALL_FULL_LIBEXECDIR_KF5 "/kdesud"); ++ if (!QFile::exists(daemon)) { // if not in libexec, find it in PATH ++ daemon = QStandardPaths::findExecutable(QStringLiteral("kdesud")); ++ if (daemon.isEmpty()) { ++ qWarning() << "kdesud daemon not found."; ++ } + } + } + return daemon; +-- +2.27.0 + diff --git a/pkgs/development/libraries/kde-frameworks/kdesu.nix b/pkgs/development/libraries/kde-frameworks/kdesu.nix index df60511b511..cd7055c4ea8 100644 --- a/pkgs/development/libraries/kde-frameworks/kdesu.nix +++ b/pkgs/development/libraries/kde-frameworks/kdesu.nix @@ -11,4 +11,5 @@ mkDerivation { buildInputs = [ kcoreaddons ki18n kpty kservice qtbase ]; propagatedBuildInputs = [ kpty ]; outputs = [ "out" "dev" ]; + patches = [ ./kdesu-search-for-wrapped-daemon-first.patch ]; } From 7deb1c703291a4fca0f97359e150a031f4b3f6b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Romildo=20Malaquias?= Date: Sun, 19 Jul 2020 16:41:32 -0300 Subject: [PATCH 2/4] kde-frameworks.kdesu: move to its own directory --- pkgs/development/libraries/kde-frameworks/default.nix | 2 +- .../libraries/kde-frameworks/{kdesu.nix => kdesu/default.nix} | 0 .../{ => kdesu}/kdesu-search-for-wrapped-daemon-first.patch | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename pkgs/development/libraries/kde-frameworks/{kdesu.nix => kdesu/default.nix} (100%) rename pkgs/development/libraries/kde-frameworks/{ => kdesu}/kdesu-search-for-wrapped-daemon-first.patch (100%) diff --git a/pkgs/development/libraries/kde-frameworks/default.nix b/pkgs/development/libraries/kde-frameworks/default.nix index 9ac3ed11b49..f4074772867 100644 --- a/pkgs/development/libraries/kde-frameworks/default.nix +++ b/pkgs/development/libraries/kde-frameworks/default.nix @@ -149,7 +149,7 @@ let kdeclarative = callPackage ./kdeclarative.nix {}; kded = callPackage ./kded.nix {}; kdesignerplugin = callPackage ./kdesignerplugin.nix {}; - kdesu = callPackage ./kdesu.nix {}; + kdesu = callPackage ./kdesu {}; kdewebkit = callPackage ./kdewebkit.nix {}; kemoticons = callPackage ./kemoticons.nix {}; kglobalaccel = callPackage ./kglobalaccel.nix {}; diff --git a/pkgs/development/libraries/kde-frameworks/kdesu.nix b/pkgs/development/libraries/kde-frameworks/kdesu/default.nix similarity index 100% rename from pkgs/development/libraries/kde-frameworks/kdesu.nix rename to pkgs/development/libraries/kde-frameworks/kdesu/default.nix diff --git a/pkgs/development/libraries/kde-frameworks/kdesu-search-for-wrapped-daemon-first.patch b/pkgs/development/libraries/kde-frameworks/kdesu/kdesu-search-for-wrapped-daemon-first.patch similarity index 100% rename from pkgs/development/libraries/kde-frameworks/kdesu-search-for-wrapped-daemon-first.patch rename to pkgs/development/libraries/kde-frameworks/kdesu/kdesu-search-for-wrapped-daemon-first.patch From 9c508d030ac777ea708b7914eef60290c058a5d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Romildo=20Malaquias?= Date: Thu, 16 Jul 2020 18:32:13 -0300 Subject: [PATCH 3/4] plasma-5.kde-cli-tools: wrap kdesu to include kdeinit5 in PATH --- pkgs/desktops/plasma-5/kde-cli-tools.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/desktops/plasma-5/kde-cli-tools.nix b/pkgs/desktops/plasma-5/kde-cli-tools.nix index 3364ee2c063..03efc42fe26 100644 --- a/pkgs/desktops/plasma-5/kde-cli-tools.nix +++ b/pkgs/desktops/plasma-5/kde-cli-tools.nix @@ -1,5 +1,5 @@ { - mkDerivation, extra-cmake-modules, kdoctools, + lib, mkDerivation, extra-cmake-modules, kdoctools, kcmutils, kconfig, kdesu, ki18n, kiconthemes, kinit, kio, kwindowsystem, qtsvg, qtx11extras, kactivities, plasma-workspace }: @@ -11,4 +11,13 @@ mkDerivation { kcmutils kconfig kdesu ki18n kiconthemes kinit kio kwindowsystem qtsvg qtx11extras kactivities plasma-workspace ]; + dontWrapQtApps = true; + preFixup = '' + for program in $out/bin/*; do + wrapQtApp $program + done + + # kdesu looks for kdeinit5 in PATH + wrapQtApp $out/libexec/kf5/kdesu --suffix PATH : ${lib.getBin kinit}/bin + ''; } From 983c69c0f64c93db83435a582f987604f150a28e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Romildo=20Malaquias?= Date: Thu, 20 Aug 2020 18:21:24 -0300 Subject: [PATCH 4/4] plasma-5.kde-cli-tools: install a symlink to kdesu in bin --- pkgs/desktops/plasma-5/kde-cli-tools.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/desktops/plasma-5/kde-cli-tools.nix b/pkgs/desktops/plasma-5/kde-cli-tools.nix index 03efc42fe26..d84b7bc9801 100644 --- a/pkgs/desktops/plasma-5/kde-cli-tools.nix +++ b/pkgs/desktops/plasma-5/kde-cli-tools.nix @@ -11,6 +11,11 @@ mkDerivation { kcmutils kconfig kdesu ki18n kiconthemes kinit kio kwindowsystem qtsvg qtx11extras kactivities plasma-workspace ]; + postInstall = '' + # install a symlink in bin so that kdesu can eventually be found in PATH + mkdir -p $out/bin + ln -s $out/libexec/kf5/kdesu $out/bin + ''; dontWrapQtApps = true; preFixup = '' for program in $out/bin/*; do