[#9] first impermanence config support

This commit is contained in:
Dennis Frieberg 2023-09-28 17:12:34 +02:00
parent 4515516ba8
commit d008620456
Signed by: nerf
GPG key ID: 42DED0E2D8F04FB6
5 changed files with 65 additions and 0 deletions

View file

@ -0,0 +1,42 @@
{lib, config, ...} :
let
inherit (lib)
mkEnableOption
mkIf
mkOption
types
;
cfg = config.impermanence;
in
{
imports = [ ];
options.impermanence = {
enable = mkEnableOption "impermanence";
storagePath = mkOption {
type = types.path;
default = "/persist/persist";
description = "The path where persistent data is stored";
};
name = mkOption {
type = types.str;
default = "persist";
description = "the name of the persistent data store";
};
};
config = mkIf cfg.enable {
environment.persistence.${cfg.name} = {
persistentStoragePath = cfg.storagePath;
directories = [
"/var/log"
"/etc/ssh"
"/var/lib/nixos"
];
};
environment.etc.machine-id.source = "${cfg.storagePath}/machine-id";
};
}