63 lines
1.3 KiB
Nix
63 lines
1.3 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
inputs,
|
|
lib,
|
|
...
|
|
}: let
|
|
foundryvtt = pkgs.fetchzip {
|
|
name = "foundryvtt";
|
|
url = "file:///" + ./FoundryVTT-11.306.zip;
|
|
postFetch = "";
|
|
sha256 = "sha256-0nvufwYcgWwY6THeWQbD9CqO7l1UGvSMxGzc7aaRJWs=";
|
|
stripRoot = false;
|
|
};
|
|
in {
|
|
imports = [../nginx.nix];
|
|
|
|
services.nginx = {
|
|
clientMaxBodySize = "300M";
|
|
virtualHosts = {
|
|
"foundryvtt.peninsula.industries" = {
|
|
forceSSL = true;
|
|
enableACME = true;
|
|
locations."/" = {
|
|
proxyPass = "http://localhost:30000";
|
|
proxyWebsockets = true;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
containers.foundryvtt = {
|
|
autoStart = true;
|
|
forwardPorts = [
|
|
{
|
|
containerPort = 30000;
|
|
hostPort = 30000;
|
|
}
|
|
];
|
|
bindMounts = {
|
|
"/var/lib/foundryvtt" = {
|
|
hostPath = "/var/lib/foundryvtt";
|
|
isReadOnly = false;
|
|
};
|
|
};
|
|
config = {
|
|
config,
|
|
pkgs,
|
|
...
|
|
}: {
|
|
system.stateVersion = "23.11";
|
|
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";
|
|
};
|
|
};
|
|
};
|
|
}
|