nix-stuff/roles/server/gitea.nix

40 lines
1.1 KiB
Nix

{ config, lib, ... }:
{
specialisation.giteaEnableRegistration.configuration.services.gitea.settings.service.DISABLE_REGISTRATION = false;
services.gitea = {
enable = true;
# TODO: Make this not be hardcoded
settings = {
server = {
#server.SSH_PORT = 69;
DISABLE_REGISTRATION = lib.mkDefault true;
ROOT_URL = "http://everest/gitea/";
};
};
};
# Set up traefik as the reverse proxy for Gitea
services.traefik = {
dynamicConfigOptions = {
http = {
routers = {
/*
Gitea works best as a subdomain, but I do not have a dns server (yet),
and since tailscale doesn't support adding subdomains with MagicDNS I'll
just put it in a subpath for now
*/
gitea-subpath = {
middlewares = [ "gitea-strip-prefix" ];
rule = "PathPrefix(`/gitea`)";
service = "gitea";
};
};
services.gitea.loadBalancer.servers = [
{ url = "http://localhost:${toString config.services.gitea.settings.server.HTTP_PORT}"; }
];
# Gitea freaks out if you don't remove the subpath it's being proxied from
middlewares.gitea-strip-prefix.stripprefix.prefixes = "/gitea";
};
};
};
}