From 861170eda2eb62bf000b188e006094207d83104e Mon Sep 17 00:00:00 2001 From: Jurn Wubben Date: Mon, 23 Jun 2025 20:26:51 +0200 Subject: [PATCH 1/2] Added forgejo --- system/server/default.nix | 2 +- system/server/forgejo.nix | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 system/server/forgejo.nix diff --git a/system/server/default.nix b/system/server/default.nix index 5cd7cdd..c950877 100644 --- a/system/server/default.nix +++ b/system/server/default.nix @@ -1,4 +1,4 @@ {lib, ...}: { - imports = [./caddy.nix ./index ./seafile.nix ./bot.nix ./immich.nix ./matrix.nix ./mail.nix]; + imports = [./caddy.nix ./index ./seafile.nix ./bot.nix ./immich.nix ./matrix.nix ./mail.nix ./forgejo.nix]; options.niksos.server = lib.mkEnableOption "server servcies (such as caddy)."; #TODO: per service option. } diff --git a/system/server/forgejo.nix b/system/server/forgejo.nix new file mode 100644 index 0000000..136d776 --- /dev/null +++ b/system/server/forgejo.nix @@ -0,0 +1,37 @@ +{ + config, + lib, + ... +}: let + DOMAIN = "git.jsw.tf"; +in { + config = + lib.mkIf config.niksos.server + { + services.caddy.virtualHosts.${DOMAIN}.extraConfig = '' + request_body { + max_size 512M + } + reverse_proxy localhost:9004 + ''; + + services.forgejo = { + enable = true; + database.type = "postgres"; + lfs.enable = true; + + settings = { + server = { + inherit DOMAIN; + ROOT_URL = "https://${DOMAIN}/"; + HTTP_PORT = 9004; + }; + service.DISABLE_REGISTRATION = false; + actions = { + ENABLED = true; + DEFAULT_ACTIONS_URL = "github"; + }; + }; + }; + }; +} From 9f06e310107802e1c67035a0f55b23623c0bc96e Mon Sep 17 00:00:00 2001 From: Jurn Wubben Date: Mon, 23 Jun 2025 20:29:10 +0200 Subject: [PATCH 2/2] Forgejo disable account creation --- system/server/forgejo.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/server/forgejo.nix b/system/server/forgejo.nix index 136d776..17086b6 100644 --- a/system/server/forgejo.nix +++ b/system/server/forgejo.nix @@ -26,7 +26,7 @@ in { ROOT_URL = "https://${DOMAIN}/"; HTTP_PORT = 9004; }; - service.DISABLE_REGISTRATION = false; + service.DISABLE_REGISTRATION = true; actions = { ENABLED = true; DEFAULT_ACTIONS_URL = "github";