Configurable virtual fs mounts based on environment variables #1282
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a first step towards addressing #651. It allows users (or package maintainers) to customize the Etterna virtual filesystem mounts using environment variables so that the game installation itself can remain immutable while any variable data is stored elsewhere. This is especially necessary for a NixOS release, as the Nix store is read-only.
More specifically, this PR does the following:
ETTERNA_ROOT_DIR
on startup. If present, its value is used for the path of the main mount; otherwise, the current behaviour is used, namely mounting the installation directory.ETTERNA_ADDITIONAL_ROOT_DIRS
on startup. If present, it's parsed as a list of paths that are treated identically to the paths listed in the "AdditionalFolders" setting. The list delimiter is the OS-dependent path separator, namely;
on Windows and:
everywhere else.ETTERNA_ADDITIONAL_SONG_DIRS
on startup. If present, it's parsed as a list of paths that are treated identically to the paths listed in the "AdditionalSongFolders" setting. As above, the separator is OS-dependent.ASSET_DIR
CMake variable that can be configured to define where game assets should be installed. If absent, defaults to the current behaviour, namely toINSTALL_DIR
. The purpose of this change is to allow assets to be separated from the rest of the game data so that they're easier to subsequently copy elsewhere. Could be useful for distribution on some Linux flavours.INSTALL_DIR
similarly configurable.This last change comes up because the crashpad build task attempts to run built-in build tools (e.g.
extern/crashpad/buildtools/linux64/gn
) that fail to run on NixOS because of linking issues. Potentially, a more drastic refactoring of the build tools could fall back to the system installs of the build tools, but that wasn't a priority for me in this PR.If these changes make it into release, the plan is to then PR nixpkgs with an expression for Etterna. The idea is to wrap the Etterna binary so that the game's root mount is bound to
~/.local/share/etterna
in the user's home directory by environment variables, and then to add the game's immutable installation/asset directory as an additional mount.