feat: add some files and dirs to persist by default
This commit is contained in:
parent
9a9abac938
commit
bd8fa8a9ae
@ -15,6 +15,7 @@ let
|
|||||||
mkMerge
|
mkMerge
|
||||||
mkOption
|
mkOption
|
||||||
nameValuePair
|
nameValuePair
|
||||||
|
optionalAttrs
|
||||||
;
|
;
|
||||||
inherit (lib.types) listOf path str;
|
inherit (lib.types) listOf path str;
|
||||||
inherit (builtins) concatMap;
|
inherit (builtins) concatMap;
|
||||||
@ -99,9 +100,6 @@ in
|
|||||||
) userPersists;
|
) userPersists;
|
||||||
in
|
in
|
||||||
mkIf cfg.enable {
|
mkIf cfg.enable {
|
||||||
# Persist users uid by default
|
|
||||||
persist.state.directories = [ "/var/lib/nixos" ];
|
|
||||||
|
|
||||||
environment.persistence.${cfg.persistRoot} = {
|
environment.persistence.${cfg.persistRoot} = {
|
||||||
hideMounts = true;
|
hideMounts = true;
|
||||||
directories = allDirectories;
|
directories = allDirectories;
|
||||||
@ -145,5 +143,32 @@ in
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
fileSystems.${cfg.persistRoot}.neededForBoot = true;
|
||||||
|
# TODO: disable some dirs if using zfs
|
||||||
|
# Persist by default
|
||||||
|
persist.cache.directories = [
|
||||||
|
"/var/cache"
|
||||||
|
];
|
||||||
|
persist.state = {
|
||||||
|
directories =
|
||||||
|
[
|
||||||
|
"/var/lib/nixos"
|
||||||
|
"/var/lib/systemd"
|
||||||
|
]
|
||||||
|
++ lib.optionals config.services.mysql.enable [
|
||||||
|
config.services.mysql.dataDir
|
||||||
|
]
|
||||||
|
++ lib.optionals config.services.postgresql.enable [
|
||||||
|
"/var/lib/postgresql"
|
||||||
|
];
|
||||||
|
files = [
|
||||||
|
"/etc/machine-id"
|
||||||
|
"/etc/ssh/ssh_host_ed25519_key"
|
||||||
|
"/etc/ssh/ssh_host_ed25519_key.pub"
|
||||||
|
"/etc/ssh/ssh_host_rsa_key"
|
||||||
|
"/etc/ssh/ssh_host_rsa_key.pub"
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user