dotfiles/nixos/boxes/vpsfree1/foundryvtt.nix

45 lines
1.1 KiB
Nix
Raw Normal View History

2022-06-18 08:44:06 +01:00
{ config, pkgs, inputs, lib, ... }: {
imports = [ ../nginx.nix ];
services.nginx = {
virtualHosts = {
"foundryvtt.peninsula.industries" = {
forceSSL = true;
enableACME = true;
2022-06-18 09:21:51 +01:00
locations."/" = {
proxyPass = "http://localhost:30000";
proxyWebsockets = true;
};
2022-06-18 08:44:06 +01:00
};
};
};
containers.foundryvtt = {
autoStart = true;
2022-06-18 09:21:51 +01:00
forwardPorts = [{
containerPort = 30000;
hostPort = 30000;
}];
config = { config, pkgs, ... }:
let
foundryvtt = pkgs.fetchzip {
2022-06-18 08:44:06 +01:00
name = "foundryvtt";
url = "file:///" + ./FoundryVTT-9.269.zip;
postFetch = "";
sha256 = "sha256-7YlF3tQ0XsN8CJO7WrjAhz8rHdl/pgqGUpjIJJnB0Eg=";
stripRoot = false;
2022-06-18 09:21:51 +01:00
};
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
'';
2022-06-18 08:44:06 +01:00
};
};
};
}