{ config, pkgs, ...}: { systemd.services = let simpledaemon = name: command: { enable = true; description = name; wantedBy = [ "multi-user.target" ]; serviceConfig.Type = "simple"; script = command; }; in { choclo = simpledaemon "choclo signalling server" "/root/simple-signalling/target/release/chaski -b 127.0.0.1:5000"; wasi = simpledaemon "wasi backend" "/root/wasi-minimal/target/release/wasi"; picarones = simpledaemon "picarones backend" "/root/picarones-server/target/release/picarones -b 127.0.0.1:6000"; }; services.nginx = { virtualHosts = let websocketproxy = addr: { locations."/".proxyPass = addr; forceSSL = true; enableACME = true; locations."/".proxyWebsockets = true; }; in { "wasi.stuebinm.eu" = websocketproxy "http://127.0.0.1:9000"; "choclo.stuebinm.eu" = websocketproxy "http://127.0.0.1:5000"; "picarones.stuebinm.eu" = websocketproxy "http://127.0.0.1:6000"; }; }; }