2024-04-13 13:44:06 +02:00
|
|
|
{ config, nixpkgs, ... }:
|
2023-07-24 09:50:57 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
port = 3000;
|
|
|
|
host = "git.dgnum.eu";
|
2024-02-02 10:51:31 +01:00
|
|
|
in
|
|
|
|
{
|
2023-11-29 20:31:16 +01:00
|
|
|
services = {
|
|
|
|
forgejo = {
|
|
|
|
enable = true;
|
2023-07-24 09:50:57 +02:00
|
|
|
|
|
|
|
user = "git";
|
2024-04-13 13:44:06 +02:00
|
|
|
package = nixpkgs.unstable.forgejo;
|
2023-11-29 20:31:16 +01:00
|
|
|
stateDir = "/var/lib/git";
|
2023-09-24 13:27:37 +02:00
|
|
|
|
2023-11-29 20:31:16 +01:00
|
|
|
database = {
|
|
|
|
type = "postgres";
|
|
|
|
user = "git";
|
|
|
|
name = "git";
|
2023-07-24 09:50:57 +02:00
|
|
|
};
|
|
|
|
|
2023-11-29 20:31:16 +01:00
|
|
|
settings = {
|
2024-02-02 10:51:31 +01:00
|
|
|
DEFAULT = {
|
|
|
|
APP_NAME = "Forge git de la DGNum";
|
|
|
|
};
|
2023-11-29 20:31:16 +01:00
|
|
|
|
2024-04-16 09:32:32 +02:00
|
|
|
actions = {
|
|
|
|
ENABLED = true;
|
|
|
|
DEFAULT_ACTIONS_URL = "https://gitea.com";
|
|
|
|
};
|
|
|
|
|
|
|
|
admin = {
|
|
|
|
DEFAULT_EMAIL_NOTIFICATIONS = "enabled";
|
|
|
|
};
|
|
|
|
|
|
|
|
log.LEVEL = "Warn";
|
|
|
|
|
|
|
|
mailer = {
|
|
|
|
ENABLED = true;
|
|
|
|
FROM = "git@infra.dgnum.eu";
|
|
|
|
PROTOCOL = "smtps";
|
|
|
|
SMTP_ADDR = "kurisu.lahfa.xyz";
|
|
|
|
SMTP_PORT = 465;
|
|
|
|
USER = "web-services@infra.dgnum.eu";
|
|
|
|
};
|
|
|
|
|
2023-11-29 20:31:16 +01:00
|
|
|
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-12-04 12:43:57 +01:00
|
|
|
EMAIL_DOMAIN_ALLOWLIST = "dgnum.eu,*";
|
2024-04-16 09:32:32 +02:00
|
|
|
ENABLE_NOTIFY_MAIL = true;
|
2023-11-29 20:31:16 +01:00
|
|
|
|
|
|
|
DISABLE_REGISTRATION = false;
|
2024-02-07 10:19:13 +01:00
|
|
|
REGISTER_EMAIL_CONFIRM = true;
|
2023-11-29 20:31:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
ui.THEMES = "forgejo-auto,forgejo-light,forgejo-dark";
|
2024-06-05 12:50:05 +02:00
|
|
|
|
|
|
|
"cron.cleanup_actions".ENABLED = true;
|
|
|
|
"cron.delete_old_actions".ENABLED = true;
|
|
|
|
"cron.git_gc_repos".ENABLED = true;
|
|
|
|
"cron.update_checker".ENABLED = false;
|
2023-07-24 09:50:57 +02:00
|
|
|
};
|
2024-02-07 10:19:13 +01:00
|
|
|
|
|
|
|
mailerPasswordFile = config.age.secrets."forgejo-mailer_password_file".path;
|
2023-07-24 09:50:57 +02:00
|
|
|
};
|
|
|
|
|
2023-11-29 20:31:16 +01:00
|
|
|
nginx = {
|
|
|
|
enable = true;
|
2023-07-24 09:50:57 +02:00
|
|
|
|
2023-11-29 20:31:16 +01:00
|
|
|
virtualHosts.${host} = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
2024-02-02 10:51:31 +01:00
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://127.0.0.1:${toString port}";
|
|
|
|
};
|
2023-11-29 20:31:16 +01:00
|
|
|
};
|
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 = { };
|
|
|
|
|
2024-02-02 10:51:31 +01:00
|
|
|
age-secrets.matches."^forgejo-.*$" = {
|
|
|
|
owner = "git";
|
|
|
|
};
|
2024-02-21 22:42:57 +01:00
|
|
|
|
|
|
|
dgn-backups.jobs.forgejo.settings.paths = builtins.map (dir: "/var/lib/git/${dir}") [
|
|
|
|
"custom"
|
|
|
|
"data"
|
|
|
|
"repositories"
|
|
|
|
".ssh"
|
|
|
|
];
|
|
|
|
dgn-backups.postgresDatabases = [ "git" ];
|
2023-07-24 09:50:57 +02:00
|
|
|
}
|