From 29317e9fb753cc1cb3cb6ce7405f0a435639b594 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Tue, 19 Jun 2018 14:06:58 +0200 Subject: [PATCH] Update and add some games --- packages/epic-pinball/default.nix | 39 +++++++++++++++ packages/prison-architect/default.nix | 60 ++++++++++++++++++++++ packages/rimworld/default.nix | 72 +++++++++++++++++++++++++++ packages/starbound/default.nix | 28 +++++++++-- packages/stardew-valley/default.nix | 12 +++-- 5 files changed, 202 insertions(+), 9 deletions(-) create mode 100644 packages/epic-pinball/default.nix create mode 100644 packages/prison-architect/default.nix create mode 100644 packages/rimworld/default.nix diff --git a/packages/epic-pinball/default.nix b/packages/epic-pinball/default.nix new file mode 100644 index 0000000..eca6726 --- /dev/null +++ b/packages/epic-pinball/default.nix @@ -0,0 +1,39 @@ +{ stdenv, pkgs, dosbox, unzip, ... }: + +let + fetchfile = (import ../../lib/fetchfile.nix) { inherit stdenv pkgs; }; +in + stdenv.mkDerivation { + name = "epic-pinball"; + + src = fetchfile { + path = ../../../nixrc-src-games/epic_pinball_the_complete_collection_en_1_0_16760.sh; + storeHash = "64545yf8d203lgk5jv5bqbnyh7xpblmb"; + }; + + phases = "unpackPhase installPhase"; + + unpackCmd = "${unzip}/bin/unzip -qq $src || true"; + + sourceRoot = "data"; + + installPhase = '' + mkdir -p $out + mv noarch/*.conf $out/ + mv noarch/data $out/data + mkdir -p $out/bin + + cat < $out/bin/epic-pinball + #!${stdenv.shell} + ${dosbox}/bin/dosbox -conf "$out/dosbox_epin.conf" -conf "$out/dosbox_epin_single.conf" -conf "$out/sven.conf" -no-console -c exit + EOF + + cat < $out/sven.conf + [sdl] + fullscreen=false + output=openglnb + EOF + + chmod +x $out/bin/epic-pinball + ''; + } diff --git a/packages/prison-architect/default.nix b/packages/prison-architect/default.nix new file mode 100644 index 0000000..5394cb7 --- /dev/null +++ b/packages/prison-architect/default.nix @@ -0,0 +1,60 @@ +{ stdenv, pkgs, requireFile, SDL2, makeWrapper, + mesa_glu, alsaLib, + unzip, strace, ... }: + +let + originalArchive = "gog_prison_architect_2.18.0.20.sh"; + fetchfile = (import ../../lib/fetchfile.nix) { inherit stdenv pkgs; }; +in + stdenv.mkDerivation rec { + name = "prison-architect-${version}"; + version = "2.18.0.20"; + + src = fetchfile { + path = ../../../nixrc-src-games/gog_prison_architect_2.18.0.20.sh; + storeHash = "i2sl8hc5aaay2gw371zr0hpjdh6gw7ns"; + }; + + phases = "unpackPhase installPhase"; + + unpackCmd = "${unzip}/bin/unzip -qq $src || true"; + + sourceRoot = "data"; + + libPath = stdenv.lib.makeLibraryPath [ + mesa_glu + alsaLib + stdenv.cc.cc.lib + SDL2 + ]; + + buildInputs = [ + makeWrapper + ]; + + installPhase = '' + mkdir -p $out + mv noarch/game/* $out/ + mkdir -p $out/bin + + chmod +x $out/PrisonArchitect.x86_64 + + patchelf \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ + $out/PrisonArchitect.x86_64 + + #for lib in linux/*.so{,.*}; do + # patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $lib + #done + + makeWrapper ${strace}/bin/strace $out/bin/prison-architect-strace \ + --add-flags -f \ + --add-flags $out/PrisonArchitect.x86_64 \ + --set SDL_AUDIODRIVER alsa \ + --prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$libPath + + makeWrapper $out/PrisonArchitect.x86_64 $out/bin/prison-architect \ + --set SDL_AUDIODRIVER alsa \ + --prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$libPath + ''; + } diff --git a/packages/rimworld/default.nix b/packages/rimworld/default.nix new file mode 100644 index 0000000..3fbc3b3 --- /dev/null +++ b/packages/rimworld/default.nix @@ -0,0 +1,72 @@ +{ + stdenv, pkgs, requireFile, makeWrapper, + libX11, libXext, libXcursor, libXrandr, + alsaLib, mesa_glu, libudev, unzip, mods, ... +}: + let + fetchfile = (import ../../lib/fetchfile.nix) { inherit stdenv pkgs; }; + buildNumber = "1722"; + in + stdenv.mkDerivation rec { + name = "rimworld-${version}"; + version = "alpha-18"; + + MODLIST = mods; + + src = fetchfile { + path = ../../../nixrc-src-games/RimWorldBeta18Linux.zip; + storeHash = "gxff7zx0dwfr2gbj8y3wqn1by8a22dmz"; + }; + + phases = "unpackPhase installPhase"; + + unpackCmd = "${unzip}/bin/unzip -qq $src || true"; + + libPath = stdenv.lib.makeLibraryPath [ + alsaLib + mesa_glu + libX11 + libXext + libXcursor + libXrandr + libudev + stdenv.cc.cc.lib + ]; + + buildInputs = [ + makeWrapper + ]; + + installPhase = '' + mkdir -p $out + mv * $out/ + + chmod +x $out/start_RimWorld.sh + chmod +x $out/start_RimWorld_openglfix.sh + chmod +x $out/RimWorld${buildNumber}Linux.x86_64 + chmod +x $out/RimWorld${buildNumber}Linux.x86 + + for modPath in $MODLIST + do + echo "Installing mod from $modPath..." + ${unzip}/bin/unzip "$modPath" -d "$out/Mods/" + done + + patchelf \ + --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ + $out/RimWorld${buildNumber}Linux.x86_64 + + #wrapProgram $out/RimWorld${buildNumber}Linux.x86_64 \ + # --prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$libPath + + mkdir -p $out/bin + + makeWrapper $out/RimWorld${buildNumber}Linux.x86_64 $out/bin/rimworld \ + --add-flags -logfile \ + --add-flags /tmp/rimworld_log \ + --prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:$libPath + + patchShebangs $out/start_RimWorld.sh + patchShebangs $out/start_RimWorld_openglfix.sh + ''; + } diff --git a/packages/starbound/default.nix b/packages/starbound/default.nix index 1ae397f..a4aef60 100644 --- a/packages/starbound/default.nix +++ b/packages/starbound/default.nix @@ -1,15 +1,22 @@ -{ stdenv, requireFile, SDL2, makeWrapper, - mesa_glu, - unzip, ... }: +{ 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 = ../../../nixrc-src-games/gog_starbound_2.13.0.14.sh; + src = fetchfile { + path = ../../../nixrc-src-games/gog_starbound_2.13.0.14.sh; + storeHash = "y9q03x9n467wh90wn228716kznx8mygx"; + }; phases = "unpackPhase installPhase"; @@ -21,6 +28,10 @@ in mesa_glu stdenv.cc.cc.lib SDL2 + libSM + libICE + libX11 + libXext ]; buildInputs = [ @@ -45,6 +56,13 @@ in } 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 @@ -53,7 +71,7 @@ in patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $lib done - makeWrapper strace $out/bin/starbound-strace \ + 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 diff --git a/packages/stardew-valley/default.nix b/packages/stardew-valley/default.nix index bb417a9..f951151 100644 --- a/packages/stardew-valley/default.nix +++ b/packages/stardew-valley/default.nix @@ -1,18 +1,22 @@ -{ stdenv, requireFile, SDL2, makeWrapper, mono44, +{ stdenv, pkgs, requireFile, SDL2, makeWrapper, mono44, libX11, libXext, libXcursor, libXxf86vm, libXi, libXinerama, libXrandr, libgcrypt, libgpgerror, alsaLib, libpulseaudio, libogg, libvorbis, mesa_glu, libudev, lzma, dbus, - unzip, ... }: + unzip, strace, ... }: let originalArchive = "gog_stardew_valley_2.6.0.7.sh"; + fetchfile = (import ../../lib/fetchfile.nix) { inherit stdenv pkgs; }; 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; + src = fetchfile { + path = ../../../nixrc-src-games/gog_stardew_valley_2.6.0.7.sh; + storeHash = "llm002l2zsqfnw4rldkn1w5qnzz7xcfr"; + }; phases = "unpackPhase installPhase"; @@ -69,7 +73,7 @@ in patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $lib done - makeWrapper strace $out/stardew-valley-strace \ + makeWrapper ${strace}/bin/strace $out/stardew-valley-strace \ --run 'cd "`dirname "$0"`"' \ --add-flags -f \ --add-flags $out/StardewValley.bin.x86_64 \