From c9a7921802652072e60c9f5b62377618fb7cd1fa Mon Sep 17 00:00:00 2001 From: joy Date: Sun, 20 Oct 2024 02:34:02 +0200 Subject: [PATCH] copy forgejo module from nixos wiki --- modules/services/forgejo/default.nix | 33 +++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/modules/services/forgejo/default.nix b/modules/services/forgejo/default.nix index 3720d58..a7a1f07 100644 --- a/modules/services/forgejo/default.nix +++ b/modules/services/forgejo/default.nix @@ -1,6 +1,29 @@ -{ - services.forgejo.enable = true; - services.forgejo.settings.server.HTTP_PORT = 2000; - services.forgejo.settings.server.DOMAIN = "git.joygnu.org"; - services.forgejo.settings.server.PROTOCOL = "https"; +{config, ...}: let + cfg = config.services.forgejo; + srv = cfg.settings.server; +in { + services.nginx = { + virtualHosts.${cfg.settings.server.DOMAIN} = { + forceSSL = true; + enableACME = true; + extraConfig = '' + client_max_body_size 512M; + ''; + locations."/".proxyPass = "http://localhost:${toString srv.HTTP_PORT}"; + }; + }; + + services.forgejo = { + enable = true; + lfs.enable = true; + # user = "git"; + settings = { + server = { + DOMAIN = "git.joygnu.org"; + ROOT_URL = "https://${srv.DOMAIN}/"; + HTTP_PORT = 2000; + }; + service.DISABLE_REGISTRATION = true; + }; + }; }