nix-infra/configs/services/forgejo.nix

44 lines
993 B
Nix

{ lib, pkgs, config, ... }:
let
dbname = "forgejo";
ssh_port = 2224;
domain = "new.git.cdaut.de";
in
{
# enable and configure forgejo
services.forgejo = {
enable = true;
database = {
type = "postgres";
name = dbname;
};
settings = {
server = {
ROOT_URL = "https://${domain}";
DOMAIN = domain;
SSH_PORT = ssh_port;
# important because otherwise ssh doesn't seem to work…
START_SSH_SERVER = true;
BUILTIN_SSH_SERVER_USER = "git";
};
cache = {
ADAPTER = "twoqueue";
HOST = "{\"size\":100, \"recent_ratio\":0.25, \"ghost_ratio\":0.5}";
};
service.DISABLE_REGISTRATION = true;
repository.USE_COMPAT_SSH_URI = true;
security.LOGIN_REMEMBER_DAYS = 365;
};
};
# enable a PostgreSQL DB for forgejo
services.postgresql = {
enable = true;
ensureDatabases = [ dbname ];
};
networking.firewall.allowedTCPPorts = [ 3000 ssh_port ];
}