2024-02-05 11:46:52 +01:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2024-01-22 20:27:45 +01:00
|
|
|
}:
|
2024-02-05 11:46:52 +01:00
|
|
|
with lib;
|
|
|
|
let
|
2024-01-22 20:27:45 +01:00
|
|
|
forgejoCfg = config.services.forgejo;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
services.forgejo = {
|
|
|
|
enable = true;
|
|
|
|
user = "git";
|
|
|
|
lfs = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
database = {
|
|
|
|
type = "postgres";
|
|
|
|
socket = "/run/postgresql";
|
|
|
|
passwordFile = config.sops.secrets.gitea_db_password.path;
|
|
|
|
createDatabase = false;
|
|
|
|
name = "git";
|
|
|
|
user = "git";
|
|
|
|
};
|
|
|
|
|
|
|
|
dump = {
|
|
|
|
enable = true;
|
2024-02-22 11:33:52 +01:00
|
|
|
interval = "*-*-* 2,14:00:00";
|
2024-01-22 20:27:45 +01:00
|
|
|
type = "tar.zst";
|
|
|
|
};
|
|
|
|
|
|
|
|
settings = {
|
|
|
|
DEFAULT = {
|
|
|
|
APP_NAME = "Datarift Git";
|
|
|
|
};
|
|
|
|
|
|
|
|
security = {
|
|
|
|
PASSWORD_HASH_ALGO = "argon2";
|
|
|
|
DISABLE_GIT_HOOKS = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
log.LEVEL = "Warn";
|
|
|
|
|
|
|
|
database = {
|
|
|
|
LOG_SQL = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
repository = {
|
|
|
|
ENABLE_PUSH_CREATE_USER = true;
|
|
|
|
ENABLE_PUSH_CREATE_ORG = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
server = {
|
|
|
|
DOMAIN = "git.datarift.nl";
|
|
|
|
ROOT_URL = "https://git.datarift.nl/";
|
|
|
|
};
|
|
|
|
|
|
|
|
service = {
|
|
|
|
DEFAULT_KEEP_EMAIL_PRIVATE = true;
|
|
|
|
DISABLE_REGISTRATION = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
picture = {
|
|
|
|
ENABLE_FEDERATED_AVATAR = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
session = {
|
|
|
|
PROVIDER = "db";
|
|
|
|
SAME_SITE = "strict";
|
|
|
|
COOKIE_SECURE = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
webhook = {
|
|
|
|
ALLOWED_HOST_LIST = "external,10.0.0.202/32,ci.datarift.nl,10.0.0.210/32";
|
|
|
|
};
|
|
|
|
|
2024-01-29 10:28:13 +01:00
|
|
|
cron = {
|
|
|
|
ENABLED = true;
|
|
|
|
RUN_AT_START = true;
|
|
|
|
};
|
|
|
|
|
2024-01-22 20:27:45 +01:00
|
|
|
actions = {
|
|
|
|
ENABLED = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
networking.firewall.allowedTCPPorts = [ 3000 ];
|
|
|
|
|
|
|
|
users.users.git = {
|
|
|
|
description = "Forgejo service user";
|
|
|
|
home = forgejoCfg.stateDir;
|
|
|
|
useDefaultShell = true;
|
|
|
|
group = "forgejo";
|
|
|
|
isSystemUser = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
services.postgresql = {
|
|
|
|
enable = true;
|
|
|
|
# Explicitly specify version here, because upgrading is a manual process that involves dumping and restoring databases:
|
|
|
|
# https://nixos.org/manual/nixos/unstable/index.html#module-services-postgres-upgrading
|
|
|
|
package = pkgs.postgresql_14;
|
|
|
|
|
|
|
|
ensureDatabases = [ "git" ];
|
|
|
|
ensureUsers = [
|
|
|
|
{
|
|
|
|
name = "git";
|
|
|
|
ensureDBOwnership = true;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|