nix-config/modules/nixos-modules/ssh.nix

30 lines
680 B
Nix

{
lib,
config,
...
}: {
config = lib.mkMerge [
{
services = {
openssh = {
enable = true;
ports = [22];
settings = {
PasswordAuthentication = false;
UseDns = true;
X11Forwarding = false;
};
};
};
programs.ssh.kexAlgorithms = config.services.openssh.settings.KexAlgorithms;
}
(lib.mkIf config.host.impermanence.enable {
environment.persistence."/persist/system/root" = {
files = lib.lists.flatten (
builtins.map (hostKey: [hostKey.path "${hostKey.path}.pub"]) config.services.openssh.hostKeys
);
};
})
];
}