2022-06-18 12:19:35 +01:00
|
|
|
{ config, pkgs, inputs, lib, ... }:
|
|
|
|
let
|
|
|
|
foundryvtt = pkgs.fetchzip {
|
|
|
|
name = "foundryvtt";
|
2022-10-22 16:07:45 +01:00
|
|
|
url = "file:///" + ./FoundryVTT-10.288.zip;
|
2022-06-18 12:19:35 +01:00
|
|
|
postFetch = "";
|
2022-10-22 16:07:45 +01:00
|
|
|
sha256 = "sha256-rnYtyUf3ymZlc+4zarez3LcQ/X+RZiY2zP4W3yXLfso=";
|
2022-06-18 12:19:35 +01:00
|
|
|
stripRoot = false;
|
|
|
|
};
|
|
|
|
in {
|
2022-06-18 08:44:06 +01:00
|
|
|
imports = [ ../nginx.nix ];
|
|
|
|
|
|
|
|
services.nginx = {
|
2022-06-18 10:03:10 +01:00
|
|
|
clientMaxBodySize = "300M";
|
2022-06-18 08:44:06 +01:00
|
|
|
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
|
|
|
};
|
|
|
|
};
|
2022-06-18 12:19:35 +01:00
|
|
|
virtualHosts = {
|
2022-08-20 10:38:35 +01:00
|
|
|
"foundryvtt-test.peninsula.industries" = {
|
2022-06-18 12:19:35 +01:00
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://localhost:30001";
|
|
|
|
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;
|
|
|
|
}];
|
2022-08-20 10:13:25 +01:00
|
|
|
bindMounts = {
|
|
|
|
"/var/lib/foundryvtt" = {
|
|
|
|
hostPath = "/var/lib/foundryvtt";
|
|
|
|
isReadOnly = false;
|
|
|
|
};
|
|
|
|
};
|
2022-06-18 12:19:35 +01:00
|
|
|
config = { config, pkgs, ... }: {
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
serviceConfig.Restart = "always";
|
2022-06-18 08:44:06 +01:00
|
|
|
};
|
2022-06-18 12:19:35 +01:00
|
|
|
};
|
2022-06-18 08:44:06 +01:00
|
|
|
};
|
2022-08-20 10:38:35 +01:00
|
|
|
containers.foundryvtt-test = {
|
|
|
|
autoStart = true;
|
|
|
|
forwardPorts = [{
|
|
|
|
containerPort = 30001;
|
|
|
|
hostPort = 30001;
|
|
|
|
}];
|
|
|
|
config = { config, pkgs, ... }: {
|
|
|
|
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 --port=30001
|
|
|
|
'';
|
|
|
|
serviceConfig.Restart = "always";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2022-06-18 08:44:06 +01:00
|
|
|
}
|