This is repo packages FoundryVTT for use with NixOS and Nix. It only includes the server component. We use FoundryVTT intermitently, but I’ve subscribed to notifications on foundryvtt/foundryvtt in the hope I can do a better job keeping up to date with releases when we’re not actively playing.
The NixOS module targets the latest release of NixOS. That’s 24.05.
To use the module, add it to the modules list in your NixOS configuration. See below for an example flake.nix
and
configuration.nix
. See modules/foundryvtt/default.nix for the available options.
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
inputs.foundryvtt.url = "github:reckenrode/nix-foundryvtt";
outputs = { self, nixpkgs, foundryvtt }: {
nixosConfigurations.example = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
./configuration.nix
inputs.foundryvtt.nixosModules.foundryvtt
];
};
};
}
{
services.foundryvtt = {
enable = false;
hostName = "<hostname goes here>";
minifyStaticFiles = true;
proxyPort = 443;
proxySSL = true;
upnp = false;
};
}
By default, the module uses foundryvtt
, which corresponds to FoundryVTT v11. You should change the module to
the version of FoundryVTT you plan to run on your server. See below for how to use a different package version.
{ inputs, pkgs, ... }:
{
services.foundryvtt = {
enable = false;
hostName = "<hostname goes here>";
minifyStaticFiles = true;
package = inputs.foundryvtt.packages.${pkgs.system}.foundryvtt_12; # Sets the version to the latest FoundryVTT v12.
proxyPort = 443;
proxySSL = true;
upnp = false;
};
}
Because FoundryVTT is not available for download without a login, it has to be added manually to the store. Doing this
per the instructions when you first build your configuration will add the file to the store, but the file is at risk
of being garbage collected when nix-collect-garbage
is run. To prevent the file from being garbage collected, create a
GC root. As long as the created root exists, it will be used as necessary when you rebuild or update your configs.
Note: You will need to repeat this procedure for every version of FoundryVTT that you use.
$ nix-store --add-fixed sha256 FoundryVTT-<version>.zip
/nix/store/<hash>-FoundryVTT-<version>.zip
$ mkdir -p <some path>
$ nix-store --add-root <some path>/FoundryVTT-<version>.zip -r /nix/store/<hash>-FoundryVTT-<version>.zip
<some path>/FoundryVTT-<version>.zip
$ ls -al <some path>
total 0
drwxr-xr-x 3 reckenrode staff 96 Jun 18 18:33 ./
drwxr-x---+ 75 reckenrode staff 2400 Jun 18 18:33 ../
lrwxr-xr-x 1 reckenrode staff 65 Jun 18 18:33 FoundryVTT-<version>.zip -> /nix/store/<hash>-FoundryVTT-<version>.zip
nix-foundryvtt has version information for all available releases of Foundry VTT. It provides packages for the latest
stable releases of v9, v10, v11, and v12. foundryvtt_latest
corresponds to the latest version (currently v12).
The FoundryVTT version can be overriden using overrideAttrs
.
- Specify the
majorVersion
andreleaseType
to specify the major version and release you want to install.majorVersion
corresponds to the major version as used by FoundryVTT.releaseType
is one ofprototype
,development
,testing
, orstable
. This specifies the least stable release the resolver should match. The default isstable
.prototype
will match all release types.development
will matchdevelopment
,testing
, andstable
.testing
will matchtesting
andstable
.stable
will match onlystable
.
- Specify
version
to use a specific version based on the semver version (e.g.,12.0.0+327
to install FoundryVTT 12.327). Specifying aversion
ignores the release type. - Specify
build
to use a specific build (e.g.,327
to install FoundryVTT 12.327). Specifying abuild
ignores the release type.
-
Download the new Linux/NodeJS version of Foundry from your licensed account at https://foundryvtt.com/
-
Run
nix build .#foundryvtt.passthru.updateScript && ./result <path to download>/FoundryVTT-<version>.zip <release type>
<release type>
is one of the above release types.
-
Commit all the changes to a branch, test them, and create a PR for the update.