mkModule gitea
This commit is contained in:
@@ -6,32 +6,20 @@
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.${namespace}.services.gitea;
|
||||
name = "gitea";
|
||||
cfg = config.${namespace}.services.${name};
|
||||
rootUrl = "https://gitea.${namespace}.dev/";
|
||||
mailerPasswordFile = config.sops.secrets."jallen-nas/gitea/mail-key".path;
|
||||
metricsTokenFile = config.sops.secrets."jallen-nas/gitea/metrics-key".path;
|
||||
|
||||
# Create reverse proxy configuration using mkReverseProxy
|
||||
reverseProxyConfig = lib.${namespace}.mkReverseProxy {
|
||||
name = "gitea";
|
||||
subdomain = cfg.reverseProxy.subdomain;
|
||||
url = "http://${cfg.localAddress}:${toString cfg.httpPort}";
|
||||
middlewares = cfg.reverseProxy.middlewares;
|
||||
};
|
||||
|
||||
traefik = {
|
||||
"${namespace}".services.traefik = lib.mkIf cfg.reverseProxy.enable {
|
||||
reverseProxies = [ reverseProxyConfig ];
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [ ./options.nix ];
|
||||
config =
|
||||
mkIf cfg.enable {
|
||||
giteaConfig = lib.${namespace}.mkModule {
|
||||
inherit config name;
|
||||
description = "Gitea";
|
||||
options = { };
|
||||
moduleConfig = {
|
||||
services.gitea = {
|
||||
enable = true;
|
||||
stateDir = cfg.dataDir;
|
||||
stateDir = "${cfg.configDir}/gitea";
|
||||
user = "nix-apps";
|
||||
group = "jallen-nas";
|
||||
mailerPasswordFile = mailerPasswordFile;
|
||||
@@ -39,12 +27,12 @@ in
|
||||
settings = {
|
||||
server = {
|
||||
DOMAIN = "jallen-nas";
|
||||
HTTP_ADDR = "0.0.0.0";
|
||||
HTTP_PORT = cfg.httpPort;
|
||||
HTTP_ADDR = cfg.listenAddress;
|
||||
HTTP_PORT = cfg.port;
|
||||
PROTOCOL = "http";
|
||||
ROOT_URL = rootUrl;
|
||||
START_SSH_SERVER = true;
|
||||
SSH_PORT = cfg.sshPort;
|
||||
SSH_PORT = 2222;
|
||||
};
|
||||
service = {
|
||||
REGISTER_EMAIL_CONFIRM = false;
|
||||
@@ -58,6 +46,9 @@ in
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
// traefik;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [ giteaConfig ];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user