From b358a3d72d3958da60978d6d8f1729083be15cd6 Mon Sep 17 00:00:00 2001 From: Antoine Viallon Date: Tue, 25 Jan 2022 12:05:14 +0100 Subject: [PATCH] [NonPersistence] add neededForBoot to /persist and /var/log, and verify that they exist --- non-persistence.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/non-persistence.nix b/non-persistence.nix index 7d84223..86633ca 100644 --- a/non-persistence.nix +++ b/non-persistence.nix @@ -8,10 +8,32 @@ in enable = mkEnableOption "non-persitent root"; }; config = mkIf cfg.enable { + assertions = [ + { assertion = hasAttr "/persist" config.fileSystems; + message = "A /persist partition is needed for non-persistence"; + } + { assertion = hasAttr "/var/log" config.fileSystems; + message = "A /var/log separate parition is needed to avoid missing early logs."; + } + ]; + environment.etc = { nixos.source = "/persist/etc/nixos"; NIXOS.source = "/persist/etc/NIXOS"; machine-id.source = "/persist/etc/machine-id"; }; + + + fileSystems = { + "/var/log" = { + neededForBoot = true; + autoFormat = true; + label = "nixos-persistent-logs"; + }; + "/persist" = { + neededForBoot = true; + label = "nixos-persistent-data"; + }; + }; }; }