summaryrefslogtreecommitdiff
path: root/lib/nginx.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/nginx.nix')
-rw-r--r--lib/nginx.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/nginx.nix b/lib/nginx.nix
new file mode 100644
index 0000000..0328f79
--- /dev/null
+++ b/lib/nginx.nix
@@ -0,0 +1,13 @@
+{lib, ...}: {
+ mkProxy = endpoint: port: {
+ "${endpoint}" = {
+ proxyPass = "http://localhost:${toString port}";
+ proxyWebsockets = true;
+ };
+ };
+
+ toVHosts = domain:
+ lib.mapAttrs' (
+ name: value: lib.nameValuePair "${name}.${domain}" value
+ );
+}