2022-09-18 15:13:50 -07:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
|
|
|
services.gitea = {
|
|
|
|
enable = true;
|
|
|
|
appName = "Sealight Git Forge";
|
|
|
|
domain = "git.sealight.xyz";
|
|
|
|
rootUrl = "https://git.sealight.xyz";
|
|
|
|
httpPort = 3001;
|
2022-11-14 04:16:08 -08:00
|
|
|
extraConfig = ''
|
|
|
|
[markup.restructuredtext]
|
|
|
|
ENABLED = true
|
|
|
|
FILE_EXTENSIONS = .rst
|
2022-11-14 05:18:46 -08:00
|
|
|
RENDER_COMMAND = "timeout 30s pandoc +RTS -M512M -RTS -f rst"
|
2022-11-14 04:16:08 -08:00
|
|
|
IS_INPUT_FILE = false
|
|
|
|
'';
|
2022-09-18 15:13:50 -07:00
|
|
|
database = {
|
|
|
|
type = "postgres";
|
|
|
|
# passwordFile = "/run/secrets/gitea-dbpass"; # TODO supplied by agenix
|
|
|
|
password = "somethingunknowablesorry";
|
|
|
|
};
|
|
|
|
settings = {
|
|
|
|
metrics = {
|
|
|
|
ENABLED = true;
|
|
|
|
};
|
|
|
|
repository = {
|
|
|
|
DEFAULT_BRANCH = "main";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-11-14 05:18:46 -08:00
|
|
|
environment.systemPackages = [ pkgs.pandoc ];
|
2022-09-18 15:13:50 -07:00
|
|
|
services.postgresql = {
|
|
|
|
enable = true; # Ensure postgresql is enabled
|
|
|
|
authentication = ''
|
|
|
|
local gitea all ident map=gitea-users
|
|
|
|
'';
|
|
|
|
identMap = # Map the gitea user to postgresql
|
|
|
|
''
|
|
|
|
gitea-users gitea gitea
|
|
|
|
'';
|
|
|
|
# ensureDatabases = [ "gitea" ];
|
|
|
|
ensureUsers = [
|
|
|
|
{ name = "gitea"; ensurePermissions."DATABASE gitea" = "ALL PRIVILEGES"; }
|
|
|
|
];
|
|
|
|
# TODO
|
|
|
|
# initialScript # set password for gitea user
|
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx = {
|
|
|
|
enable = true; # Enable Nginx
|
|
|
|
recommendedGzipSettings = true;
|
|
|
|
recommendedOptimisation = true;
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
recommendedTlsSettings = true;
|
|
|
|
virtualHosts."git.sealight.xyz" = {
|
|
|
|
# Gitea hostname
|
|
|
|
enableACME = true; # Use ACME certs
|
|
|
|
forceSSL = true; # Force SSL
|
|
|
|
locations."/".proxyPass = "http://localhost:3001/"; # Proxy Gitea
|
|
|
|
};
|
|
|
|
};
|
2022-12-11 23:16:08 -08:00
|
|
|
networking.firewall.allowedTCPPorts = [ 80 443 22 ];
|
2022-09-18 15:13:50 -07:00
|
|
|
security.acme.defaults.email = "anish+acme@lakhwara.com";
|
|
|
|
security.acme.acceptTerms = true;
|
|
|
|
}
|