nixos/services/forgejo.nix

62 lines
1.3 KiB
Nix
Raw Normal View History

2023-09-11 20:23:04 +02:00
{
config,
lib,
...
}:
with lib;
mkIf (elem "forgejo" config.machine.services) {
services = {
forgejo =
let
2023-09-11 20:23:04 +02:00
cfg = config.machine;
2024-05-09 12:41:24 +02:00
inherit ((findFirst (s: s.service == "forgejo") cfg cfg.vHosts)) domain;
in
{
2023-09-11 20:23:04 +02:00
enable = true;
user = "git";
2023-09-11 20:23:04 +02:00
database = {
type = "mysql";
user = "git";
2024-05-09 12:41:24 +02:00
name = "forgejo";
passwordFile = config.sops.secrets."services/forgejo/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;
2024-05-09 12:41:24 +02:00
COOKIE_USERNAME = "forgejo_username";
COOKIE_REMEMBER_NAME = "forgejo_userauth";
2023-09-11 20:23:04 +02:00
};
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
};
};
sops.secrets."services/forgejo/dbPass" = {
owner = "git";
group = "forgejo";
};
users.users.git = {
description = "Forgejo Service";
isNormalUser = true;
home = config.services.forgejo.stateDir;
createHome = false;
useDefaultShell = true;
};
}