2023-07-24 09:50:57 +02:00
|
|
|
{ config, lib, pkgs, dgn-lib, ... }:
|
|
|
|
|
|
|
|
let
|
2023-09-14 19:27:01 +02:00
|
|
|
inherit (dgn-lib) setDefault;
|
2023-07-24 09:50:57 +02:00
|
|
|
|
|
|
|
port = 3000;
|
|
|
|
host = "git.dgnum.eu";
|
|
|
|
|
2023-09-14 19:27:01 +02:00
|
|
|
in {
|
2023-07-24 09:50:57 +02:00
|
|
|
services.gitea = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
user = "git";
|
|
|
|
package = pkgs.forgejo;
|
|
|
|
stateDir = "/var/lib/git";
|
|
|
|
|
|
|
|
appName = "forgejo: DGNum's git instance";
|
|
|
|
|
|
|
|
database = {
|
|
|
|
type = "postgres";
|
|
|
|
user = "git";
|
2023-09-13 10:00:50 +02:00
|
|
|
passwordFile = config.age.secrets."forgejo-database_password_file".path;
|
2023-07-24 09:50:57 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
settings = {
|
|
|
|
server = {
|
|
|
|
ROOT_URL = "https://${host}/";
|
|
|
|
DOMAIN = host;
|
|
|
|
HTTP_ADDRESS = "127.0.0.1";
|
|
|
|
HTTP_PORT = port;
|
|
|
|
APP_DATA_PATH = "/var/lib/git/data";
|
|
|
|
};
|
|
|
|
|
|
|
|
service = {
|
2023-09-18 10:48:54 +02:00
|
|
|
EMAIL_DOMAIN_ALLOWLIST = "dgnum.eu";
|
2023-07-24 09:50:57 +02:00
|
|
|
|
|
|
|
DISABLE_REGISTRATION = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
log.LEVEL = "Warn";
|
|
|
|
|
|
|
|
ui.THEMES = "forgejo-auto,forgejo-light,forgejo-dark";
|
|
|
|
|
|
|
|
actions = {
|
|
|
|
ENABLED = true;
|
|
|
|
DEFAULT_ACTIONS_URL = "https://gitea.com";
|
|
|
|
};
|
|
|
|
|
|
|
|
mailer = {
|
|
|
|
ENABLED = false;
|
|
|
|
FROM = "git@infra.dgnum.eu";
|
|
|
|
MAILER_TYPE = "smtp";
|
|
|
|
SMTP_ADDR = "kurisu.lahfa.xyz";
|
|
|
|
SMTP_PORT = 465;
|
|
|
|
IS_TLS_ENABLED = true;
|
|
|
|
USER = "web-services@infra.dgnum.eu";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# Dump configuration
|
|
|
|
# dump = {
|
|
|
|
# enable = false;
|
|
|
|
# type = "tar.xz";
|
|
|
|
# file = "gitea.bk";
|
|
|
|
# };
|
|
|
|
|
|
|
|
# mailerPasswordFile = config.age.secrets."_ht-mail.pwd".path;
|
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
virtualHosts.${host} = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
2023-09-14 19:27:01 +02:00
|
|
|
locations."/" = { proxyPass = "http://127.0.0.1:${toString port}"; };
|
2023-07-24 09:50:57 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
users.users.git = {
|
|
|
|
description = "Git Service";
|
|
|
|
home = "/var/lib/git";
|
|
|
|
useDefaultShell = true;
|
|
|
|
group = "git";
|
|
|
|
isSystemUser = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
users.groups.git = { };
|
|
|
|
|
|
|
|
dgn-secrets.options = [
|
2023-09-14 19:27:01 +02:00
|
|
|
(setDefault { owner = "git"; }
|
2023-09-18 10:48:54 +02:00
|
|
|
(builtins.filter (lib.hasPrefix "forgejo-") config.dgn-secrets.names))
|
2023-07-24 09:50:57 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
|
|
|
}
|