From 2006d2b53efb19cfd1e6a1d626bb6f50f25a49d2 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Mon, 6 Jan 2025 12:00:00 +0000 Subject: [PATCH] nixedo: re-add forgejo --- .../nixos/features/homelab/default.nix | 1 + .../nixos/features/homelab/forgejo.nix | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 nix/modules/nixos/features/homelab/forgejo.nix diff --git a/nix/modules/nixos/features/homelab/default.nix b/nix/modules/nixos/features/homelab/default.nix index c7da8eb..897465c 100644 --- a/nix/modules/nixos/features/homelab/default.nix +++ b/nix/modules/nixos/features/homelab/default.nix @@ -2,6 +2,7 @@ imports = [ ./audiobookshelf.nix ./beaverhabits.nix + ./forgejo.nix ./freshrss.nix ./gitea.nix ./immich.nix diff --git a/nix/modules/nixos/features/homelab/forgejo.nix b/nix/modules/nixos/features/homelab/forgejo.nix new file mode 100644 index 0000000..509c34c --- /dev/null +++ b/nix/modules/nixos/features/homelab/forgejo.nix @@ -0,0 +1,34 @@ +{ config, lib, ... }: + +with lib; + +{ + options.features.homelab.forgejo.enable = mkEnableOption "Enable forgejo"; + + config = mkIf config.features.homelab.forgejo.enable { + services = { + forgejo = { + enable = true; + group = "media"; + stateDir = "/mnt/media/forgejo"; + + settings = { + server = { + DOMAIN = "forgejo.opdavies.uk"; + HTTP_PORT = 2223; + }; + + service = { + DISABLE_REGISTRATION = true; + }; + }; + }; + + caddy.virtualHosts."${config.services.forgejo.settings.server.DOMAIN}" = { + useACMEHost = "opdavies.uk"; + + extraConfig = "reverse_proxy localhost:${toString config.services.forgejo.settings.server.HTTP_PORT}"; + }; + }; + }; +}