home: wm: screen-lock: use actual assertion
Instead of hijacking the type verification, use an assertion.
This commit is contained in:
parent
e4d3d8a949
commit
48859859eb
|
@ -65,13 +65,7 @@ in
|
||||||
enable = my.mkDisableOption "Notify when about to lock the screen";
|
enable = my.mkDisableOption "Notify when about to lock the screen";
|
||||||
|
|
||||||
delay = mkOption {
|
delay = mkOption {
|
||||||
type = with types;
|
type = types.int;
|
||||||
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);
|
|
||||||
default = 5;
|
default = 5;
|
||||||
example = 15;
|
example = 15;
|
||||||
description = ''
|
description = ''
|
||||||
|
|
|
@ -12,6 +12,22 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
config = lib.mkIf cfg.enable {
|
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 = {
|
services.screen-locker = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue