about summary refs log tree commit diff
path: root/pkgs/desktops/cinnamon/nemo
diff options
context:
space:
mode:
authorBobby Rong <rjl931189261@126.com>2024-03-22 00:13:39 +0800
committerBobby Rong <rjl931189261@126.com>2024-03-22 00:34:11 +0800
commit8eefcdc9e9b927084eed9095ed06f9e03d1dbf5f (patch)
tree3425596f64a67608aee6ddd5cb2d6ef58adb9a8e /pkgs/desktops/cinnamon/nemo
parentb06025f1533a1e07b6db3e75151caa155d1c7eb3 (diff)
cinnamon.nemo: Fix open as root
Open as root support is added in src/nemo-view.c as `pkexec nemo`.
This does not match the full path in `org.nemo.root.policy` so it
doesn't work.

Replacing with `/run/current-system/sw/bin/nemo` seems to be the
easiest solution here, otherwise to properly support nemo-with-extensions,
we likely need to patch everything that calls `pkexec nemo` to accept
external environment variables for nemo path, and pass the path via
wrapper, and we still need to substitute `org.nemo.root.policy` in
nemo-with-extensions.
Diffstat (limited to 'pkgs/desktops/cinnamon/nemo')
-rw-r--r--pkgs/desktops/cinnamon/nemo/default.nix7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkgs/desktops/cinnamon/nemo/default.nix b/pkgs/desktops/cinnamon/nemo/default.nix
index 7b124c7987daf..fe61e9701d9c0 100644
--- a/pkgs/desktops/cinnamon/nemo/default.nix
+++ b/pkgs/desktops/cinnamon/nemo/default.nix
@@ -67,6 +67,13 @@ stdenv.mkDerivation rec {
     "--localedir=${cinnamon-translations}/share/locale"
   ];
 
+  postInstall = ''
+    # This fixes open as root and handles nemo-with-extensions well.
+    # https://github.com/NixOS/nixpkgs/issues/297570
+    substituteInPlace $out/share/polkit-1/actions/org.nemo.root.policy \
+      --replace-fail "$out/bin/nemo" "/run/current-system/sw/bin/nemo"
+  '';
+
   preFixup = ''
     # Used for some non-fd.o icons (e.g. xapp-text-case-symbolic)
     gappsWrapperArgs+=(