dotfiles/nixos/boxes/cupsnet/foundryvtt.nix

63 lines
1.3 KiB
Nix
Raw Normal View History

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";
url = "file:///" + ./FoundryVTT-12.331.zip;
2022-06-18 12:19:35 +01:00
postFetch = "";
sha256 = "sha256-H4IpflEkwsmeDAOdVWLbhh4i3F7zhTYdOZPFT34H8ng=";
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
};
}