Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions modules/services/hypridle.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@ in {

package = mkPackageOption pkgs "hypridle" { };

systemd = {
enable = lib.mkEnableOption "Hypridle Systemd integration" // {
default = true;
};
target = 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.
'';
};
};

settings = lib.mkOption {
type = with lib.types;
let
Expand Down Expand Up @@ -73,8 +87,8 @@ in {
};
};

systemd.user.services.hypridle = {
Install = { WantedBy = [ "graphical-session.target" ]; };
systemd.user.services.hypridle = mkIf cfg.systemd.enable {
Install = { WantedBy = [ cfg.systemd.target ]; };

Unit = {
ConditionEnvironment = "WAYLAND_DISPLAY";
Expand Down
3 changes: 3 additions & 0 deletions tests/modules/services/hypridle/basic-configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
enable = true;
package = pkgs.hypridle;

systemd.target = "hyprland-session.target";

settings = {
general = {
after_sleep_cmd = "hyprctl dispatch dpms on";
Expand Down Expand Up @@ -34,5 +36,6 @@
assertFileExists $config
assertFileExists $clientServiceFile
assertFileContent $config ${./hypridle.conf}
assertFileContains $clientServiceFile "WantedBy=hyprland-session.target"
'';
}