services.gitea: add ssh configuration

This commit is contained in:
陈浩南 2024-05-10 18:23:07 +08:00
parent 0dfb95d722
commit 6066245021
3 changed files with 13 additions and 3 deletions

View File

@ -73,7 +73,7 @@ inputs:
wireguardIp = "192.168.83.4";
};
hpcstat = {};
gitea = { enable = true; hostname = "git.nas.chn.moe"; };
gitea = { enable = true; hostname = "git.nas.chn.moe"; ssh = { hostname = "office.chn.moe"; port = 5440; }; };
};
user.users = [ "chn" "xll" "zem" "yjq" "gb" ];
};

View File

@ -54,7 +54,7 @@ inputs:
fz-new-order = {};
nginx.applications = { kkmeeting.enable = true; webdav.instances."webdav.chn.moe" = {}; };
httpapi.enable = true;
gitea.enable = true;
gitea = { enable = true; ssh = {}; };
grafana.enable = true;
fail2ban = {};
wireguard =

View File

@ -4,6 +4,15 @@ inputs:
{
enable = mkOption { type = types.bool; default = false; };
hostname = mkOption { type = types.str; default = "git.chn.moe"; };
ssh = mkOption
{
type = types.nullOr (types.submodule { options =
{
hostname = mkOption { type = types.str; default = "ssh.${inputs.config.nixos.services.gitea.hostname}"; };
port = mkOption { type = types.nullOr types.ints.unsigned; default = null; };
};});
default = null;
};
};
config = let inherit (inputs.config.nixos.services) gitea; in inputs.lib.mkIf gitea.enable
{
@ -27,7 +36,8 @@ inputs:
ROOT_URL = "https://${gitea.hostname}";
DOMAIN = gitea.hostname;
HTTP_PORT = 3002;
SSH_DOMAIN = "ssh.${gitea.hostname}";
SSH_DOMAIN = inputs.lib.mkIf (gitea.ssh != null) gitea.ssh.hostname;
SSH_PORT = inputs.lib.mkIf ((gitea.ssh.port or null) != null) gitea.ssh.port;
};
mailer =
{