Skip to content

Instantly share code, notes, and snippets.

@joepie91
Created July 22, 2017 11:19
Show Gist options
  • Save joepie91/5d48bde79fe93bec79082b15364f6f68 to your computer and use it in GitHub Desktop.
Save joepie91/5d48bde79fe93bec79082b15364f6f68 to your computer and use it in GitHub Desktop.
{ 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