1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19:45 +01:00

hypridle: add systemdTarget option

- added `systemdTarget` option
- updated test to include new option
- added documentation link to systemd service
This commit is contained in:
gmvar 2024-11-15 09:34:24 -08:00
parent 1d0862ee2d
commit 8cf61627a0
3 changed files with 38 additions and 1 deletions

View file

@ -63,6 +63,19 @@ in {
List of prefix of attributes to source at the top of the config. List of prefix of attributes to source at the top of the config.
''; '';
}; };
systemdTarget = lib.mkOption {
type = lib.types.str;
default = "graphical-session.target";
example = "hyprland-session.target";
description = ''
The systemd target that will automatically start the hypridle service.
When setting this value to `"hyprland-session.target"`,
make sure to also enable {option}`wayland.windowManager.hyprland.systemd.enable`,
otherwise the service may never be started.
'';
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -74,11 +87,12 @@ in {
}; };
systemd.user.services.hypridle = { systemd.user.services.hypridle = {
Install = { WantedBy = [ "graphical-session.target" ]; }; Install = { WantedBy = [ cfg.systemdTarget ]; };
Unit = { Unit = {
ConditionEnvironment = "WAYLAND_DISPLAY"; ConditionEnvironment = "WAYLAND_DISPLAY";
Description = "hypridle"; Description = "hypridle";
Documentation = "https://wiki.hyprland.org/Hypr-Ecosystem/hypridle/";
After = [ "graphical-session-pre.target" ]; After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
X-Restart-Triggers = X-Restart-Triggers =

View file

@ -24,6 +24,8 @@
} }
]; ];
}; };
systemdTarget = "hyprland-session.target";
}; };
test.stubs.hypridle = { }; test.stubs.hypridle = { };
@ -34,5 +36,11 @@
assertFileExists $config assertFileExists $config
assertFileExists $clientServiceFile assertFileExists $clientServiceFile
assertFileContent $config ${./hypridle.conf} assertFileContent $config ${./hypridle.conf}
serviceFile=$(normalizeStorePaths $clientServiceFile)
assertFileContent "$serviceFile" ${
./systemd-with-graphical-session-target.service
}
''; '';
} }

View file

@ -0,0 +1,15 @@
[Install]
WantedBy=hyprland-session.target
[Service]
ExecStart=@hypridle@/bin/dummy
Restart=always
RestartSec=10
[Unit]
After=graphical-session-pre.target
ConditionEnvironment=WAYLAND_DISPLAY
Description=hypridle
Documentation=https://wiki.hyprland.org/Hypr-Ecosystem/hypridle/
PartOf=graphical-session.target
X-Restart-Triggers=/nix/store/00000000000000000000000000000000-hm_hyprhypridle.conf