dotfiles/nixos/boxes/vpsfree1/foundryvtt.nix

99 lines
2.2 KiB
Nix
Raw Normal View History

2022-12-19 09:09:08 +00:00
{
config,
pkgs,
inputs,
lib,
...
}: let
2022-06-18 12:19:35 +01:00
foundryvtt = pkgs.fetchzip {
name = "foundryvtt";
2022-11-20 00:03:45 +00:00
url = "file:///" + ./FoundryVTT-10.290.zip;
2022-06-18 12:19:35 +01:00
postFetch = "";
2022-11-20 00:03:45 +00:00
sha256 = "sha256-G4GK76MgDnHsg9dC9Urrww9guJCUTgvMeNzGQ6ez+AQ=";
2022-06-18 12:19:35 +01:00
stripRoot = false;
};
in {
2022-12-19 09:09:08 +00:00
imports = [../nginx.nix];
2022-06-18 08:44:06 +01:00
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-12-19 09:09:08 +00: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-12-19 09:09:08 +00:00
config = {
config,
pkgs,
...
}: {
2022-10-23 11:22:19 +01:00
system.stateVersion = "22.05";
2022-06-18 12:19:35 +01:00
systemd.services."foundryvtt" = {
2022-12-19 09:09:08 +00: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
};
2022-08-20 10:38:35 +01:00
containers.foundryvtt-test = {
autoStart = true;
2022-12-19 09:09:08 +00:00
forwardPorts = [
{
containerPort = 30001;
hostPort = 30001;
}
];
config = {
config,
pkgs,
...
}: {
2022-10-23 11:22:19 +01:00
system.stateVersion = "22.05";
2022-08-20 10:38:35 +01:00
systemd.services."foundryvtt" = {
2022-12-19 09:09:08 +00:00
requires = ["network-online.target"];
wantedBy = ["multi-user.target"];
2022-08-20 10:38:35 +01:00
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
}