mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 17:31: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
|
let
|
||||||
cfg = config.custom.impermanence;
|
cfg = config.custom.impermanence;
|
||||||
|
|
||||||
inherit (config.custom) services;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ inputs.impermanence.nixosModules.impermanence ];
|
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 {
|
config = lib.mkIf cfg.enable {
|
||||||
fileSystems."/persist".neededForBoot = true;
|
fileSystems."/persist".neededForBoot = true;
|
||||||
|
|
@ -25,10 +29,7 @@ in
|
||||||
"/var/lib/nixos"
|
"/var/lib/nixos"
|
||||||
"/var/lib/systemd"
|
"/var/lib/systemd"
|
||||||
"/var/log"
|
"/var/log"
|
||||||
|
|
||||||
(lib.optionalString services.tailscale.enable "/var/lib/tailscale")
|
|
||||||
];
|
];
|
||||||
|
|
||||||
files = [
|
files = [
|
||||||
"/etc/machine-id"
|
"/etc/machine-id"
|
||||||
"/etc/ssh/ssh_host_ed25519_key"
|
"/etc/ssh/ssh_host_ed25519_key"
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,8 @@ in
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
custom.persist.directories = [ "/var/lib/caddy" ];
|
||||||
}
|
}
|
||||||
|
|
||||||
(lib.mkIf tailscaleHostsExist {
|
(lib.mkIf tailscaleHostsExist {
|
||||||
|
|
|
||||||
|
|
@ -165,5 +165,7 @@ in
|
||||||
cfg.endpoints |> lib.attrValues |> lib.map (entry: mkEndpoint entry);
|
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" ];
|
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