From 8eefcdc9e9b927084eed9095ed06f9e03d1dbf5f Mon Sep 17 00:00:00 2001 From: Bobby Rong Date: Fri, 22 Mar 2024 00:13:39 +0800 Subject: [PATCH] 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. --- pkgs/desktops/cinnamon/nemo/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/desktops/cinnamon/nemo/default.nix b/pkgs/desktops/cinnamon/nemo/default.nix index 7b124c7987da..fe61e9701d9c 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+=(