easier to read nginx file

This commit is contained in:
Danilo Reyes 2025-09-28 02:15:41 -06:00
parent cd9e738c3c
commit f400b8922a

View File

@ -1,77 +1,41 @@
{ lib, config, ... }: { lib, config, ... }:
let let
setup = import ../servers/setup.nix { inherit lib config; }; setup = import ../servers/setup.nix { inherit lib config; };
standardProxyServices = { proxyReverseServices = [
"firefox-syncserver" = { "firefox-syncserver"
type = "proxyReverse"; "readeck"
}; "microbin"
"readeck" = { "ryot"
type = "proxyReverse"; "bazarr"
}; "shiori"
"microbin" = { "metube"
type = "proxyReverse"; "maloja"
}; "vaultwarden"
"ryot" = { "mealie"
type = "proxyReverse"; "kavita"
}; "multi-scrobbler"
"bazarr" = { "nix-serve"
type = "proxyReverse"; ];
}; proxyReverseFixServices = [
"shiori" = { "audiobookshelf"
type = "proxyReverse"; "lidarr"
}; "gitea"
"metube" = { "prowlarr"
type = "proxyReverse"; "ombi"
}; "radarr"
"maloja" = { "sonarr"
type = "proxyReverse"; "stash"
}; "atticd"
"vaultwarden" = { ];
type = "proxyReverse"; proxyReversePrivateServices = [
}; "homepage"
"mealie" = { ];
type = "proxyReverse"; mkServiceConfig =
}; type: services: lib.listToAttrs (map (name: lib.nameValuePair name { inherit type; }) services);
"kavita" = { standardProxyServices =
type = "proxyReverse"; (mkServiceConfig "proxyReverse" proxyReverseServices)
}; // (mkServiceConfig "proxyReverseFix" proxyReverseFixServices)
"multi-scrobbler" = { // (mkServiceConfig "proxyReversePrivate" proxyReversePrivateServices);
type = "proxyReverse";
};
"nix-serve" = {
type = "proxyReverse";
};
"audiobookshelf" = {
type = "proxyReverseFix";
};
"lidarr" = {
type = "proxyReverseFix";
};
"gitea" = {
type = "proxyReverseFix";
};
"prowlarr" = {
type = "proxyReverseFix";
};
"ombi" = {
type = "proxyReverseFix";
};
"radarr" = {
type = "proxyReverseFix";
};
"sonarr" = {
type = "proxyReverseFix";
};
"stash" = {
type = "proxyReverseFix";
};
"atticd" = {
type = "proxyReverseFix";
};
"homepage" = {
type = "proxyReversePrivate";
};
};
generateProxyConfig = generateProxyConfig =
serviceName: serviceConfig: serviceName: serviceConfig:
let let
@ -87,10 +51,9 @@ 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));
standardProxyConfigs = lib.mapAttrs' generateProxyConfig standardProxyServices;
in in
{ {
config = lib.mkIf config.my.enableProxy { config = lib.mkIf config.my.enableProxy {
services.nginx.virtualHosts = standardProxyConfigs; services.nginx.virtualHosts = lib.mapAttrs' generateProxyConfig standardProxyServices;
}; };
} }