{ pkgs, config, ... }: let cfg = config.services.forgejo; srv = cfg.settings.server; in { services.nginx = { enable = true; 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; package = pkgs.forgejo; database.type = "sqlite3"; settings = { server = { DOMAIN = "git.sorre.xyz"; # You need to specify this to remove the port from URLs in the web UI. ROOT_URL = "https://${srv.DOMAIN}/"; HTTP_PORT = 3000; }; # You can temporarily allow registration to create an admin user. service.DISABLE_REGISTRATION = true; # Add support for actions, based on act: https://github.com/nektos/act actions = { ENABLED = true; DEFAULT_ACTIONS_URL = "https://code.forgejo.org"; }; }; }; services.gitea-actions-runner = { package = pkgs.forgejo-runner; instances.default = { enable = true; name = "monolith"; url = "https://git.sorre.xyz"; tokenFile = config.sops.secrets."forgejo-runner-token".path; labels = [ "ubuntu-24.04:docker://ubuntu:24.04" "docker:docker://node:current-trixie" ]; }; }; }