helm/modules/services/gitea.nix

60 lines
1.4 KiB
Nix
Raw Permalink Normal View History

# modules/services/gitea.nix
#
# Gitea is essentially a self-hosted github. This modules configures it with the
# expectation that it will be served over an SSL-secured reverse proxy (best
# paired with my modules.services.nginx module).
#
# Resources
# Config: https://docs.gitea.io/en-us/config-cheat-sheet/
# API: https://docs.gitea.io/en-us/api-usage/
{ options, config, lib, pkgs, ... }:
2020-03-28 22:48:43 -07:00
with lib;
with lib.my;
let cfg = config.modules.services.gitea;
in {
2020-03-28 22:48:43 -07:00
options.modules.services.gitea = {
enable = mkBoolOpt false;
2019-11-18 18:41:35 -08:00
};
2019-11-17 22:25:29 -08:00
config = mkIf cfg.enable {
2021-01-01 21:26:00 -08:00
# Allows git@... clone addresses rather than gitea@...
2020-03-28 22:48:43 -07:00
users.users.git = {
useDefaultShell = true;
home = "/var/lib/gitea";
group = "gitea";
2021-05-27 21:19:17 -07:00
isSystemUser = true;
2020-03-28 22:48:43 -07:00
};
2021-01-01 21:26:00 -08:00
user.extraGroups = [ "gitea" ];
2020-03-28 22:48:43 -07:00
services.gitea = {
enable = true;
2021-02-01 16:55:05 -08:00
lfs.enable = true;
2019-11-18 18:41:35 -08:00
user = "git";
database.user = "git";
2019-11-18 21:22:23 -08:00
2020-03-28 22:48:43 -07:00
# We're assuming SSL-only connectivity
cookieSecure = true;
# Only log what's important, but Info is necessary for fail2ban to work
log.level = "Info";
settings = {
server.DISABLE_ROUTER_LOG = true;
database.LOG_SQL = false;
service.ENABLE_BASIC_AUTHENTICATION = false;
};
2021-03-11 21:46:33 -08:00
dump.interval = "daily";
2020-03-28 22:48:43 -07:00
};
services.fail2ban.jails.gitea = ''
enabled = true
filter = gitea
banaction = %(banaction_allports)s
maxretry = 5
'';
2019-11-18 18:41:35 -08:00
};
2019-11-17 22:25:29 -08:00
}