Fix final evaluation errors
- We had some functions in a list that we were erroneously not evalutating
- Our recursion had an out-by-1
- Streams were incompatible with port forwarding
Change-Id: I5f40cd4f7eb1ce8e27a31a4927460393649f3849
diff --git a/nginx.nix b/nginx.nix
index a808c8e..41cc114 100644
--- a/nginx.nix
+++ b/nginx.nix
@@ -71,14 +71,14 @@
Merge = let
# builtins.length and count up
_iterateCompose = services: currentConfig: currentPath: secure: priority: i:
- if i > builtins.length services
- then currentConfig
- else _iterateCompose services (_merge (builtins.elemAt services i) currentConfig currentPath secure priority+i) currentPath secure priority (i+1);
+ if i < builtins.length services
+ then _iterateCompose services (_merge (builtins.elemAt services i) currentConfig currentPath secure priority+i) currentPath secure priority (i+1)
+ else currentConfig;
_iterateMerge = i: current: services:
- if i > builtins.length services
- then current
- else _iterateMerge (i+1) (current++[_merge (builtins.elemAt services i) {} "/" true 1000]) services;
+ if i < builtins.length services
+ then _iterateMerge (i+1) (current++[(_merge (builtins.elemAt services i) {} "/" true 1000)]) services
+ else current;
_merge = service: currentConfig: currentPath: secure: priority:
if service.type == "hosts"
@@ -164,12 +164,7 @@
External should only be a port
Protocol should be TCP or UDP
*/
- Stream = external: internal: protocol: ''
- server {
- listen ${builtins.toString external} ${protocol};
- proxy_pass ${internal};
- }
- '';
+ Stream = external: internal: protocol: { inherit external internal protocol; };
Alias = host: alias: {
inherit host;