You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
2.8 KiB
Nix

{ stdenv, requireFile, SDL2, makeWrapper, mono44,
libX11, libXext, libXcursor, libXxf86vm, libXi, libXinerama, libXrandr,
libgcrypt, libgpgerror,
alsaLib, libpulseaudio, libogg, libvorbis,
mesa_glu, libudev, lzma, dbus,
unzip, ... }:
let
originalArchive = "gog_stardew_valley_2.6.0.7.sh";
in
stdenv.mkDerivation rec {
name = "stardew-valley-${version}";
version = "2.6.0.7";
src = ../../../nixrc-src-games/gog_stardew_valley_2.6.0.7.sh;
phases = "unpackPhase installPhase";
unpackCmd = "${unzip}/bin/unzip -qq $src || true";
sourceRoot = "data";
libPath = stdenv.lib.makeLibraryPath [
alsaLib
libpulseaudio
mesa_glu
libX11
libXext
libXcursor
libXxf86vm
libXi
libXinerama
libXrandr
libgcrypt
libgpgerror
libudev
libogg
libvorbis
lzma
dbus
mono44
stdenv.cc.cc.lib
SDL2
];
buildInputs = [
makeWrapper
];
installPhase = ''
mkdir -p $out
mv noarch/game/* $out/
mkdir -p $out/bin
chmod +x $out/StardewValley.bin.x86
chmod +x $out/StardewValley.bin.x86_64
ln -sf ${mono44}/bin/mcs $out/mcs
patchelf \
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
$out/StardewValley.bin.x86_64
patchelf \
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
$out/StardewValley.bin.x86
for lib in lib{,64}/*.so.*; do
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $lib
done
makeWrapper strace $out/stardew-valley-strace \
--run 'cd "`dirname "$0"`"' \
--add-flags -f \
--add-flags $out/StardewValley.bin.x86_64 \
--prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$libPath
makeWrapper $out/StardewValley.bin.x86_64 $out/stardew-valley \
--run 'cd "`dirname "$0"`"' \
--prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$libPath
makeWrapper $out/StardewValley.bin.x86 $out/stardew-valley-32 \
--run 'cd "`dirname "$0"`"' \
--prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$libPath
echo "cd $out; pwd; ./stardew-valley" > $out/bin/stardew-valley
chmod +x $out/bin/stardew-valley
echo "cd $out; pwd; ./stardew-valley-32" > $out/bin/stardew-valley-32
chmod +x $out/bin/stardew-valley-32
echo "cd $out; pwd; ./stardew-valley-strace" > $out/bin/stardew-valley-strace
chmod +x $out/bin/stardew-valley-strace
'';
}