2023-08-13 17:00:41 +01:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
inputs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: let
|
2022-06-18 12:19:35 +01:00
|
|
|
foundryvtt = pkgs.fetchzip {
|
|
|
|
name = "foundryvtt";
|
2024-01-06 16:18:36 +00:00
|
|
|
url = "file:///" + ./FoundryVTT-11.315.zip;
|
2022-06-18 12:19:35 +01:00
|
|
|
postFetch = "";
|
2024-01-06 16:18:36 +00:00
|
|
|
sha256 = "sha256-i3U6jfl2zFcHRzK04v8+tcPfUfkvxY8Jifxoxms4VUU=";
|
2022-06-18 12:19:35 +01:00
|
|
|
stripRoot = false;
|
|
|
|
};
|
|
|
|
in {
|
2023-08-13 17:00:41 +01:00
|
|
|
imports = [../nginx.nix];
|
2022-06-18 08:44:06 +01:00
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
};
|
2022-06-18 12:19:35 +01:00
|
|
|
};
|
|
|
|
|
2022-06-18 08:44:06 +01:00
|
|
|
containers.foundryvtt = {
|
|
|
|
autoStart = true;
|
2023-08-13 17:00:41 +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;
|
|
|
|
};
|
|
|
|
};
|
2023-08-13 17:00:41 +01:00
|
|
|
config = {
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: {
|
2023-12-18 10:28:15 +00:00
|
|
|
system.stateVersion = "23.11";
|
2022-06-18 12:19:35 +01:00
|
|
|
systemd.services."foundryvtt" = {
|
2023-08-13 17:00:41 +01:00
|
|
|
requires = ["network-online.target"];
|
|
|
|
wantedBy = ["multi-user.target"];
|
2022-06-18 12:19:35 +01:00
|
|
|
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
|
|
|
};
|
|
|
|
}
|