forked from Fachschaft/nixConfig
42 lines
776 B
Nix
42 lines
776 B
Nix
{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";
|
|
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";
|
|
};
|
|
|
|
}
|