first impermanence config

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

View file

@ -21,6 +21,7 @@
imports = [
(import (./. + "/machines/${name}/configuration.nix") inputs)
inputs.sops-nix.nixosModules.sops
inputs.impermanence.nixosModules.impermanence
];
};
in lib.genAttrs machines makeSystem);

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";
};
}

View file

@ -3,6 +3,7 @@
imports = [
./admins.nix
./nix_keys.nix
../modules/impermanence.nix
];
nix = {
extraOptions = ''
@ -25,6 +26,8 @@ users = {
mutableUsers = false;
};
impermanence.enable = true;
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
environment = {