enable gitea to listen on the default ssh port for nicer clone urls

This commit is contained in:
Cyryl Płotnicki 2022-10-29 22:44:34 +01:00
parent f6fe541f34
commit ac9b3a55b8

View file

@ -1,14 +1,15 @@
{ config, pkgs, inputs, lib, ... }: { config, pkgs, inputs, lib, ... }:
let let
httpPort = 8083; httpPort = 8083;
sshPort = 2222; sshContainerPort = 22222;
sshHostPort = 22;
domain = "git.cyplo.dev"; domain = "git.cyplo.dev";
baseurl = "https://${domain}"; baseurl = "https://${domain}";
path = "/var/lib/gitea"; path = "/var/lib/gitea";
in { in {
imports = [ ../nginx.nix ]; imports = [ ../nginx.nix ];
networking.firewall.allowedTCPPorts = [ sshPort ]; networking.firewall.allowedTCPPorts = [ sshHostPort ];
services.nginx = { services.nginx = {
virtualHosts = { virtualHosts = {
"${domain}" = { "${domain}" = {
@ -29,8 +30,8 @@ in {
hostPort = httpPort; hostPort = httpPort;
} }
{ {
containerPort = sshPort; containerPort = sshContainerPort;
hostPort = sshPort; hostPort = sshHostPort;
} }
]; ];
bindMounts = { bindMounts = {
@ -39,7 +40,7 @@ in {
isReadOnly = false; isReadOnly = false;
}; };
}; };
config = { config, pkgs, ... }: { config = { config, pkgs, lib, ... }: {
system.stateVersion = "22.05"; system.stateVersion = "22.05";
services.gitea = { services.gitea = {
enable = true; enable = true;
@ -48,11 +49,14 @@ in {
httpPort = httpPort; httpPort = httpPort;
disableRegistration = true; disableRegistration = true;
stateDir = path; stateDir = path;
ssh = { settings = {
enable = true; server = {
clonePort = sshPort; START_SSH_SERVER = true;
SSH_PORT = sshHostPort;
SSH_LISTEN_PORT = sshContainerPort;
DISABLE_SSH = false;
};
}; };
settings = { server = { START_SSH_SERVER = true; }; };
}; };
}; };
}; };