This commit is contained in:
Shelvacu
2024-12-09 11:13:48 -08:00
committed by Shelvacu on fw
parent 547e94ed4f
commit d386c7056f

View File

@@ -29,6 +29,14 @@ let
) domains;
message = "proxiedService ${proxiedConfig.name}'s `domain` does not match any of the known domains";
}) proxied;
#networking.hosts = mapListToAttrs (c: lib.nameValuePair c.ipAddress [ c.name ]) proxied;
hosts = lib.foldl (acc: c:
let
name = c.ipAddress;
val = c.name;
in
acc // { ${name} = (acc.${name} or []) ++ [ val ]; }
) {} proxied;
mapListToAttrs = f: list: lib.listToAttrs (map f list);
in
{
@@ -84,7 +92,7 @@ in
users.users.haproxy.extraGroups = [ config.users.groups.acme.name ];
services.haproxy.enable = true;
services.haproxy.config = import ./haproxy-config.nix { inherit lib domains proxied; };
networking.hosts = mapListToAttrs (c: lib.nameValuePair c.ipAddress [ c.name ]) proxied;
networking.hosts = hosts;
};
};
}