infrastructure/machines/storage01/forgejo.nix
Julien Malka f819acf9bc
All checks were successful
Check meta / check_meta (pull_request) Successful in 18s
Check meta / check_dns (pull_request) Successful in 19s
build configuration / build_and_cache_geo01 (pull_request) Successful in 1m7s
build configuration / build_and_cache_geo02 (pull_request) Successful in 1m7s
build configuration / build_and_cache_storage01 (pull_request) Successful in 1m25s
build configuration / build_and_cache_compute01 (pull_request) Successful in 1m39s
build configuration / build_and_cache_rescue01 (pull_request) Successful in 1m25s
lint / check (pull_request) Successful in 22s
build configuration / build_and_cache_krz01 (pull_request) Successful in 2m11s
build configuration / build_and_cache_web02 (pull_request) Successful in 1m11s
build configuration / build_and_cache_bridge01 (pull_request) Successful in 1m3s
build configuration / build_and_cache_vault01 (pull_request) Successful in 1m25s
build configuration / build_and_cache_web01 (pull_request) Successful in 1m42s
build configuration / build_and_cache_geo01 (push) Successful in 1m7s
build configuration / build_and_cache_geo02 (push) Successful in 1m15s
build configuration / build_and_cache_storage01 (push) Successful in 1m18s
build configuration / build_and_cache_rescue01 (push) Successful in 1m27s
build configuration / build_and_cache_compute01 (push) Successful in 1m34s
lint / check (push) Successful in 24s
build configuration / build_and_cache_krz01 (push) Successful in 2m0s
build configuration / build_and_cache_vault01 (push) Successful in 1m15s
build configuration / build_and_cache_web02 (push) Successful in 1m14s
build configuration / build_and_cache_bridge01 (push) Successful in 1m5s
build configuration / build_and_cache_web01 (push) Successful in 1m49s
feat(forgejo): 7 days sessions
2024-10-12 19:52:21 +02:00

114 lines
2.4 KiB
Nix

{ config, nixpkgs, ... }:
let
port = 3000;
host = "git.dgnum.eu";
in
{
services = {
forgejo = {
enable = true;
user = "git";
package = nixpkgs.unstable.forgejo;
stateDir = "/var/lib/git";
database = {
type = "postgres";
user = "git";
name = "git";
};
settings = {
DEFAULT = {
APP_NAME = "Forge git de la DGNum";
};
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";
};
session = {
SESSION_LIFE_TIME = 24 * 3600 * 7;
GC_INTERVAL_TIME = 24 * 3600 * 7;
};
server = {
ROOT_URL = "https://${host}/";
DOMAIN = host;
HTTP_ADDRESS = "127.0.0.1";
HTTP_PORT = port;
APP_DATA_PATH = "/var/lib/git/data";
OFFLINE_MODE = false;
};
service = {
EMAIL_DOMAIN_ALLOWLIST = "dgnum.eu,*";
ENABLE_NOTIFY_MAIL = true;
DISABLE_REGISTRATION = false;
REGISTER_EMAIL_CONFIRM = true;
};
ui.THEMES = "forgejo-auto,forgejo-light,forgejo-dark";
"cron.cleanup_actions".ENABLED = true;
"cron.delete_old_actions".ENABLED = true;
"cron.git_gc_repos".ENABLED = true;
"cron.update_checker".ENABLED = false;
};
mailerPasswordFile = config.age.secrets."forgejo-mailer_password_file".path;
};
nginx = {
enable = true;
virtualHosts.${host} = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:${toString port}";
};
};
};
};
users.users.git = {
description = "Git Service";
home = "/var/lib/git";
useDefaultShell = true;
group = "git";
isSystemUser = true;
};
users.groups.git = { };
age-secrets.matches."^forgejo-.*$" = {
owner = "git";
};
dgn-backups.jobs.forgejo.settings.paths = builtins.map (dir: "/var/lib/git/${dir}") [
"custom"
"data"
"repositories"
".ssh"
];
dgn-backups.postgresDatabases = [ "git" ];
}