dotfiles/modules/nixos/services/gitea/default.nix

63 lines
1.4 KiB
Nix
Raw Normal View History

2023-11-20 16:09:13 +00:00
{
config,
lib,
namespace,
2023-11-20 16:09:13 +00:00
...
}: let
inherit (lib) mkIf mkEnableOption mkOption types;
cfg = config.${namespace}.services.gitea;
2023-11-20 16:09:13 +00:00
gitea_cfg = config.services.gitea;
in {
options.${namespace}.services.gitea = {
2023-11-20 16:09:13 +00:00
enable = mkEnableOption "gitea";
acmeCertName = mkOption {
type = types.str;
2023-11-20 16:09:13 +00:00
default = "";
description = ''
If set to a non-empty string, forces SSL with the supplied acme
certificate.
'';
};
};
config = mkIf cfg.enable {
services.gitea = {
enable = true;
appName = "Internal Gitea server";
database = {
type = "postgres";
};
useWizard = false;
settings = {
server = {
DOMAIN = "gitea.kilonull.com";
ROOT_URL = "https://gitea.kilonull.com";
HTTP_PORT = 3001;
};
session.COOKIE_SECURE = true;
service.DISABLE_REGISTRATION = true;
2024-08-06 02:27:51 +00:00
webhook.ALLOWED_HOST_LIST = "hydra.kilonull.com";
2023-11-20 16:09:13 +00:00
};
};
services.nginx = {
enable = true;
virtualHosts."gitea.kilonull.com" =
{
locations."/" = {
proxyPass = "http://127.0.0.1:${toString gitea_cfg.settings.server.HTTP_PORT}";
};
}
// lib.optionalAttrs (cfg.acmeCertName != "") {
forceSSL = true;
useACMEHost = cfg.acmeCertName;
};
};
};
}