nix-dotfiles/nixosModules/services/ssh/service.nix

24 lines
490 B
Nix

{ config, lib, ... }:
{
options.sshd = {
enable = lib.mkEnableOption "Enables ssh daemon";
port = lib.mkOption {
default = 22;
type = lib.types.port;
};
};
config = lib.mkIf config.sshd.enable {
services.openssh = {
enable = true;
ports = [ config.sshd.port ];
settings = {
ClientAliveInterval = 60;
ClientAliveCountMax = 3;
PasswordAuthentication = false;
PermitRootLogin = "no";
};
};
};
}