about summary refs log tree commit diff
path: root/pkgs/desktops/xfce
diff options
context:
space:
mode:
authorPaul Stadig <paul@thoughtfull.systems>2023-07-27 06:12:34 -0400
committerPaul Stadig <paul@thoughtfull.systems>2023-07-27 06:12:34 -0400
commit6a2999310e4f5d4bfdec15d1aed54f98096fba9d (patch)
tree43e2822311f3e19042b4cc84f9730fed9510a97c /pkgs/desktops/xfce
parent54b701f3f82b3a1ec42dfa9b9b9ba9994d3ca5b8 (diff)
xfce.xfce4-power-manager: use fixed path for helpers
Using a nix store path for `xfpm-power-backlight-helper` and `xfce4-pm-helper` causes permission
errors after a rebuild when adjusting brightness or putting the system to sleep, because the
permitted executables are different from the ones `xfce4-power-manager` wants to execute.  Using a
fixed path (/run/current-system/sw/bin) means the paths do not change after a rebuild, so there's no
permission error.

A similar approach is taken with gnome's `gsd-backlight-helper`.

Fixes #77485
Diffstat (limited to 'pkgs/desktops/xfce')
-rw-r--r--pkgs/desktops/xfce/core/xfce4-power-manager/default.nix8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkgs/desktops/xfce/core/xfce4-power-manager/default.nix b/pkgs/desktops/xfce/core/xfce4-power-manager/default.nix
index 8755234cbc827..19b552937119d 100644
--- a/pkgs/desktops/xfce/core/xfce4-power-manager/default.nix
+++ b/pkgs/desktops/xfce/core/xfce4-power-manager/default.nix
@@ -26,6 +26,14 @@ mkXfceDerivation {
     xfce4-panel
   ];
 
+  # using /run/current-system/sw/bin instead of nix store path prevents polkit permission errors on
+  # rebuild.  See https://github.com/NixOS/nixpkgs/issues/77485
+  postPatch = ''
+    substituteInPlace src/org.xfce.power.policy.in2 --replace "@sbindir@" "/run/current-system/sw/bin"
+    substituteInPlace common/xfpm-brightness.c --replace "SBINDIR" "\"/run/current-system/sw/bin\""
+    substituteInPlace src/xfpm-suspend.c --replace "SBINDIR" "\"/run/current-system/sw/bin\""
+  '';
+
   meta = with lib; {
     description = "A power manager for the Xfce Desktop Environment";
     maintainers = with maintainers; [ ] ++ teams.xfce.members;