nix-config/modules/network/ssh.nix
2026-02-17 16:14:03 +01:00

31 lines
649 B
Nix

{
lib,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.horseman.network.ssh;
username = config.horseman.username;
in {
options = {
horseman.network.ssh = {
enable = mkEnableOption "";
};
};
config = mkIf cfg.enable {
services.openssh = {
enable = true;
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
AllowUsers = [username];
};
extraConfig = ''
Hostkey ${config.age.secrets.personalSSH.path}
Hostkey ${config.age.secrets.githubSSH.path}
'';
};
};
}