My Nix Configuration
1{ 2 pkgs, 3 config, 4 lib, 5 ... 6}: 7let 8 cfg = config.py.services.swayidle; 9in 10{ 11 options.py.services.swayidle.enable = lib.mkEnableOption "swayidle"; 12 config.services.swayidle = lib.mkIf cfg.enable { 13 enable = true; 14 events = [ 15 { 16 event = "lock"; 17 command = "lock"; 18 } 19 { 20 event = "before-sleep"; 21 command = lib.getExe pkgs.swaylock-effects; 22 } 23 { 24 event = "after-resume"; 25 command = ''swaymsg "output * dpms on"''; 26 } 27 ]; 28 timeouts = [ 29 { 30 timeout = 300; 31 command = lib.getExe pkgs.swaylock-effects; 32 } 33 ]; 34 }; 35}