nixos-config/modules/gitea/default.nix

106 lines
2.3 KiB
Nix
Raw Normal View History

{ pkgs
, config
, lib
, ...
}:
with lib; let
2022-04-22 00:16:49 +02:00
cfg = config.eboskma.gitea;
giteaCfg = config.services.gitea;
2022-04-22 00:16:49 +02:00
in
{
options.eboskma.gitea = { enable = mkEnableOption "gitea"; };
2022-05-03 18:17:38 +02:00
config = mkIf cfg.enable {
2022-04-22 00:16:49 +02:00
services.gitea = {
enable = true;
user = "git";
appName = "Gitea Datarift";
lfs = {
enable = true;
};
database = {
type = "postgres";
socket = "/run/postgresql";
passwordFile = "/run/secrets/gitea_db_password";
createDatabase = false;
user = "git";
};
settings = {
security = {
PASSWORD_HASH_ALGO = "argon2";
DISABLE_GIT_HOOKS = false;
};
2022-10-25 09:40:08 +02:00
log.LEVEL = "Warn";
2022-10-30 21:06:18 +01:00
database = {
LOG_SQL = false;
};
repository = {
ENABLE_PUSH_CREATE_USER = true;
ENABLE_PUSH_CREATE_ORG = true;
};
2023-05-30 15:36:25 +02:00
server = {
DOMAIN = "git.datarift.nl";
ROOT_URL = "https://git.datarift.nl/";
};
service = {
DEFAULT_KEEP_EMAIL_PRIVATE = true;
2022-10-26 17:12:39 +02:00
DISABLE_REGISTRATION = true;
};
picture = {
ENABLE_FEDERATED_AVATAR = true;
};
session = {
PROVIDER = "db";
SAME_SITE = "strict";
2022-10-26 17:12:39 +02:00
COOKIE_SECURE = true;
};
webhook = {
ALLOWED_HOST_LIST = "external,10.0.0.202/32,drone.datarift.nl";
};
2023-04-21 11:10:41 +02:00
# Experimental Gitea Actions
actions = {
ENABLED = true;
};
};
};
networking.firewall.allowedTCPPorts = [ 3000 ];
users.users.git = {
description = "Gitea service user";
home = giteaCfg.stateDir;
useDefaultShell = true;
group = "gitea";
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 = [ "gitea" ];
ensureUsers = [
{
name = "git";
ensurePermissions = {
"DATABASE gitea" = "ALL PRIVILEGES";
};
}
];
2022-04-22 00:16:49 +02:00
};
};
}