mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 15:11:34 +01:00
impermanence: Persist caddy, gatus and tailscale state
This commit is contained in:
parent
8ded789be2
commit
c6172d5556
4 changed files with 13 additions and 6 deletions
|
|
@ -6,13 +6,17 @@
|
|||
}:
|
||||
let
|
||||
cfg = config.custom.impermanence;
|
||||
|
||||
inherit (config.custom) services;
|
||||
in
|
||||
{
|
||||
imports = [ inputs.impermanence.nixosModules.impermanence ];
|
||||
|
||||
options.custom.impermanence.enable = lib.mkEnableOption "";
|
||||
options.custom = {
|
||||
impermanence.enable = lib.mkEnableOption "";
|
||||
persist.directories = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.path;
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
fileSystems."/persist".neededForBoot = true;
|
||||
|
|
@ -25,10 +29,7 @@ in
|
|||
"/var/lib/nixos"
|
||||
"/var/lib/systemd"
|
||||
"/var/log"
|
||||
|
||||
(lib.optionalString services.tailscale.enable "/var/lib/tailscale")
|
||||
];
|
||||
|
||||
files = [
|
||||
"/etc/machine-id"
|
||||
"/etc/ssh/ssh_host_ed25519_key"
|
||||
|
|
|
|||
|
|
@ -96,6 +96,8 @@ in
|
|||
)
|
||||
);
|
||||
};
|
||||
|
||||
custom.persist.directories = [ "/var/lib/caddy" ];
|
||||
}
|
||||
|
||||
(lib.mkIf tailscaleHostsExist {
|
||||
|
|
|
|||
|
|
@ -165,5 +165,7 @@ in
|
|||
cfg.endpoints |> lib.attrValues |> lib.map (entry: mkEndpoint entry);
|
||||
};
|
||||
};
|
||||
|
||||
custom.persist.directories = [ "/var/lib/private/gatus" ];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,5 +41,7 @@ in
|
|||
};
|
||||
|
||||
systemd.services.tailscaled-set.after = [ "tailscaled-autoconnect.service" ];
|
||||
|
||||
custom.persist.directories = [ "/var/lib/tailscale" ];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue