{
  config,
  lib,
  pkgs,
  ...
}:
let
  base_path = "/ZFS/ZFS-primary/gitea";
in
{
  services.gitea = {
    enable = true;
    appName = "Nyx's Gitea"; # Give the site a name
    database = {
      type = "postgres";
      passwordFile = config.sops.secrets."gitea/dbpass".path;
      host = "127.0.0.1:5432";
    };
    domain = "git.alicehuston.xyz";
    rootUrl = "https://git.alicehuston.xyz/";
    httpPort = 443;
    stateDir = base_path;
    lfs.enable = true;
    recommendedDefaults = true;
  };

  sops.secrets = {
    "gitea/dbpass".owner = "gitea";
  };
}