Compare commits

..

2 commits

Author SHA1 Message Date
Bruno BELANYI cff3811cad home: wm: screen-lock: use actual assertion
All checks were successful
continuous-integration/drone/push Build is passing
Instead of hijacking the type verification, use an assertion.
2021-06-15 17:45:17 +02:00
Bruno BELANYI 8f266245ee modules: system: add boot
And enable mounting `/tmp` as tmpfs by default.
2021-06-14 16:41:28 +02:00
4 changed files with 39 additions and 7 deletions

View file

@ -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 = ''

View file

@ -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;

21
modules/system/boot.nix Normal file
View file

@ -0,0 +1,21 @@
{ config, lib, ... }:
let
cfg = config.my.system.boot;
in
{
options.my.system.boot = with lib; {
tmp = {
clean = mkEnableOption "clean `/tmp` on boot.";
tmpfs = my.mkDisableOption "mount `/tmp` as a tmpfs on boot.";
};
};
config = {
boot = {
cleanTmpDir = cfg.tmp.clean;
tmpOnTmpfs = cfg.tmp.tmpfs;
};
};
}

View file

@ -3,6 +3,7 @@
{ {
imports = [ imports = [
./boot.nix
./documentation.nix ./documentation.nix
./language.nix ./language.nix
./media.nix ./media.nix