Fix attempt

This commit is contained in:
soraefir
2026-05-06 23:35:03 +02:00
parent 27a5566ac6
commit 3caf507905

View File

@@ -1,28 +1,30 @@
{ config, lib, serverCfg }: { config, lib, serverCfg }:
{ image, secret ? "" let builder =
, subdomain ? "", ip ? "", port ? 0 { image, secret ? ""
, extraEnv ? { }, extraLabels ? { } , subdomain ? "", ip ? "", port ? 0
, overrides ? { } , extraEnv ? { }, extraLabels ? { }
}: , overrides ? { }
let base = { }:
inherit image; let base = {
inherit image;
environmentFiles = if secret !="" then [ config.sops.secrets."${lib.toUpper secret}".path ] else []; environmentFiles = if secret !="" then [ config.sops.secrets."${lib.toUpper secret}".path ] else [];
environment = {} // extraEnv; environment = {} // extraEnv;
labels = if subdomain!="" then ({ labels = if subdomain!="" then ({
"traefik.enable" = "true"; "traefik.enable" = "true";
"traefik.http.routers.${subdomain}.entrypoints" = "web-secure"; "traefik.http.routers.${subdomain}.entrypoints" = "web-secure";
"traefik.http.routers.${subdomain}.rule" = "Host(`${subdomain}.${serverCfg.hostDomain}`)"; "traefik.http.routers.${subdomain}.rule" = "Host(`${subdomain}.${serverCfg.hostDomain}`)";
"traefik.http.routers.${subdomain}.tls" = "true"; "traefik.http.routers.${subdomain}.tls" = "true";
} // lib.optionalAttrs (port != 0) { } // lib.optionalAttrs (port != 0) {
"traefik.http.services.${subdomain}.loadbalancer.server.port" = toString port; "traefik.http.services.${subdomain}.loadbalancer.server.port" = toString port;
}) else { }) else {
"traefik.enable" = "false"; "traefik.enable" = "false";
} // extraLabels; } // extraLabels;
extraOptions = [ extraOptions = [
"--add-host=host.containers.internal:host-gateway" "--add-host=host.containers.internal:host-gateway"
] ++ lib.optional (ip != "") "--ip=${ip}"; ] ++ lib.optional (ip != "") "--ip=${ip}";
}; };
in lib.recursiveUpdate base overrides // { host = "host.containers.internal"; } in lib.recursiveUpdate base overrides;
in builder // { host = "host.containers.internal"; }