nix-config/hosts/gitea/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

170 lines
4.5 KiB
Nix
Raw Normal View History

{ config, pkgs, lib, libC, libS, ... }:
2021-10-02 20:28:30 +02:00
{
c3d2.deployment.server = "server10";
2022-06-20 22:10:23 +02:00
2022-06-21 01:13:53 +02:00
microvm.mem = 4 * 1024;
2022-06-20 22:10:23 +02:00
environment.systemPackages = with pkgs; [
# used to restore database dumps
config.services.postgresql.package unzip
];
2023-03-18 01:35:27 +01:00
2022-06-20 20:27:14 +02:00
networking = {
hostName = "gitea";
firewall.allowedTCPPorts = [ 2222 ];
2022-06-20 20:27:14 +02:00
};
services = {
2023-05-18 01:55:16 +02:00
backup = {
paths = [ "/var/lib/gitea/" ];
exclude = [
"/var/lib/gitea/data/indexers/"
"/var/lib/gitea/data/repo-archive"
"/var/lib/gitea/data/queues"
"/var/lib/gitea/data/tmp/"
];
};
2023-04-27 21:50:37 +02:00
gitea = {
2022-06-20 20:27:14 +02:00
enable = true;
appName = "Gitea: with a cup of Kolle Mate";
2023-01-06 21:08:58 +01:00
database.type = "postgres";
2022-06-20 20:27:14 +02:00
lfs.enable = true;
2023-03-18 01:35:27 +01:00
repositoryRoot = "/var/lib/gitea/repositories";
2022-06-20 20:27:14 +02:00
dump = {
2023-01-06 21:08:58 +01:00
# Is a nice feature once we have a dedicated backup storage.
# For now it is disabled, since it delays `nixos-rebuild switch`.
2022-06-20 20:27:14 +02:00
enable = false;
2023-03-18 01:35:27 +01:00
backupDir = "/var/backup/gitea/";
};
ldap = {
enable = true;
adminGroup = "gitea-admins";
bindPasswordFile = config.sops.secrets."gitea/ldapSearchUserPassword".path;
2022-06-20 20:27:14 +02:00
};
settings = {
# we use drone for internal tasks and don't want people to execute code on our infrastructure
actions.ENABLED = false;
2023-01-06 21:08:58 +01:00
"cron.delete_generated_repository_avatars".ENABLED = true;
"cron.delete_old_system_notices".ENABLED = true;
"cron.git_gc_repos".ENABLED = true;
2023-01-06 21:08:58 +01:00
"cron.repo_health_check".TIMEOUT = "300s";
2022-06-20 20:27:14 +02:00
"cron.resync_all_sshkeys" = {
ENABLED = true;
RUN_AT_START = true;
};
2023-01-06 21:08:58 +01:00
database.LOG_SQL = false;
# enable if it is actually useful
# federation.ENABLED = true;
2023-01-06 21:08:58 +01:00
indexer.REPO_INDEXER_ENABLED = true;
2022-06-20 20:27:14 +02:00
log = {
LEVEL = "Info";
DISABLE_ROUTER_LOG = true;
};
mailer = {
ENABLED = true;
FROM = "gitea@c3d2.de";
2023-02-22 20:01:43 +01:00
PROTOCOL = "sendmail";
2022-06-24 00:12:08 +02:00
SENDMAIL_PATH = "/run/wrappers/bin/sendmail";
SENDMAIL_ARGS = "--";
2022-06-20 20:27:14 +02:00
};
2023-01-06 21:08:58 +01:00
other.SHOW_FOOTER_VERSION = false;
# disabled to prevent us becoming critical infrastructure, might revisit later
packages.ENABLED = false;
2022-06-20 20:27:14 +02:00
picture = {
# this also disables libravatar
DISABLE_GRAVATAR = false;
ENABLE_FEDERATED_AVATAR = true;
GRAVATAR_SOURCE = "libravatar";
REPOSITORY_AVATAR_FALLBACK = "random";
};
repository.DEFAULT_REPO_UNITS = "repo.code,repo.releases,repo.issues,repo.pulls";
2023-04-28 00:07:24 +02:00
server = rec {
DOMAIN = "gitea.c3d2.de";
2022-06-20 20:27:14 +02:00
ENABLE_GZIP = true;
SSH_AUTHORIZED_KEYS_BACKUP = false;
2023-04-28 00:07:24 +02:00
SSH_DOMAIN = DOMAIN;
2022-06-20 20:27:14 +02:00
};
service = {
2022-10-31 22:14:10 +01:00
DISABLE_REGISTRATION = true;
2022-06-20 20:27:14 +02:00
NO_REPLY_ADDRESS = "no_reply@c3d2.de";
REGISTER_EMAIL_CONFIRM = true;
ENABLE_NOTIFY_MAIL = true;
};
session = {
COOKIE_SECURE = lib.mkForce true;
PROVIDER = "db";
SAME_SITE = "strict";
};
"ssh.minimum_key_sizes" = {
ECDSA = -1;
2022-07-23 22:26:08 +02:00
RSA = 4095;
2022-06-20 20:27:14 +02:00
};
2023-01-06 21:08:58 +01:00
time.DEFAULT_UI_LOCATION = config.time.timeZone;
2022-06-20 20:27:14 +02:00
ui = {
DEFAULT_THEME = "arc-green";
2022-07-27 21:00:29 +02:00
EXPLORE_PAGING_NUM = 25;
FEED_PAGING_NUM = 50;
ISSUE_PAGING_NUM = 25;
2022-06-20 20:27:14 +02:00
};
};
};
nginx = {
enable = true;
virtualHosts."gitea.c3d2.de" = {
forceSSL = true;
enableACME = true;
listen = libC.defaultListen;
2022-06-20 20:27:14 +02:00
locations."/".proxyPass = "http://localhost:3000";
};
};
openssh = {
enable = true;
extraConfig = ''
Match User gitea
AllowAgentForwarding no
AllowTcpForwarding no
PermitTTY no
X11Forwarding no
'';
};
portunus.addToHosts = true;
2023-01-07 00:54:40 +01:00
postgresql = {
package = pkgs.postgresql_15;
upgrade.stopServices = [ "gitea" ];
};
2022-06-20 20:27:14 +02:00
};
2023-03-18 01:35:27 +01:00
sops = {
defaultSopsFile = ./secrets.yaml;
secrets = {
"gitea/ldapSearchUserPassword" = libS.sops.permissionForUser "gitea";
"restic/password".owner = "root";
"restic/repository/server8".owner = "root";
};
2023-03-18 01:35:27 +01:00
};
2022-06-24 00:12:08 +02:00
programs.msmtp = {
enable = true;
accounts.default = {
host = "mail.c3d2.de";
port = 587;
tls = true;
tls_starttls = true;
auth = false;
domain = "gitea.c3d2.de";
from = "mail@c3d2.de";
};
};
2021-10-02 20:28:30 +02:00
system.stateVersion = "21.11";
}