fix(lib): rm infinite recursion somehow

This commit is contained in:
Mohammad Rafiq 2025-07-09 03:26:31 +08:00
parent e9a6649f6a
commit fbd8a20036
No known key found for this signature in database

View file

@ -18,14 +18,33 @@ in
mkHost = domain: if isRootDomain domain then domain else mkWildcardDomain (mkRootDomain domain); mkHost = domain: if isRootDomain domain then domain else mkWildcardDomain (mkRootDomain domain);
mkWebApp = mkWebApp =
{ {
config,
name, name,
defaultPort, defaultPort,
persistDirs ? [ ], persistDirs ? [ ],
serviceConfig ? { },
extraOptions ? { }, extraOptions ? { },
extraConfig ? { },
}: }:
let let
cfg = config.server.web-apps.${name}; cfg = config.server.web-apps.${name};
networkingConfig =
{
config,
cfg,
name,
}:
mkIf (cfg.domain != "") {
assertions = singleton {
assertion = config.server.web-servers.nginx.enable;
message = "You must enable a web server if you want to set server.web-apps.${name}.domain.";
};
server.ddns.domains = singleton (mkRootDomain cfg.domain);
server.web-servers.nginx.proxies = singleton {
source = cfg.domain;
target = "http://${config.hostname}:${toString cfg.port}";
};
};
in in
{ {
options.server.web-apps.${name} = { options.server.web-apps.${name} = {
@ -41,20 +60,10 @@ in
inherit persistDirs; inherit persistDirs;
networking.firewall = mkIf cfg.openFirewall { allowedTCPPorts = singleton cfg.port; }; networking.firewall = mkIf cfg.openFirewall { allowedTCPPorts = singleton cfg.port; };
} }
(mkIf (cfg.domain != "") { (networkingConfig { inherit config cfg name; })
assertions = singleton { extraConfig
assertion = config.server.web-servers.nginx.enable;
message = "You must enable a web server if you want to set server.web-apps.${name}.domain.";
};
server.networking.ddns.domains = singleton (mkRootDomain cfg.domain);
server.web-servers.nginx.proxies = singleton {
source = cfg.domain;
target = "http://${config.hostname}:${toString cfg.port}";
};
})
serviceConfig
cfg.extraCfg
]); ]);
}; };
}; };
} }