aboutsummaryrefslogtreecommitdiff
path: root/modules/nixos/services/ssh/default.nix
blob: 68568971f62380c6111ba342eb61561b899e333d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{ options, config, lib, namespace, ... }:

with lib; with lib.${namespace}; let
  cfg = config.${namespace}.services.ssh;
  impermanence = config.${namespace}.system.impermanence;
in {
  options.${namespace}.services.ssh = with types; {
    enable = mkEnableOption "ssh server";

    port = mkOption {
      type = types.port;
      default = 22;
      description = "ssh server port";
    };
  };

  config = mkIf cfg.enable {
    openssh = {
      enable = true;
      ports = [ cfg.port ];
      
      settings = {
        PermitRootLogin = "no";
        PasswordAuthentication = false;
      };
    };
  };
}