it was the nginx module...
This commit is contained in:
@@ -5,25 +5,6 @@
|
|||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
proxyReverseServices = [
|
|
||||||
"bazarr"
|
|
||||||
"firefox-syncserver"
|
|
||||||
"flame"
|
|
||||||
"flameSecret"
|
|
||||||
"isso"
|
|
||||||
"kavita"
|
|
||||||
"linkwarden"
|
|
||||||
"maloja"
|
|
||||||
"mealie"
|
|
||||||
"metube"
|
|
||||||
"microbin"
|
|
||||||
"multi-scrobbler"
|
|
||||||
"nix-serve"
|
|
||||||
"plausible"
|
|
||||||
"shiori"
|
|
||||||
"vaultwarden"
|
|
||||||
"yamtrack"
|
|
||||||
];
|
|
||||||
proxyReverseFixServices = [
|
proxyReverseFixServices = [
|
||||||
"atticd"
|
"atticd"
|
||||||
"audiobookshelf"
|
"audiobookshelf"
|
||||||
@@ -41,8 +22,7 @@ let
|
|||||||
mkServiceConfig =
|
mkServiceConfig =
|
||||||
type: services: lib.listToAttrs (map (name: lib.nameValuePair name { inherit type; }) services);
|
type: services: lib.listToAttrs (map (name: lib.nameValuePair name { inherit type; }) services);
|
||||||
standardProxyServices =
|
standardProxyServices =
|
||||||
(mkServiceConfig "proxyReverse" proxyReverseServices)
|
(mkServiceConfig "proxyReverseFix" proxyReverseFixServices)
|
||||||
// (mkServiceConfig "proxyReverseFix" proxyReverseFixServices)
|
|
||||||
// (mkServiceConfig "proxyReversePrivate" proxyReversePrivateServices);
|
// (mkServiceConfig "proxyReversePrivate" proxyReversePrivateServices);
|
||||||
generateProxyConfig =
|
generateProxyConfig =
|
||||||
serviceName: serviceConfig:
|
serviceName: serviceConfig:
|
||||||
@@ -59,9 +39,20 @@ let
|
|||||||
throw "Unknown proxy type: ${serviceConfig.type}";
|
throw "Unknown proxy type: ${serviceConfig.type}";
|
||||||
in
|
in
|
||||||
lib.nameValuePair cfg.host (lib.mkIf cfg.enableProxy (proxyFunc cfg));
|
lib.nameValuePair cfg.host (lib.mkIf cfg.enableProxy (proxyFunc cfg));
|
||||||
|
standardProxyNames = builtins.attrNames standardProxyServices;
|
||||||
|
customProxyServices =
|
||||||
|
config.my.servers
|
||||||
|
|> lib.filterAttrs (
|
||||||
|
name: srv:
|
||||||
|
(srv.enableProxy or false)
|
||||||
|
&& !(builtins.elem name standardProxyNames)
|
||||||
|
)
|
||||||
|
|> lib.mapAttrs (name: _srv: { type = "proxyReverse"; });
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
config = lib.mkIf config.my.enableProxy {
|
config = lib.mkIf config.my.enableProxy {
|
||||||
services.nginx.virtualHosts = lib.mapAttrs' generateProxyConfig standardProxyServices;
|
services.nginx.virtualHosts = lib.mapAttrs' generateProxyConfig (
|
||||||
|
standardProxyServices // customProxyServices
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user