mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-06 01:38:06 +00:00
[NonPersistence] add neededForBoot to /persist and /var/log, and verify that they exist
This commit is contained in:
parent
f4c1a39c8c
commit
b358a3d72d
1 changed files with 22 additions and 0 deletions
|
|
@ -8,10 +8,32 @@ in
|
||||||
enable = mkEnableOption "non-persitent root";
|
enable = mkEnableOption "non-persitent root";
|
||||||
};
|
};
|
||||||
config = mkIf cfg.enable {
|
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 = {
|
environment.etc = {
|
||||||
nixos.source = "/persist/etc/nixos";
|
nixos.source = "/persist/etc/nixos";
|
||||||
NIXOS.source = "/persist/etc/NIXOS";
|
NIXOS.source = "/persist/etc/NIXOS";
|
||||||
machine-id.source = "/persist/etc/machine-id";
|
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";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue