nix-conf/hosts/Nixcloud/forgejo.nix

42 lines
980 B
Nix

{ lib, config, ... }:
let
cfg = config.services.forgejo;
srv = cfg.settings.server;
domain = "git.sposi.to";
in
{
security.acme = {
acceptTerms = true;
defaults.email = "th.spo@pm.me";
};
services.nginx = {
enable = true;
virtualHosts.${domain} = {
forceSSL = true;
enableACME = true;
# Allow HTTP initially for ACME challenge, will redirect to HTTPS once cert is ready
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 ]));
}