about summary refs log tree commit diff
path: root/humblebundle/spaz.nix
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2014-12-31 13:07:17 +0100
committeraszlig <aszlig@redmoonstudios.org>2014-12-31 13:08:32 +0100
commit72dc6e15cb97e03151b2929858fed3c46edcff5e (patch)
tree73a5ce2493bf775b76008653622abc8da1d8397b /humblebundle/spaz.nix
parent987d7bcad86901f304ca932e54fe4104ad40dfc6 (diff)
Move everything into /humblebundle/.
We don't just want HumbleBundle games, so let's try to keep the
directory structure that way very early.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'humblebundle/spaz.nix')
-rw-r--r--humblebundle/spaz.nix39
1 files changed, 39 insertions, 0 deletions
diff --git a/humblebundle/spaz.nix b/humblebundle/spaz.nix
new file mode 100644
index 00000000..7ba028d9
--- /dev/null
+++ b/humblebundle/spaz.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchHumbleBundle, unzip, pkgsi686Linux }:
+
+stdenv.mkDerivation rec {
+  name = "spaz-${version}";
+  version = "09182012";
+
+  src = fetchHumbleBundle {
+    name = "spaz-linux-humblebundle-${version}-bin";
+    md5 = "9b2f28009949f2dff9f3a737e46fabfd";
+  };
+
+  buildInputs = [ pkgsi686Linux.makeWrapper ];
+
+  unpackCmd = ''
+    ${unzip}/bin/unzip -qq "$src" 'data/*' || true
+  '';
+
+  dontStrip = true;
+
+  buildPhase = let
+    libs = pkgsi686Linux.stdenv.lib.makeLibraryPath [
+      pkgsi686Linux.stdenv.cc.gcc pkgsi686Linux.SDL
+    ];
+  in ''
+    patchelf --set-interpreter "${pkgsi686Linux.glibc}"/lib/ld-linux.so.* \
+             --set-rpath "${libs}" SPAZ
+  '';
+
+  installPhase = let
+    libs = pkgsi686Linux.stdenv.lib.makeLibraryPath [
+      pkgsi686Linux.mesa pkgsi686Linux.openal pkgsi686Linux.alsaPlugins
+    ];
+  in ''
+    install -vD SPAZ "$out/libexec/spaz/spaz"
+    cp -rt "$out/libexec/spaz" audio.so common game mods
+    makeWrapper "$out/libexec/spaz/spaz" "$out/bin/spaz" \
+      --set LD_LIBRARY_PATH "${libs}"
+  '';
+}