From 36e33dd5cb029bb929dc14e0a07ada5f8f0920bd Mon Sep 17 00:00:00 2001 From: Jimbo Date: Fri, 20 Sep 2024 02:30:50 -0400 Subject: [PATCH] Move to Forgejo --- nixos/server.nix | 2 +- nixos/server/forgejo.nix | 40 ++++++++++++++++++++++++++++++++++++++++ nixos/server/gitea.nix | 14 +++++++------- 3 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 nixos/server/forgejo.nix diff --git a/nixos/server.nix b/nixos/server.nix index 8312230..eb2b600 100644 --- a/nixos/server.nix +++ b/nixos/server.nix @@ -21,11 +21,11 @@ # Services ./services/openssh.nix ./server/acme.nix - ./server/adguard.nix ./server/ddclient.nix ./server/icecast.nix ./server/firewall.nix ./server/gitea.nix + ./server/forgejo.nix ./server/mailserver.nix ./server/mariadb.nix ./server/nginx.nix diff --git a/nixos/server/forgejo.nix b/nixos/server/forgejo.nix new file mode 100644 index 0000000..6efe02f --- /dev/null +++ b/nixos/server/forgejo.nix @@ -0,0 +1,40 @@ +# This is a hard fork of Gitea. +{outputs, ...}: { + services = { + forgejo = { + enable = true; + settings = { + server = { + DOMAIN = "git.${outputs.secrets.jimDomain}"; + ROOT_URL = "https://git.${outputs.secrets.jimDomain}:443"; + HTTP_PORT = 3110; + SSH_PORT = 2299; + START_SSH_SERVER = true; + }; + mailer = { + ENABLED = true; + SMTP_ADDR = "mx.${outputs.secrets.jimDomain}"; + FROM = "Jimbo's Git "; + USER = "noreply@${outputs.secrets.jimDomain}"; + PASSWD = outputs.secrets.noreplyPassword; + PROTOCOL = "smtps"; + }; + service = { + REGISTER_EMAIL_CONFIRM = true; + #DISABLE_REGISTRATION = true; + }; + }; + }; + nginx.virtualHosts."git.${outputs.secrets.jimDomain}" = { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://127.0.0.1:3110"; + proxyWebsockets = true; + }; + }; + }; + + # Allow Forgejo's SSH to work + networking.firewall.allowedTCPPorts = [ 2299 ]; +} diff --git a/nixos/server/gitea.nix b/nixos/server/gitea.nix index 962ce9c..b8f77b1 100644 --- a/nixos/server/gitea.nix +++ b/nixos/server/gitea.nix @@ -4,10 +4,10 @@ enable = true; settings = { server = { - DOMAIN = "git.${outputs.secrets.jimDomain}"; - ROOT_URL = "https://git.${outputs.secrets.jimDomain}:443"; - HTTP_PORT = 3110; - SSH_PORT = 2299; + DOMAIN = "gitea.${outputs.secrets.jimDomain}"; + ROOT_URL = "https://gitea.${outputs.secrets.jimDomain}:443"; + HTTP_PORT = 3115; + SSH_PORT = 2295; START_SSH_SERVER = true; }; mailer = { @@ -21,16 +21,16 @@ service.REGISTER_EMAIL_CONFIRM = true; }; }; - nginx.virtualHosts."git.${outputs.secrets.jimDomain}" = { + nginx.virtualHosts."gitea.${outputs.secrets.jimDomain}" = { enableACME = true; forceSSL = true; locations."/" = { - proxyPass = "http://127.0.0.1:3110"; + proxyPass = "http://127.0.0.1:3115"; proxyWebsockets = true; }; }; }; # Allow Gitea SSH to work - networking.firewall.allowedTCPPorts = [ 2299 ]; + networking.firewall.allowedTCPPorts = [ 2295 ]; }