infrastructure/nixos/hosts/olympus/gitea/configuration.nix

106 lines
2.9 KiB
Nix
Raw Normal View History

2022-04-29 22:24:44 +02:00
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ lib, config, pkgs, ... }:
2022-09-25 16:42:18 +02:00
let
vs = config.vault-secrets.secrets;
in
2022-04-29 22:24:44 +02:00
{
imports = [ ];
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "21.11"; # Did you read the comment?
# Additional packages
environment.systemPackages = with pkgs; [ ];
environment.noXlibs = lib.mkForce false;
networking.firewall.allowedTCPPorts = [ config.services.gitea.httpPort ];
2022-06-12 12:25:46 +02:00
services.openssh.startWhenNeeded = false;
2022-06-14 13:07:06 +02:00
services.fail2ban = {
enable = true;
maxretry = 3;
};
2022-09-25 16:42:18 +02:00
vault-secrets.secrets.gitea = {
user = "gitea";
group = "gitea";
};
2022-07-31 16:12:03 +02:00
system.activationScripts.gitea-theme =
let
target_dir = "${config.services.gitea.stateDir}/custom/public/css/";
in
lib.stringAfter [ "var" ] ''
mkdir -p ${target_dir}
2022-08-20 10:32:59 +02:00
ln -sf ${pkgs.v.gitea-agatheme} "${target_dir}/theme-agatheme.css"
2022-07-31 16:12:03 +02:00
'';
2022-04-29 22:24:44 +02:00
services.gitea = {
enable = true;
domain = "git.0x76.dev";
2023-04-14 22:28:06 +02:00
package = pkgs.forgejo;
2022-04-29 22:24:44 +02:00
rootUrl = "https://git.0x76.dev";
lfs.enable = true;
dump.type = "tar.gz";
database.type = "postgres";
2022-09-25 16:42:18 +02:00
mailerPasswordFile = "${vs.gitea}/mailPassword";
2022-07-31 16:12:03 +02:00
2022-04-29 22:24:44 +02:00
settings = {
2023-04-15 08:46:07 +02:00
actions = {
"ENABLED" = true;
};
2022-07-31 16:12:03 +02:00
repository = {
"ENABLE_PUSH_CREATE_USER" = true;
"DEFAULT_PUSH_CREATE_PRIVATE" = false;
};
service = {
"DEFAULT_KEEP_EMAIL_PRIVATE" = true;
2022-08-20 10:32:59 +02:00
"DISABLE_REGISTRATION" = true;
2022-07-31 16:12:03 +02:00
};
indexer = {
"REPO_INDEXER_ENABLED" = true;
"REPO_INDEXER_PATH" = "indexers/repos.bleve";
"UPDATE_BUFFER_LEN" = 20;
"MAX_FILE_SIZE" = 1048576;
"REPO_INDEXER_EXCLUDE" = "node_modules/**";
};
2022-04-29 22:24:44 +02:00
ui = {
2022-07-31 16:12:03 +02:00
"THEMES" = "gitea,arc-green,agatheme";
"DEFAULT_THEME" = "agatheme";
"USE_SERVICE_WORKER" = true;
};
server = {
"LANDING_PAGE" = "explore";
2022-08-20 13:54:45 +02:00
"SSH_PORT" = 42;
2022-07-31 16:12:03 +02:00
};
session = {
"PROVIDER" = "db";
2022-08-20 10:32:59 +02:00
"COOKIE_SECURE" = true;
2022-04-29 22:24:44 +02:00
};
2022-09-25 16:42:18 +02:00
mailer = {
"ENABLED" = true;
"IS_TLS_ENABLED" = true;
"HOST" = "mail.0x76.dev:465";
"FROM" = "gitea@0x76.dev";
"MAILER_TYPE" = "smtp";
"USER" = "gitea@0x76.dev";
# Below is prep for 1.18
"PROTOCOL" = "smtps";
"SMTP_ADDR" = "mail.0x76.dev";
"SMTP_PORT" = 465;
};
2022-04-29 22:24:44 +02:00
};
};
}