Merge pull request #34470 from WilliButz/fix-xautolock

nixos/xautolock: fix default defaults/examples, add assertions

authored by Franz Pletz and committed by GitHub 0dcf5df0 d81e32be

+16 -12
+16 -12
nixos/modules/services/x11/xautolock.nix
··· 26 }; 27 28 locker = mkOption { 29 - default = "xlock"; # default according to `man xautolock` 30 - example = "i3lock -i /path/to/img"; 31 - type = types.string; 32 33 description = '' 34 The script to use when automatically locking the computer. ··· 37 38 nowlocker = mkOption { 39 default = null; 40 - example = "i3lock -i /path/to/img"; 41 - type = types.nullOr types.string; 42 43 description = '' 44 The script to use when manually locking the computer with <command>xautolock -locknow</command>. ··· 56 57 notifier = mkOption { 58 default = null; 59 - example = literalExample '' 60 - "${pkgs.libnotify}/bin/notify-send \"Locking in 10 seconds\"" 61 - ''; 62 - type = types.nullOr types.string; 63 64 description = '' 65 Notification script to be used to warn about the pending autolock. ··· 68 69 killer = mkOption { 70 default = null; # default according to `man xautolock` is none 71 - example = "systemctl suspend"; 72 - type = types.nullOr types.string; 73 74 description = '' 75 The script to use when nothing has happend for as long as <option>killtime</option> ··· 131 assertion = cfg.killer != null -> cfg.killtime >= 10; 132 message = "killtime has to be at least 10 minutes according to `man xautolock`"; 133 } 134 - ]; 135 }; 136 }
··· 26 }; 27 28 locker = mkOption { 29 + default = "${pkgs.xlockmore}/bin/xlock"; # default according to `man xautolock` 30 + example = "${pkgs.i3lock}/bin/i3lock -i /path/to/img"; 31 + type = types.str; 32 33 description = '' 34 The script to use when automatically locking the computer. ··· 37 38 nowlocker = mkOption { 39 default = null; 40 + example = "${pkgs.i3lock}/bin/i3lock -i /path/to/img"; 41 + type = types.nullOr types.str; 42 43 description = '' 44 The script to use when manually locking the computer with <command>xautolock -locknow</command>. ··· 56 57 notifier = mkOption { 58 default = null; 59 + example = "${pkgs.libnotify}/bin/notify-send \"Locking in 10 seconds\""; 60 + type = types.nullOr types.str; 61 62 description = '' 63 Notification script to be used to warn about the pending autolock. ··· 66 67 killer = mkOption { 68 default = null; # default according to `man xautolock` is none 69 + example = "${pkgs.systemd}/bin/systemctl suspend"; 70 + type = types.nullOr types.str; 71 72 description = '' 73 The script to use when nothing has happend for as long as <option>killtime</option> ··· 129 assertion = cfg.killer != null -> cfg.killtime >= 10; 130 message = "killtime has to be at least 10 minutes according to `man xautolock`"; 131 } 132 + ] ++ (lib.flip map [ "locker" "notifier" "nowlocker" "killer" ] 133 + (option: 134 + { 135 + assertion = cfg."${option}" != null -> builtins.substring 0 1 cfg."${option}" == "/"; 136 + message = "Please specify a canonical path for `services.xserver.xautolock.${option}`"; 137 + }) 138 + ); 139 }; 140 }