diff --git a/modules/services/swayidle.nix b/modules/services/swayidle.nix index 217fb435..ad31642e 100644 --- a/modules/services/swayidle.nix +++ b/modules/services/swayidle.nix @@ -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}"; }; diff --git a/tests/modules/services/swayidle/basic-configuration.nix b/tests/modules/services/swayidle/basic-configuration.nix index d3c6bef7..4ecc1308 100644 --- a/tests/modules/services/swayidle/basic-configuration.nix +++ b/tests/modules/services/swayidle/basic-configuration.nix @@ -47,6 +47,9 @@ assertFileExists $serviceFile assertFileRegex $serviceFile 'ExecStart=.*/bin/swayidle ${expectedArgs}' + assertFileRegex $serviceFile 'Environment=.*PATH=${ + lib.makeBinPath [ pkgs.bash ] + }' ''; }; }