My Nix Configuration
1{ 2 config, 3 lib, 4 ... 5}: 6let 7 cfg = config.wayland.windowManager.hyprland; 8in 9{ 10 config.services.hypridle = lib.mkIf cfg.enable { 11 enable = true; 12 settings = { 13 general = { 14 lock_cmd = "loginctl lock-session"; 15 # before_sleep_cmd = "loginctl lock-session"; 16 after_sleep_cmd = "hyprctl dispatch dpms on"; 17 inhibit_sleep = 3; 18 }; 19 listener = [ 20 { 21 timeout = 420; 22 on-timeout = "loginctl lock-session"; 23 } 24 { 25 timeout = 600; 26 on-timeout = "hyprctl dispatch dpms off"; 27 on-resume = "hyprctl dispatch dpms on"; 28 } 29 { 30 timeout = 900; 31 on-timeout = "systemctl resume"; 32 } 33 ]; 34 }; 35 }; 36}