Commit 4d81022d authored by Jan Tojnar's avatar Jan Tojnar
Browse files

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.
parent e6403890
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -30,6 +30,11 @@ stdenv.mkDerivation rec {
    sha256 = "EyOdIgMiAaIr0pgzxXW2hIFnANLeFooVMCI1d8XAddw=";
  };

  patches = [
    # Fix pkexec detection on NixOS.
    ./fix-paths.patch
  ];

  nativeBuildInputs = [
    pkg-config
    gettext
+13 −0
Original line number Diff line number Diff line
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);
 }