hswaw/sound: add spejsiot-api

Change-Id: If40cdbeadb570d8c33b4c950482c01f4b2bbd1c4
Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1446
Reviewed-by: vuko <vuko@hackerspace.pl>
diff --git a/hswaw/machines/sound.waw.hackerspace.pl/configuration.nix b/hswaw/machines/sound.waw.hackerspace.pl/configuration.nix
index 8c0116b..d1a9b4c 100644
--- a/hswaw/machines/sound.waw.hackerspace.pl/configuration.nix
+++ b/hswaw/machines/sound.waw.hackerspace.pl/configuration.nix
@@ -31,6 +31,7 @@
   imports =
     [
       ./hardware-configuration.nix
+			./spejsiot-api.nix
     ];
 
   boot.loader.systemd-boot.enable = true;
@@ -146,6 +147,30 @@
             proxyPass = "http://localhost:8123";
           };
         };
+        "spejsiot.waw.hackerspace.pl" = {
+          serverAliases = ["default_server"];
+          listen = [
+            {
+              addr = networks.lan.ipv4;
+              port = 80;
+              ssl = false;
+            }
+          ];
+          locations."/" = {
+            # TODO copied from iot, are all headers needed?
+            extraConfig = ''
+              proxy_set_header Upgrade $http_upgrade;
+              proxy_set_header Connection $http_connection;
+              proxy_set_header Host $host;
+              proxy_set_header X-Real-IP $remote_addr;
+              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+              proxy_set_header X-Forwarded-Host $host:$server_port;
+              proxy_set_header X-Forwarded-Server $host;
+              proxy_set_header X-Forwarded-Proto $scheme;
+            '';
+            proxyPass = "http://localhost:5100";
+          };
+        };
       };
     };