Files
nix-config/modules/services/ssh.nix
T
phundrak 5f4a7a4a42 refactor!: switch to dendritic pattern
BREAKING CHANGE: complete reorganization of the repository
2026-09-30 18:36:06 +02:00

38 lines
914 B
Nix

{
flake.modules.nixos.ssh = {
lib,
config,
...
}:
with lib; let
cfg = config.mySystem.services.ssh;
in {
options.mySystem.services.ssh = {
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;
};
port = mkOption {
type = types.int;
default = 22;
};
};
config.services.openssh = mkIf cfg.enable {
inherit (cfg) enable;
ports = [cfg.port];
settings = {
AllowUsers = cfg.allowedUsers;
PermitRootLogin = "no";
PasswordAuthentication = cfg.passwordAuthentication;
};
};
};
}