1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-28 04:39:48 +01:00

hypridle: fix service when no config file

The systemd user service depends on

  config.xdg.configFile."hypr/hypridle.conf".source

for `X-Restart-Triggers`. When `cfg.settings` is the default `{}`,
this causes failure since

  config.xdg.configFile."hypr/hypridle.conf".source

will not exist.

Making the addition conditional on `cfg.settings` actually having
content, which would mean `xdg.configFile."hypr/hypridle.conf"` does
exist, avoids the error.
This commit is contained in:
Sebastián Zavala Villagómez 2024-11-23 16:16:15 -05:00 committed by Robert Helgesson
parent bd58a1132e
commit 5e2f47c5a5
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
3 changed files with 19 additions and 2 deletions

View file

@ -81,7 +81,7 @@ in {
Description = "hypridle";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
X-Restart-Triggers =
X-Restart-Triggers = mkIf (cfg.settings != { })
[ "${config.xdg.configFile."hypr/hypridle.conf".source}" ];
};

View file

@ -1 +1,4 @@
{ hypridle-basic-configuration = ./basic-configuration.nix; }
{
hypridle-basic-configuration = ./basic-configuration.nix;
hypridle-no-configuration = ./no-configuration.nix;
}

View file

@ -0,0 +1,14 @@
{ pkgs, ... }:
{
services.hypridle.enable = true;
test.stubs.hypridle = { };
nmt.script = ''
config=home-files/.config/hypr/hypridle.conf
clientServiceFile=home-files/.config/systemd/user/hypridle.service
assertPathNotExists $config
assertFileExists $clientServiceFile
'';
}