{ config, ... }:
{
  imports = [
    ./nginx
  ];

  services = {
    forgejo = {
      enable = true;
      settings = {
        server = {
          DOMAIN = "git.${config.domains.jim1}";
          ROOT_URL = "https://git.${config.domains.jim1}:443";
          HTTP_PORT = 3110;
          SSH_PORT = 2299;
          START_SSH_SERVER = true;
        };
        ui = {
          DEFAULT_THEME = "forgejo-dark";
        };
        mailer = {
          ENABLED = true;
          SMTP_ADDR = "mx.${config.domains.jim1}";
          FROM = "Jimbo's Git <noreply@${config.domains.jim1}>";
          USER = "noreply@${config.domains.jim1}";
          PASSWD = config.secrets.noreplyPassword;
          PROTOCOL = "smtps";
        };
        service = {
          REGISTER_EMAIL_CONFIRM = true;
          DISABLE_REGISTRATION = true;
        };
      };
    };
  };

  # Allow Forgejo's SSH to work
  networking.firewall.allowedTCPPorts = [ 2299 ];
}