2022-12-12 07:07:12 -08:00
|
|
|
{ self, config, lib, pkgs, ... }:
|
2022-09-18 15:13:50 -07:00
|
|
|
|
|
|
|
{
|
2022-12-12 07:07:12 -08:00
|
|
|
age.secrets.gitea-dbpass.file = "${self}/secrets/gitea-dbpass.age";
|
|
|
|
age.secrets.gitea-dbpass.owner = "gitea";
|
|
|
|
|
2024-08-19 21:29:41 -07:00
|
|
|
services.forgejo = {
|
2022-09-18 15:13:50 -07:00
|
|
|
enable = true;
|
|
|
|
database = {
|
|
|
|
type = "postgres";
|
2022-12-12 07:07:12 -08:00
|
|
|
passwordFile = "/run/agenix/gitea-dbpass";
|
2022-09-18 15:13:50 -07:00
|
|
|
};
|
|
|
|
settings = {
|
2024-08-19 21:29:41 -07:00
|
|
|
DEFAULT.APP_NAME = "Sealight Git Forge";
|
2023-08-12 18:57:16 -07:00
|
|
|
server = {
|
|
|
|
DOMAIN = "git.sealight.xyz";
|
|
|
|
ROOT_URL = "https://git.sealight.xyz";
|
|
|
|
HTTP_PORT = 3001;
|
|
|
|
};
|
2022-09-18 15:13:50 -07:00
|
|
|
metrics = {
|
|
|
|
ENABLED = true;
|
|
|
|
};
|
|
|
|
repository = {
|
|
|
|
DEFAULT_BRANCH = "main";
|
|
|
|
};
|
2024-08-19 21:29:41 -07:00
|
|
|
service.DISABLE_REGISTRATION = true;
|
2022-12-12 06:48:52 -08:00
|
|
|
"markup.restructuredtext" = {
|
|
|
|
ENABLED = true;
|
|
|
|
FILE_EXTENSIONS = ".rst";
|
2023-05-30 05:23:05 -07:00
|
|
|
RENDER_COMMAND = "timeout 30s pandoc +RTS -RTS -f rst";
|
2022-12-12 06:48:52 -08:00
|
|
|
IS_INPUT_FILE = false;
|
|
|
|
};
|
|
|
|
mailer = {
|
2023-05-30 05:23:05 -07:00
|
|
|
ENABLED = true;
|
2022-12-12 06:48:52 -08:00
|
|
|
MAILER_TYPE = "smtp";
|
|
|
|
FROM = "ops@sealight.xyz";
|
2023-05-15 07:20:01 -07:00
|
|
|
SMTP_ADDR = "smtp.nullhex.com";
|
|
|
|
SMTP_PORT = "465";
|
|
|
|
USER = "ops@sealight.xyz";
|
|
|
|
PASSWD = "breed deputy fossil glory"; # TODO how do we pass this from agenix?
|
|
|
|
IS_TLS_ENABLED = "true";
|
2022-12-12 06:48:52 -08:00
|
|
|
};
|
2022-09-18 15:13:50 -07:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
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
|
2024-03-15 23:25:49 -07:00
|
|
|
# authentication = ''
|
|
|
|
# local gitea all ident map=gitea-users
|
|
|
|
# '';
|
|
|
|
# identMap = # Map the gitea user to postgresql
|
|
|
|
# ''
|
|
|
|
# gitea-users gitea gitea
|
|
|
|
# gitea-users postgres gitea
|
|
|
|
# '';
|
2023-05-30 05:23:05 -07:00
|
|
|
ensureDatabases = [ "gitea" ];
|
2024-01-05 23:44:08 -08:00
|
|
|
ensureUsers = [{
|
|
|
|
name = "gitea";
|
|
|
|
ensureDBOwnership = true;
|
|
|
|
}];
|
2022-09-18 15:13:50 -07:00
|
|
|
# TODO
|
2024-01-05 23:44:08 -08:00
|
|
|
# initialScript
|
|
|
|
# set password for gitea user
|
2022-09-18 15:13:50 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
}
|