feat: moved ssh config to use new storage config

This commit is contained in:
Leyla Becker 2025-11-08 19:04:59 -06:00
parent 5acf060e9e
commit 1310b50794

View file

@ -3,6 +3,13 @@
config, config,
... ...
}: { }: {
options = {
services.openssh.impermanence.enable = lib.mkOption {
type = lib.types.bool;
default = config.services.openssh.enable && config.storage.impermanence.enable;
};
};
config = lib.mkMerge [ config = lib.mkMerge [
{ {
services = { services = {
@ -17,12 +24,32 @@
}; };
}; };
} }
(lib.mkIf config.host.impermanence.enable { (lib.mkIf config.storage.zfs.enable (lib.mkMerge [
environment.persistence."/persist/system/root" = { {
files = lib.lists.flatten ( # SSH host keys need to be persisted to maintain server identity
builtins.map (hostKey: [hostKey.path "${hostKey.path}.pub"]) config.services.openssh.hostKeys }
); (lib.mkIf (!config.services.openssh.impermanence.enable) {
}; # TODO: placeholder to configure a unique dataset for this service
}) })
(lib.mkIf config.services.openssh.impermanence.enable {
storage.impermanence.datasets."persist/system/root" = {
files = builtins.listToAttrs (
lib.lists.flatten (
builtins.map (hostKey: [
{
name = hostKey.path;
value = {enable = true;};
}
{
name = "${hostKey.path}.pub";
value = {enable = true;};
}
])
config.services.openssh.hostKeys
)
);
};
})
]))
]; ];
} }