Nix expression for downloaded GOG game

I’ve just downloaded a game (Graveyard Keeper) from GOG. It comes as an installer shell script that has binary information at the end. I installed and ran it via steam-run, which was fine. Ideally I’d like to write a Nix expression for it.

Is there a Nix expression in nixpkgs that I can take a look at that either runs the installer somehow, or that extracts the binary data at the end? I can apparently run ./installer --target $dir, but then the installer runs itself and fails because of the linker path in the executable, so I just wanted to ask if somebody did the work of wrapping this in Nix somewhere.

1 Like

I guess you could try to use patchelf or the environment variable LD_LIBRARY_PATH and set them to nix libs/linker

If you just want to istall and run, you could try steam-run. If you want to build a derivation to install, you could get the basics of buildFHSUserEnv`

1 Like

Thanks for both your answers. I should clarify: Getting the thing to run under Nix(OS) is no problem. I used steam-run and I think I can also patchelf it so it finds all its libraries.
What is a bit difficult is installing it inside a Nix expression, since there’s this bash/GUI installer. I was wondering if there is a precedent for Nixifying this installer (which I think is called “mojo”).

Funnily enough this should be easier to achieve for Windows games, since you can use innoextract to obtain the game data without running the installer.

Not sure if it helps, but the Arch User Repository has some packages for installing GOG games on Arch Linux, maybe there are some tricks there you can use.

ping @aszlig who has done some work with packaging games with nix… IIRC.

GOG games come either via InnoSetup or a modified Makeself installer, which I believe is what you’re facing here. Here’s the setup hook we’re using in Vuizvui at the moment:

Alternatively, you could also use unzip since it will skip the shell script parts, but in this case you also need to ignore the exit status since it complains with extra bytes at beginning or within zipfile and exits with exit status 1.

Edit: Just decided to package the game.

4 Likes

Excellent, thanks for the snippet, explanation and context!