dotfiles/nixos/boxes/vpsfree1/foundryvtt.nix

53 lines
1.3 KiB
Nix
Raw Normal View History

2023-06-07 17:46:42 +01:00
{ config, pkgs, inputs, lib, ... }:
let
2022-06-18 12:19:35 +01:00
foundryvtt = pkgs.fetchzip {
name = "foundryvtt";
2023-07-22 18:11:41 +01:00
url = "file:///" + ./FoundryVTT-11.306.zip;
2022-06-18 12:19:35 +01:00
postFetch = "";
2023-07-22 18:11:41 +01:00
sha256 = "sha256-0nvufwYcgWwY6THeWQbD9CqO7l1UGvSMxGzc7aaRJWs=";
2022-06-18 12:19:35 +01:00
stripRoot = false;
};
in {
2023-06-07 17:46:42 +01: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
};
2022-06-18 08:44:06 +01:00
containers.foundryvtt = {
autoStart = true;
2023-06-07 17:46:42 +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-06-07 17:46:42 +01:00
config = { config, pkgs, ... }: {
system.stateVersion = "23.05";
2022-06-18 12:19:35 +01:00
systemd.services."foundryvtt" = {
2023-06-07 17:46:42 +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
};
}