Last active
January 19, 2020 01:49
-
-
Save Profpatsch/899ea8f9afe7d1912ac83a199a4cfea7 to your computer and use it in GitHub Desktop.
Pillars of Eternity on nixos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
read -r -d '' NIXEXPR <<EOF | |
with import <nixpkgs> {}; | |
runCommand "foo" {} '' | |
mkdir \$out | |
echo "\${lib.makeLibraryPath [ mesa xorg.libX11 xorg.libXext xorg.libXcursor xorg.libXrandr pkgsi686Linux.alsaPlugins libpulseaudio stdenv.cc.cc.lib ]}" > \$out/path | |
cp \$NIX_CC/nix-support/dynamic-linker \$out/ld | |
'' | |
EOF | |
f=$(nix-build -E "$NIXEXPR") | |
if [[ -z "$f" ]]; then | |
echo "could not build nixexpr" | |
exit 1 | |
fi | |
exe=./game/PillarsOfEternity | |
patchelfPath="$(nix-build -A patchelf '<nixpkgs>')" | |
patchelf="$patchelfPath/bin/patchelf" | |
if [[ -z "$patchelfPath" ]]; then | |
echo "could not build patchelf" | |
exit 1 | |
fi | |
oldinterpr=$($patchelf --print-interpreter "$exe") | |
newinterpr=$(cat "$f/ld") | |
if [[ "$oldinterpr" != "$newinterpr" ]]; then | |
echo "patching $exe from $oldinterpr to $newinterpr" | |
$patchelf --set-interpreter "$newinterpr" "$exe" | |
fi | |
LPATH=$(cat "$f/path") | |
env LD_LIBRARY_PATH=$LPATH bash start.sh |
Will this technically work with any Unity-produced Linux executable? (Changing the executable name on line 18, of course)
$NIX_CC
seems empty, and I don't know why
@dpc replace runCommand
with runCommandCC
then it should work again.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Put into the extracted folder and run with bash.
Will install the needed dynamic libraries, patch the linker into the binary and run it with the correct library paths.