swayidle: fix systemd service

swayidle executes commands using "sh -c" and so its PATH must contain
a shell. This adds such PATH entry to the environment of the systemd
service.

Fixes #2811.
This commit is contained in:
Joe Neeman 2022-07-03 11:28:29 -05:00 committed by Robert Helgesson
parent 6311f4adc3
commit 43ea4c5123
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
2 changed files with 5 additions and 0 deletions

View file

@ -108,6 +108,8 @@ in {
Service = {
Type = "simple";
# swayidle executes commands using "sh -c", so the PATH needs to contain a shell.
Environment = [ "PATH=${makeBinPath [ pkgs.bash ]}" ];
ExecStart =
"${cfg.package}/bin/swayidle -w ${concatStringsSep " " args}";
};

View file

@ -47,6 +47,9 @@
assertFileExists $serviceFile
assertFileRegex $serviceFile 'ExecStart=.*/bin/swayidle ${expectedArgs}'
assertFileRegex $serviceFile 'Environment=.*PATH=${
lib.makeBinPath [ pkgs.bash ]
}'
'';
};
}