/starbound.nix Secret
Created
July 22, 2017 11:19
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
{ stdenv, requireFile, SDL2, makeWrapper, | |
mesa_glu, | |
unzip, maintainers }: | |
let | |
originalArchive = "gog_starbound_2.13.0.14.sh"; | |
in | |
stdenv.mkDerivation rec { | |
name = "starbound-${version}"; | |
version = "2.13.0.14"; | |
src = requireFile { | |
message = '' | |
Starbound is a proprietary game, and cannot be downloaded automatically. Please run | |
the following command to provide the game archive: | |
nix-store --add-fixed /path/to/${originalArchive} | |
''; | |
name = originalArchive; | |
sha256 = "1l2ff2hp9iyxwn2dqs1wc6x6lkhykh4jrqi4y3d4zarpzxmb5v2i"; | |
}; | |
phases = "unpackPhase installPhase"; | |
unpackCmd = "${unzip}/bin/unzip -qq $src || true"; | |
sourceRoot = "data"; | |
libPath = stdenv.lib.makeLibraryPath [ | |
mesa_glu | |
stdenv.cc.cc.lib | |
SDL2 | |
]; | |
buildInputs = [ | |
makeWrapper | |
]; | |
installPhase = '' | |
mkdir -p $out | |
mv noarch/game/* $out/ | |
mkdir -p $out/bin | |
chmod +x $out/linux/starbound | |
cat > $out/linux/sbinit.config << EOF | |
{ | |
"assetDirectories" : [ | |
"../assets/", | |
"../mods/" | |
], | |
"storageDirectory" : "/home/sven/.starbound-storage/" | |
} | |
EOF | |
patchelf \ | |
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ | |
$out/linux/starbound | |
for lib in linux/*.so{,.*}; do | |
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $lib | |
done | |
makeWrapper strace $out/bin/starbound-strace \ | |
--add-flags -f \ | |
--add-flags $out/linux/starbound \ | |
--prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$libPath:$out/linux | |
makeWrapper $out/linux/starbound $out/bin/starbound \ | |
--prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$libPath:$out/linux | |
''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment