From 8f266245eed181ac9de1263eb416a57c1d6ab186 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 14 Jun 2021 16:41:28 +0200 Subject: [PATCH 1/2] modules: system: add boot And enable mounting `/tmp` as tmpfs by default. --- modules/system/boot.nix | 21 +++++++++++++++++++++ modules/system/default.nix | 1 + 2 files changed, 22 insertions(+) create mode 100644 modules/system/boot.nix diff --git a/modules/system/boot.nix b/modules/system/boot.nix new file mode 100644 index 0000000..0fed267 --- /dev/null +++ b/modules/system/boot.nix @@ -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; + }; + }; +} diff --git a/modules/system/default.nix b/modules/system/default.nix index 48a0770..a9b251b 100644 --- a/modules/system/default.nix +++ b/modules/system/default.nix @@ -3,6 +3,7 @@ { imports = [ + ./boot.nix ./documentation.nix ./language.nix ./media.nix From cff3811cade39de009d1925586aa5a8d514f22d6 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 15 Jun 2021 17:45:17 +0200 Subject: [PATCH 2/2] home: wm: screen-lock: use actual assertion Instead of hijacking the type verification, use an assertion. --- home/wm/default.nix | 8 +------- home/wm/screen-lock.nix | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) 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;