nix/container/Git.nix

75 lines
1.7 KiB
Nix
Raw Normal View History

2024-06-14 02:58:39 +03:00
{ container, pkgs, ... } @args: let
2024-06-09 23:35:53 +03:00
cfg = container.config.git;
in {
systemd.tmpfiles.rules = container.mkContainerDir cfg [
"data"
];
containers.git = container.mkContainer cfg {
bindMounts = {
"/var/lib/gitea" = {
hostPath = "${cfg.storage}/data";
isReadOnly = false;
};
};
2024-06-14 02:58:39 +03:00
config = { ... }: container.mkContainerConfig cfg {
2024-06-09 23:35:53 +03:00
environment.systemPackages = with pkgs; [ gitea ];
services.gitea = {
enable = true;
stateDir = "/var/lib/gitea";
database = let
postgre = container.config.postgres;
in {
type = "postgres";
host = postgre.address;
port = postgre.port;
user = "gitea";
createDatabase = false;
};
settings = let
gcArgs = "--aggressive --no-cruft --prune=now";
gcTimeout = 600;
in {
2024-06-14 06:30:48 +03:00
"service".DISABLE_REGISTRATION = true;
2024-06-09 23:35:53 +03:00
"log".LEVEL = "Error";
"server" = {
DISABLE_SSH = true;
DOMAIN = cfg.domain;
HTTP_ADDR = cfg.address;
2024-06-18 11:26:22 +03:00
ROOT_URL = "https://${cfg.domain}";
2024-06-09 23:35:53 +03:00
};
"ui" = {
AMBIGUOUS_UNICODE_DETECTION = false;
};
"repository" = {
DEFAULT_PRIVATE = "private";
DEFAULT_PUSH_CREATE_PRIVATE = true;
};
"repository.pull-request".DEFAULT_MERGE_STYLE = "rebase";
"repository.issue".MAX_PINNED = 99999;
"cron" = {
ENABLED = true;
RUN_AT_START = true;
};
"cron.update_mirrors".SCHEDULE = "@midnight";
"cron.cleanup_actions".ENABLED = true;
"cron.git_gc_repos" = {
ENABLED = true;
SCHEDULE = "@midnight";
TIMEOUT = gcTimeout;
ARGS = gcArgs;
};
"git" = {
GC_ARGS = gcArgs;
};
"git.timeout".GC = gcTimeout;
};
};
};
};
}