nixos/services/gitea.nix

57 lines
1.3 KiB
Nix
Raw Normal View History

2023-09-11 20:23:04 +02:00
{
config,
lib,
...
}:
with lib;
2023-09-11 20:23:04 +02:00
mkIf (elem "gitea" config.machine.services) {
services = {
gitea = let
cfg = config.machine;
2023-09-11 21:20:14 +02:00
inherit ((findFirst (s: s.service == "gitea") cfg cfg.vHosts)) domain;
2023-09-11 20:23:04 +02:00
in {
enable = true;
user = "git";
2023-09-11 20:23:04 +02:00
database = {
type = "mysql";
user = "git";
name = "gitea";
passwordFile = config.sops.secrets."services/gitea/dbPass".path;
2020-11-23 23:07:42 +01:00
};
2023-09-11 20:23:04 +02:00
settings = {
repository = {
DISABLE_HTTP_GIT = false;
USE_COMPAT_SSH_URI = true;
};
2023-09-11 20:23:04 +02:00
security = {
INSTALL_LOCK = true;
COOKIE_USERNAME = "gitea_username";
COOKIE_REMEMBER_NAME = "gitea_userauth";
};
2019-02-26 13:44:40 +01:00
2023-09-11 20:23:04 +02:00
server = {
DOMAIN = domain;
ROOT_URL = "https://${domain}/";
};
2023-09-11 20:23:04 +02:00
service = {
DISABLE_REGISTRATION = lib.mkForce true;
};
2023-09-11 20:23:04 +02:00
session = {
cookieSecure = true;
};
};
2020-11-23 23:07:42 +01:00
};
};
2023-09-11 20:23:04 +02:00
sops.secrets."services/gitea/dbPass" = {};
users.users.git = {
description = "Gitea Service";
isNormalUser = true;
home = config.services.gitea.stateDir;
createHome = true;
useDefaultShell = true;
};
}