2023-09-27 21:24:23 +00:00
|
|
|
{ config, lib, pkgs, evalConfig, ... }:
|
2022-07-09 17:36:24 +00:00
|
|
|
|
|
|
|
{
|
2024-02-25 22:24:07 +00:00
|
|
|
containers.forgejo = {
|
2022-07-09 17:36:24 +00:00
|
|
|
privateNetwork = true;
|
|
|
|
hostAddress = "192.168.100.1";
|
|
|
|
localAddress = "192.168.100.10";
|
|
|
|
autoStart = true;
|
2024-02-22 20:15:41 +00:00
|
|
|
ephemeral = true;
|
2022-07-09 17:36:24 +00:00
|
|
|
bindMounts = {
|
|
|
|
"/persist" = {
|
2024-02-25 22:24:07 +00:00
|
|
|
hostPath = "/persist/containers/forgejo";
|
2022-07-09 17:36:24 +00:00
|
|
|
isReadOnly = false;
|
|
|
|
};
|
|
|
|
};
|
2023-09-27 21:24:23 +00:00
|
|
|
path = evalConfig ({ config, lib, pkgs, ... }: {
|
2022-11-13 19:18:26 +00:00
|
|
|
system.stateVersion = "21.11";
|
2022-07-09 17:36:24 +00:00
|
|
|
|
2024-01-28 15:07:18 +00:00
|
|
|
environment.systemPackages = [ pkgs.forgejo ];
|
2022-07-20 16:30:47 +00:00
|
|
|
|
2024-01-31 22:30:06 +00:00
|
|
|
hacc.bindMounts."/var/lib/forgejo" = "/persist/forgejo";
|
2022-08-01 16:39:46 +00:00
|
|
|
|
2024-01-28 15:07:18 +00:00
|
|
|
services.forgejo = {
|
2022-07-09 17:36:24 +00:00
|
|
|
enable = true;
|
|
|
|
lfs.enable = true;
|
|
|
|
database.type = "postgres";
|
2022-07-09 17:39:40 +00:00
|
|
|
settings = {
|
|
|
|
repository = {
|
|
|
|
DEFAULT_PRIVATE = "public";
|
|
|
|
PREFERRED_LICENSES = "Unlicense";
|
|
|
|
DEFAULT_BRANCH = "main";
|
|
|
|
};
|
2022-07-20 16:30:47 +00:00
|
|
|
oauth2_client = {
|
|
|
|
ACCOUNT_LINKING = "auto";
|
|
|
|
ENABLE_AUTO_REGISTRATION = true;
|
|
|
|
};
|
2022-07-09 17:39:40 +00:00
|
|
|
"repository.pull-requests" = {
|
|
|
|
DEFAULT_MERGE_STYLE = "merge";
|
|
|
|
DEFAULT_MERGE_MESSAGE_ALL_AUTHORS = true;
|
|
|
|
};
|
|
|
|
"repository.upload".FILE_MAX_SIZE = 1024;
|
|
|
|
server = {
|
|
|
|
LANDING_PAGE = "explore";
|
2022-07-22 16:50:00 +00:00
|
|
|
OFFLINE_MODE = true;
|
2023-06-06 00:04:11 +00:00
|
|
|
ROOT_URL = "https://git.infra4future.de";
|
|
|
|
HTTP_PORT = 3000;
|
|
|
|
HTTP_ADDR = "0.0.0.0";
|
2022-07-09 17:39:40 +00:00
|
|
|
};
|
|
|
|
security = { INSTALL_LOCK = true; };
|
|
|
|
other = {
|
|
|
|
SHOW_FOOTER_VERSION = false;
|
|
|
|
SHOW_FOOTER_TEMPLATE_LOAD_TIME = false;
|
|
|
|
};
|
|
|
|
cron = {
|
|
|
|
ENABLED = true;
|
|
|
|
NOTICE_ON_SUCCESS = true;
|
|
|
|
};
|
|
|
|
"cron.update_mirrors" = {
|
|
|
|
SCHEDULE = "@every 12h";
|
|
|
|
PULL_LIMIT = "-1";
|
|
|
|
PUSH_LIMIT = "-1";
|
|
|
|
};
|
|
|
|
"cron.git_gc_repos".ENABLED = true;
|
|
|
|
"cron.delete_old_actions".ENABLED = true;
|
2022-11-23 23:03:50 +00:00
|
|
|
log.LEVEL = "Info";
|
|
|
|
service.DISABLE_REGISTRATION = true;
|
|
|
|
session.COOKIE_SECURE = true;
|
2024-01-28 15:07:18 +00:00
|
|
|
default.APP_NAME = "0x0: git for all creatures";
|
2022-07-09 17:36:24 +00:00
|
|
|
};
|
|
|
|
};
|
2023-12-08 18:51:48 +00:00
|
|
|
services.postgresql.package = pkgs.postgresql_15;
|
|
|
|
|
2022-07-09 17:36:24 +00:00
|
|
|
services.postgresqlBackup = {
|
|
|
|
enable = true;
|
2024-01-28 15:07:18 +00:00
|
|
|
databases = [ "forgejo" ];
|
2022-07-09 17:36:24 +00:00
|
|
|
startAt = "*-*-* 23:45:00";
|
|
|
|
location = "/persist/backups/postgres";
|
|
|
|
};
|
2022-08-01 18:54:17 +00:00
|
|
|
services.openssh = {
|
|
|
|
enable = true;
|
|
|
|
listenAddresses = [ {
|
|
|
|
addr = "192.168.100.10";
|
|
|
|
port = 22;
|
|
|
|
} ];
|
2023-06-06 00:04:11 +00:00
|
|
|
settings = {
|
|
|
|
PasswordAuthentication = false;
|
|
|
|
AcceptEnv = "GIT_PROTOCOL";
|
|
|
|
};
|
2022-08-01 18:54:17 +00:00
|
|
|
};
|
2023-02-18 13:45:14 +00:00
|
|
|
});
|
2022-07-09 17:36:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx.virtualHosts."git.infra4future.de" = {
|
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
locations."/" = {
|
2024-02-25 22:24:07 +00:00
|
|
|
proxyPass = "http://${config.containers.forgejo.localAddress}:3000";
|
2022-07-09 17:36:24 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|