diff --git a/modules/system/services/forgejo/ssh.nix b/modules/system/services/forgejo/ssh.nix index ef02c00..cafacc4 100644 --- a/modules/system/services/forgejo/ssh.nix +++ b/modules/system/services/forgejo/ssh.nix @@ -1,10 +1,22 @@ { config, lib, ... }: +let + cfg = config.custom.services.forgejo.ssh; +in { - options.custom.services.forgejo.ssh.enable = lib.mkEnableOption ""; + options.custom.services.forgejo.ssh = { + enable = lib.mkEnableOption ""; + port = lib.mkOption { + type = lib.types.port; + default = 22; + }; + }; + + config = lib.mkIf cfg.enable { + services.forgejo.settings.server.SSH_PORT = cfg.port; - config = lib.mkIf config.custom.services.forgejo.ssh.enable { services.openssh = { enable = true; + ports = lib.mkForce [ cfg.port ]; authorizedKeysFiles = lib.mkForce [ "${config.services.forgejo.stateDir}/.ssh/authorized_keys" ]; settings = { PasswordAuthentication = false;