2022-05-09 04:45:04 -07:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
|
|
|
services.gitea = {
|
|
|
|
enable = true;
|
|
|
|
appName = "Sealight Git Forge";
|
|
|
|
domain = "git.sealight.xyz";
|
|
|
|
rootUrl = "https://git.sealight.xyz";
|
|
|
|
httpPort = 3001;
|
|
|
|
database = {
|
|
|
|
type = "postgres";
|
|
|
|
# passwordFile = "/run/secrets/gitea-dbpass"; # supplied by agenix
|
|
|
|
password = "somethingunknowablesorry";
|
|
|
|
};
|
|
|
|
settings = {
|
|
|
|
metrics = {
|
|
|
|
ENABLED = true;
|
|
|
|
};
|
|
|
|
repository = {
|
2022-07-01 07:21:51 -07:00
|
|
|
DEFAULT_BRANCH = "main";
|
2022-05-09 04:45:04 -07:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
services.postgresql = {
|
2022-07-01 07:21:51 -07:00
|
|
|
enable = true; # Ensure postgresql is enabled
|
2022-05-09 04:45:04 -07:00
|
|
|
authentication = ''
|
|
|
|
local gitea all ident map=gitea-users
|
|
|
|
'';
|
2022-07-01 07:21:51 -07:00
|
|
|
identMap = # Map the gitea user to postgresql
|
2022-05-09 04:45:04 -07:00
|
|
|
''
|
|
|
|
gitea-users gitea gitea
|
|
|
|
'';
|
2022-07-18 23:52:41 -07:00
|
|
|
ensureDatabases = [ "gitea" ];
|
|
|
|
ensureUsers = [
|
|
|
|
{ name = "gitea"; ensurePermissions."DATABASE gitea" = "ALLPRIVLEGES"; }
|
|
|
|
];
|
2022-05-09 04:45:04 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx = {
|
2022-07-01 07:21:51 -07:00
|
|
|
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-05-09 04:45:04 -07:00
|
|
|
}
|