From b579b307fd479d88fcd566dff9c218a9a50ec6bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sat, 18 Jun 2022 09:21:51 +0100 Subject: [PATCH] First working version of foundryvtt --- nixos/boxes/vpsfree1/foundryvtt.nix | 37 ++++++++++++++++------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/nixos/boxes/vpsfree1/foundryvtt.nix b/nixos/boxes/vpsfree1/foundryvtt.nix index a8434620..4f2c572f 100644 --- a/nixos/boxes/vpsfree1/foundryvtt.nix +++ b/nixos/boxes/vpsfree1/foundryvtt.nix @@ -6,36 +6,39 @@ "foundryvtt.peninsula.industries" = { forceSSL = true; enableACME = true; + locations."/" = { + proxyPass = "http://localhost:30000"; + proxyWebsockets = true; + }; }; }; }; containers.foundryvtt = { autoStart = true; - config = { config, pkgs, ... }: { - environment.systemPackages = with pkgs; [ - - (fetchzip { + forwardPorts = [{ + containerPort = 30000; + hostPort = 30000; + }]; + config = { config, pkgs, ... }: + let + foundryvtt = pkgs.fetchzip { name = "foundryvtt"; url = "file:///" + ./FoundryVTT-9.269.zip; postFetch = ""; sha256 = "sha256-7YlF3tQ0XsN8CJO7WrjAhz8rHdl/pgqGUpjIJJnB0Eg="; stripRoot = false; - }) - - nodejs-18_x - ]; - - systemd.services."foundryvtt" = { - requires = [ "network-online.target" ]; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - Restart = "on-failure"; - ExecStart = "echo Hi, %u"; - DynamicUser = "yes"; + }; + in { + systemd.services."foundryvtt" = { + requires = [ "network-online.target" ]; + wantedBy = [ "multi-user.target" ]; + script = '' + mkdir -p /var/lib/foundryvtt + ${pkgs.nodejs-18_x}/bin/node ${foundryvtt}/resources/app/main.js --dataPath=/var/lib/foundryvtt + ''; }; }; - }; }; }