diff --git a/flake.lock b/flake.lock index a9f6b66..e178d01 100644 --- a/flake.lock +++ b/flake.lock @@ -817,11 +817,11 @@ "parts": "parts_5" }, "locked": { - "lastModified": 1683296163, - "narHash": "sha256-pOdVitwRl8gUNMxInXwJJtXffSYYsAc0EWkFSFGvrRk=", + "lastModified": 1683618968, + "narHash": "sha256-OkxkRYNKv0nR37YxrNC/3SW6wGBFMA0MzUWnV4nW5eU=", "owner": "yusdacra", "repo": "musikquadrupled", - "rev": "e259740d501d00fb3548b0be145817ef8fdc35ae", + "rev": "792efb0c9f2e76eb125e654ee1495c071e57e02f", "type": "github" }, "original": { @@ -840,11 +840,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1683276540, - "narHash": "sha256-JiuT8wmMH+vNVyBS18i/RNLDBUDEUCNdeqkwPQYsMDM=", + "lastModified": 1683646918, + "narHash": "sha256-DKD5gN4mj4mDd81xo6kSmtmnMrX/Ue+nQxuVGC4JbuY=", "owner": "yusdacra", "repo": "musikspider", - "rev": "913b0df0b0a5ed78aa761584d9c6f87eff0e781d", + "rev": "77ed4a6de6970ec1846d04fd1da8c3fd2a31feac", "type": "github" }, "original": { diff --git a/hosts/wolumonde/modules/musikspider.nix b/hosts/wolumonde/modules/musikspider.nix index 3bf5571..88d9b10 100644 --- a/hosts/wolumonde/modules/musikspider.nix +++ b/hosts/wolumonde/modules/musikspider.nix @@ -2,10 +2,45 @@ pkgs, inputs, ... -}: { +}: let + pkg = + inputs.musikspider.packages.${pkgs.system}.musikspider.overrideAttrs + (old: { + LOCAL_MUSIKQUAD_SERVER = "http://localhost:5005"; + PUBLIC_MUSIKQUAD_SERVER = "mq.gaze.systems"; + PUBLIC_BASEURL = "ms.gaze.systems"; + }); +in { + users.users.musikspider = { + isSystemUser = true; + group = "musikspider"; + }; + users.groups.musikspider = {}; + + systemd.services.musikspider= { + description = "musikspider"; + wantedBy = ["multi-user.target"]; + after = ["network.target"]; + serviceConfig = { + User = "musikspider"; + ExecStart = "${pkgs.deno}/bin/deno run --allow-env --allow-read --allow-net ${pkg}/index.js"; + Restart = "on-failure"; + RestartSec = 5; + WorkingDirectory = "/var/lib/musikspider"; + EnvironmentFile = pkgs.writeText "musikspider-env" '' + DENO_NO_UPDATE_CHECK=1 + DENO_DIR=/var/lib/musikspider/.deno + PORT=4004 + ''; + }; + }; + services.nginx.virtualHosts."ms.gaze.systems" = { useACMEHost = "gaze.systems"; forceSSL = true; - root = "${inputs.musikspider.packages.${pkgs.system}.musikspider}"; + locations."/" = { + proxyPass = "http://localhost:4004"; + proxyWebsockets = true; + }; }; }