diff --git a/home/wm/default.nix b/home/wm/default.nix index 508fe76..2547a4e 100644 --- a/home/wm/default.nix +++ b/home/wm/default.nix @@ -65,13 +65,7 @@ in enable = my.mkDisableOption "Notify when about to lock the screen"; delay = mkOption { - type = with types; - addCheck int (x: - let - cfg = config.my.home.wm.screen-lock.notify; - cornerCfg = config.my.home.wm.screen-lock.cornerLock; - in - (cfg.enable && cornerCfg.enable) -> cornerCfg.delay >= x); + type = types.int; default = 5; example = 15; description = '' diff --git a/home/wm/screen-lock.nix b/home/wm/screen-lock.nix index 720e73a..9201f40 100644 --- a/home/wm/screen-lock.nix +++ b/home/wm/screen-lock.nix @@ -12,6 +12,22 @@ let in { config = lib.mkIf cfg.enable { + assertions = [ + { + assertion = + let + inherit (cfg) cornerLock notify; + bothEnabled = cornerLock.enable && notify.enable; + cornerLockHigherThanNotify = cornerLock.delay >= notify.delay; + in + bothEnabled -> cornerLockHigherThanNotify; + message = '' + `config.my.home.wm.notify.delay` cannot have a value higher than + `config.my.home.wm.cornerLock.delay`. + ''; + } + ]; + services.screen-locker = { enable = true;