31 lines
652 B
Nix
Raw Permalink Normal View History

2025-05-04 02:47:36 +02:00
{
lib,
config,
...
}:
with lib; let
2025-07-05 00:02:39 +02:00
cfg = config.system.services.ssh;
2025-05-04 02:47:36 +02:00
in {
2025-07-05 00:02:39 +02:00
options.system.services.ssh = {
2025-05-04 02:47:36 +02:00
enable = mkEnableOption "Enables OpenSSH";
allowedUsers = mkOption {
type = types.listOf types.str;
example = ["alice" "bob"];
default = ["phundrak"];
};
passwordAuthentication = mkOption {
type = types.bool;
example = true;
default = false;
};
};
config.services.openssh = mkIf cfg.enable {
2025-07-05 00:02:39 +02:00
inherit (cfg) enable;
2025-05-04 02:47:36 +02:00
settings = {
AllowUsers = cfg.allowedUsers;
PermitRootLogin = "no";
PasswordAuthentication = cfg.passwordAuthentication;
};
};
}