From 3d4c301bd8d98aea9df630ee59fc35fe84baac50 Mon Sep 17 00:00:00 2001 From: SebastianStork Date: Fri, 13 Jun 2025 20:56:29 +0200 Subject: [PATCH] Set forgejo ssh port with an option --- modules/system/services/forgejo/ssh.nix | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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;