{config, ...}: let
  cfg = config.services.forgejo;
in {
  services.forgejo = {
    enable = true;
    dump.enable = true;
    lfs.enable = true;
    settings = {
      server = {
        ROOT_URL = "https://${cfg.settings.server.DOMAIN}";
        DOMAIN = "git.${config.networking.domain}";
      };
      service = {
        DISABLE_REGISTRATION = true;
      };
      repository = {
        ENABLE_PUSH_CREATE_USER = true;
      };
    };
  };
  services.nginx.virtualHosts.${cfg.settings.server.DOMAIN} = {
    forceSSL = true;
    enableACME = true;
    locations."~".proxyPass = "http://localhost:${toString cfg.settings.server.HTTP_PORT}";
  };
}
