2023-09-11 20:23:04 +02:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
2019-03-20 02:57:59 +01:00
|
|
|
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;
|
2019-12-19 09:36:54 +01:00
|
|
|
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;
|
|
|
|
};
|
2019-12-19 09:36:54 +01:00
|
|
|
|
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-10 15:28:26 +02:00
|
|
|
|
2023-09-11 20:23:04 +02:00
|
|
|
service = {
|
|
|
|
DISABLE_REGISTRATION = lib.mkForce true;
|
|
|
|
};
|
2023-01-29 16:23:53 +01:00
|
|
|
|
2023-09-11 20:23:04 +02:00
|
|
|
session = {
|
|
|
|
cookieSecure = true;
|
|
|
|
};
|
2023-01-29 16:23:53 +01:00
|
|
|
};
|
2020-11-23 23:07:42 +01:00
|
|
|
};
|
2019-12-19 09:36:54 +01:00
|
|
|
};
|
2023-09-11 21:36:54 +02:00
|
|
|
sops.secrets."services/gitea/dbPass" = {
|
|
|
|
owner = "git";
|
|
|
|
group = "gitea";
|
|
|
|
};
|
2023-09-11 20:23:04 +02:00
|
|
|
users.users.git = {
|
|
|
|
description = "Gitea Service";
|
|
|
|
isNormalUser = true;
|
|
|
|
home = config.services.gitea.stateDir;
|
|
|
|
createHome = true;
|
|
|
|
useDefaultShell = true;
|
|
|
|
};
|
|
|
|
}
|