From b6f1704af3ae8a8026b6d9b0f7f182a03cbbf8c4 Mon Sep 17 00:00:00 2001 From: Leyla Becker Date: Fri, 13 Dec 2024 21:40:47 -0600 Subject: [PATCH] added assertion --- modules/nixos-modules/impermanence.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/nixos-modules/impermanence.nix b/modules/nixos-modules/impermanence.nix index a923b82..e6e1ecc 100644 --- a/modules/nixos-modules/impermanence.nix +++ b/modules/nixos-modules/impermanence.nix @@ -5,7 +5,6 @@ }: { options.host.impermanence.enable = lib.mkEnableOption "are we going to use impermanence on this device"; - # TODO: validate that config.host.storage.enable is enabled config = lib.mkMerge [ { assertions = [ @@ -19,6 +18,13 @@ } ( lib.mkIf config.host.impermanence.enable { + assertions = [ + { + assertion = config.host.impermanence.enable && config.host.storage.enable; + message = "Impermanence can not be used without managed host storage."; + } + ]; + boot.initrd.postResumeCommands = lib.mkAfter '' zfs rollback -r rpool/local/system/root@blank 1 '';