summary refs log tree commit diff
path: root/pkgs/games
diff options
context:
space:
mode:
authorCarles Pagès <page@cubata.homelinux.net>2012-12-27 12:01:07 +0100
committerEvgeny Egorochkin <phreedom@yandex.ru>2013-08-10 06:08:16 +0300
commitb07300f2ef3cee6b8718fa2fd0360a60d32e5924 (patch)
tree4f154e01aa2badfb625dde2b8c22519970659eec /pkgs/games
parentdad0ed4eaaac01a0d374a3b854c99145d9815e3b (diff)
downloadnixlib-b07300f2ef3cee6b8718fa2fd0360a60d32e5924.tar
nixlib-b07300f2ef3cee6b8718fa2fd0360a60d32e5924.tar.gz
nixlib-b07300f2ef3cee6b8718fa2fd0360a60d32e5924.tar.bz2
nixlib-b07300f2ef3cee6b8718fa2fd0360a60d32e5924.tar.lz
nixlib-b07300f2ef3cee6b8718fa2fd0360a60d32e5924.tar.xz
nixlib-b07300f2ef3cee6b8718fa2fd0360a60d32e5924.tar.zst
nixlib-b07300f2ef3cee6b8718fa2fd0360a60d32e5924.zip
steam: bypass valve's bootstrapper.
Since there is no way to modify either steam.sh or the steam binary as they are
hash checked, I took the approach of bypassing steam.sh and create a script
that does its job.

For now it segfaults, but when I try to run under strace, it works perfectly.
Need to check this.
Diffstat (limited to 'pkgs/games')
-rw-r--r--pkgs/games/steam/default.nix42
1 files changed, 30 insertions, 12 deletions
diff --git a/pkgs/games/steam/default.nix b/pkgs/games/steam/default.nix
index 63f820bbe00b..b003fc8eb478 100644
--- a/pkgs/games/steam/default.nix
+++ b/pkgs/games/steam/default.nix
@@ -2,6 +2,9 @@
 , libselinux, libXrandr, pango, freetype, fontconfig, glib, gtk
 , gdk_pixbuf, cairo, libXi, alsaLib, libXrender, nss, nspr, zlib
 , dbus, libpng12, libXfixes, cups, libgcrypt, openal, pulseaudio
+, SDL # World of Goo
+, libvorbis # Osmos
+, curl # Superbrothers: S&S EP
 , patchelf }:
 
 assert stdenv.system == "i686-linux";
@@ -13,7 +16,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "http://media.steampowered.com/client/installer/steam.deb";
-    sha256 = "0mx92f9hjjpg3blgmgp8sz0f3jg7m9hssdscipwybks258k8926m";
+    sha256 = "1gzfyh3wfdb4h7cxibx61c31l8pjz5zcp5d9d5w9jyja463lv49c";
   };
 
   buildInputs = [ dpkg makeWrapper ];
@@ -29,22 +32,37 @@ stdenv.mkDerivation rec {
     substituteInPlace "$out/bin/steam" --replace "/usr/" "$out/"
     substituteInPlace "$out/bin/steam" --replace "\`basename \$0\`" "steam"
     sed -i '/jockey-common/d' $out/bin/steam
-    wrapProgram "$out/bin/steam" \
-      --prefix PATH ":" "${xz}/bin" \
-      --prefix LD_LIBRARY_PATH : ${libX11}/lib:${gcc.gcc}/lib:${glibc215}/lib:${libselinux}/lib:${libXrandr}/lib:${pango}/lib:${freetype}/lib:${fontconfig}/lib:${glib}/lib:${gtk}/lib:${gdk_pixbuf}/lib:${cairo}/lib:${libXi}/lib:${alsaLib}/lib:${libXrender}/lib:${nss}/lib:${nspr}/lib:${zlib}/lib:${dbus}/lib:${libpng12}/lib:${libXfixes}/lib:${cups}/lib:${libgcrypt}/lib:${openal}/lib:${pulseaudio}/lib
 
-    mkdir -p $out/patches
-    cat > $out/patches/post-install.sh << EOF
+    mv $out/bin/steam $out/bin/.steam-wrapped
+    cat > $out/bin/steam << EOF
     #!${stdenv.shell}
 
-    # post-install script to patch stuff at \$HOME
-    PATH=\$PATH:${patchelf}/bin
-    sed -i 's/bash/sh/' \$HOME/.local/share/Steam/steam.sh
-    patchelf --set-interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
-        \$HOME/.local/share/Steam/ubuntu12_32/steam
+    export PATH=${xz}/bin:\$PATH
+    export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:${libX11}/lib:${gcc.gcc}/lib:${glibc215}/lib:${libselinux}/lib:${libXrandr}/lib:${pango}/lib:${freetype}/lib:${fontconfig}/lib:${glib}/lib:${gtk}/lib:${gdk_pixbuf}/lib:${cairo}/lib:${libXi}/lib:${alsaLib}/lib:${libXrender}/lib:${nss}/lib:${nspr}/lib:${zlib}/lib:${dbus}/lib:${libpng12}/lib:${libXfixes}/lib:${cups}/lib:${libgcrypt}/lib:${openal}/lib:${pulseaudio}/lib:${SDL}/lib:${libvorbis}/lib:${curl}/lib
+    STEAMBOOTSTRAP=\$HOME/.steam/steam/steam.sh
+    if [ -f \$STEAMBOOTSTRAP ]; then
+      STEAMCONFIG=~/.steam
+      STEAMROOT="\$STEAMCONFIG/steam"
+      STEAMBINDIR="\$STEAMROOT/ubuntu12_32"
+      PIDFILE="\$STEAMCONFIG/steam.pid"
+      STEAMRUNCMD="\$STEAMCONFIG/runcmd"
+      STEAMBIN32LINK="\$STEAMCONFIG/bin32"
+      STEAMBIN64LINK="\$STEAMCONFIG/bin64"
+      STEAMROOTLINK="\$STEAMCONFIG/root"
+      STEAMSTARTING="\$STEAMCONFIG/starting"
+      export LD_LIBRARY_PATH="\$STEAMBINDIR:\$LD_LIBRARY_PATH"
+      export SDL_VIDEO_X11_DGAMOUSE=0
+      cd "\$STEAMROOT"
+      cp ${glibc215}/lib/ld-linux.so.2 "\$STEAMBINDIR"
+      chmod u+w "\$STEAMBINDIR/ld-linux.so.2"
+      echo \$\$ > "\$PIDFILE" # pid of the shell will become pid of steam
+      exec "\$STEAMBINDIR/ld-linux.so.2" "\$STEAMBINDIR/steam"
+    else
+      exec $out/bin/.steam-wrapped
+    fi
     EOF
 
-    chmod +x $out/patches/post-install.sh
+    chmod +x $out/bin/steam
   '';
 
   meta = {