{ lib, config, ... }: let cfg = config.services.forgejo; srv = cfg.settings.server; domain = "git.sposi.to"; in { security.acme = { acceptTerms = true; defaults.email = "thiago@sposi.to"; }; services.nginx = { enable = true; virtualHosts.${domain} = { forceSSL = true; enableACME = true; extraConfig = '' client_max_body_size 512M; ''; locations."/".proxyPass = "http://localhost:${toString srv.HTTP_PORT}"; }; }; services.forgejo = { enable = true; database.type = "sqlite3"; lfs.enable = true; settings = { server = { DOMAIN = domain; ROOT_URL = "https://${domain}/"; HTTP_PORT = 3000; }; service.DISABLE_REGISTRATION = true; }; }; services.forgejo.settings.server.SSH_PORT = lib.mkDefault (lib.head (config.services.openssh.ports or [ 22 ])); }