infra/config/services/gitea.nix

92 lines
2.1 KiB
Nix
Raw Normal View History

2023-07-03 06:45:22 +02:00
{
config,
lib,
pkgs,
...
2024-03-03 00:24:08 +01:00
}: {
2023-07-03 03:33:11 +02:00
services.gitea = {
enable = true;
2023-08-01 18:41:40 +02:00
package = pkgs.unstable.gitea;
2023-07-05 21:41:15 +02:00
2023-07-03 03:33:11 +02:00
database = {
type = "postgres";
passwordFile = config.age.secrets."services/gitea/password-database".path;
};
lfs.enable = true;
2024-03-03 00:24:08 +01:00
appName = "winston's gitea";
2023-07-03 03:33:11 +02:00
settings = {
2023-07-03 21:25:18 +02:00
actions.ENABLED = true;
indexer = with config.services.elasticsearch; let
indexer = "elasticsearch";
2023-07-05 01:30:41 +02:00
conn = "http://${listenAddress}:${toString port}";
2023-07-03 21:25:18 +02:00
in {
ISSUE_INDEXER_CONN_STR = conn;
ISSUE_INDEXER_TYPE = indexer;
REPO_INDEXER_CONN_STR = conn;
REPO_INDEXER_ENABLED = true;
REPO_INDEXER_TYPE = indexer;
};
2023-07-03 06:45:22 +02:00
repository = {
ENABLE_PUSH_CREATE_USER = true;
};
2023-07-03 03:33:11 +02:00
server = rec {
DOMAIN = "git.winston.sh";
HTTP_ADDR = "127.0.0.1";
HTTP_PORT = 12492;
ROOT_URL = "https://${DOMAIN}/";
};
2023-07-03 06:45:22 +02:00
2023-07-03 03:33:11 +02:00
service.DISABLE_REGISTRATION = true;
2023-07-03 06:45:22 +02:00
session = {
COOKIE_SECURE = true;
SAME_SITE = "strict";
};
2024-03-03 00:24:08 +01:00
"ui.meta" = {
AUTHOR = "nekowinston";
DESCRIPTION = "winston's gitea instance";
};
other = {
SHOW_FOOTER_VERSION = false;
SHOW_FOOTER_TEMPLATE_LOAD_TIME = false;
SHOW_FOOTER_BRANDING = false;
2023-07-03 06:45:22 +02:00
};
2023-07-03 03:33:11 +02:00
};
};
2024-03-03 00:24:08 +01:00
systemd.services.gitea.preStart = let
inherit (config.services.gitea) stateDir;
in
lib.mkAfter ''
chmod u+w -R ${stateDir}/custom/**/*
# apply customizations
cp -Rf ${./gitea}/* ${stateDir}/custom
chmod u-w -R ${stateDir}/custom/**/*
'';
2023-07-03 06:45:22 +02:00
2024-03-03 00:24:08 +01:00
networking.firewall.allowedTCPPorts = [22];
2023-07-03 06:45:22 +02:00
2023-07-03 03:33:11 +02:00
age.secrets."services/gitea/password-database".owner = "gitea";
2023-07-03 21:25:18 +02:00
services.elasticsearch.enable = true;
2023-07-03 03:33:11 +02:00
services.nginx.virtualHosts.${config.services.gitea.settings.server.DOMAIN} = {
forceSSL = true;
enableACME = false;
useACMEHost = "winston.sh";
locations."/" = with config.services.gitea.settings.server; {
extraConfig = "client_max_body_size 512M;";
2023-07-05 01:30:41 +02:00
proxyPass = "http://${HTTP_ADDR}:${toString HTTP_PORT}";
2023-07-03 03:33:11 +02:00
};
};
}