{ stdenv, pkgs, requireFile, SDL2, makeWrapper, mesa_glu, libSM, libICE, libX11, libXext, unzip, strace, mods ? [], ... }: let originalArchive = "gog_starbound_2.13.0.14.sh"; fetchfile = (import ../../lib/fetchfile.nix) { inherit stdenv pkgs; }; listToBashArray = import ../../lib/list-to-bash-array.nix; #modArray = listToBashArray { name = "modList"; args = builtins.trace mods mods; }; in stdenv.mkDerivation rec { name = "starbound-${version}"; version = "2.13.0.14"; MODLIST = mods; src = fetchfile { path = ../../../nixrc-src-games/gog_starbound_2.13.0.14.sh; storeHash = "y9q03x9n467wh90wn228716kznx8mygx"; }; phases = "unpackPhase installPhase"; unpackCmd = "${unzip}/bin/unzip -qq $src || true"; sourceRoot = "data"; libPath = stdenv.lib.makeLibraryPath [ mesa_glu stdenv.cc.cc.lib SDL2 libSM libICE libX11 libXext ]; 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 for modPath in $MODLIST do echo "$modPath" ${unzip}/bin/unzip "$modPath" -d "$out/mods/" #cp -v "$modPath" "$out/mods/" done 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}/bin/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 ''; }