gnome.gnome-system-monitor: Fix privileged operations

It was checking /usr/bin/pkexec, which is not available on NixOS. Instead, we need to look for the setuid wrapper in /run/wrappers/bin/pkexec.
This commit is contained in:
Jan Tojnar 2022-08-09 12:11:22 +02:00
parent e640389011
commit 4d81022d2c
2 changed files with 18 additions and 0 deletions

@ -30,6 +30,11 @@ stdenv.mkDerivation rec {
sha256 = "EyOdIgMiAaIr0pgzxXW2hIFnANLeFooVMCI1d8XAddw=";
};
patches = [
# Fix pkexec detection on NixOS.
./fix-paths.patch
];
nativeBuildInputs = [
pkg-config
gettext

@ -0,0 +1,13 @@
diff --git a/src/gsm_pkexec.cpp b/src/gsm_pkexec.cpp
index 868969ba..51eb93b5 100644
--- a/src/gsm_pkexec.cpp
+++ b/src/gsm_pkexec.cpp
@@ -33,6 +33,7 @@ gboolean gsm_pkexec_create_root_password_dialog(const char *command)
gboolean
procman_has_pkexec(void)
{
- return g_file_test("/usr/bin/pkexec", G_FILE_TEST_EXISTS);
+ return g_file_test("/run/wrappers/bin/pkexec", G_FILE_TEST_EXISTS)
+ || g_file_test("/usr/bin/pkexec", G_FILE_TEST_EXISTS);
}