about summary refs log tree commit diff
path: root/pkgs/games/itch/invisigun-heroes.nix
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2017-08-25 22:35:28 +0200
committeraszlig <aszlig@redmoonstudios.org>2017-08-25 22:35:28 +0200
commit490b4b47733a25dd953fc4d3326294c65a35b1e4 (patch)
treef31d71a7055c927b81e196551d2ff7d803957575 /pkgs/games/itch/invisigun-heroes.nix
parentcab045f4f50a3e80eedbdf8953e10cd53f029b43 (diff)
pkgs/games: Add Invisigun Heroes
This introduces support for fetching games from itch.io, because the
Humble Bundle version unfortunately only provides a Steam key and we
obviously don't want that.

I only played two levels, but so far it works as intended.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'pkgs/games/itch/invisigun-heroes.nix')
-rw-r--r--pkgs/games/itch/invisigun-heroes.nix55
1 files changed, 55 insertions, 0 deletions
diff --git a/pkgs/games/itch/invisigun-heroes.nix b/pkgs/games/itch/invisigun-heroes.nix
new file mode 100644
index 00000000..86350033
--- /dev/null
+++ b/pkgs/games/itch/invisigun-heroes.nix
@@ -0,0 +1,55 @@
+{ stdenv, fetchItch, unzip, mesa, xorg, libpulseaudio, libudev
+, gtk2-x11, gdk_pixbuf, glib
+}:
+
+stdenv.mkDerivation rec {
+  name = "invisigun-heroes-${version}";
+  version = "1.5.1";
+
+  src = fetchItch {
+    name = "${name}.zip";
+    gameId = 25561;
+    uploadId = 208583;
+    sha256 = "0k92xj3q7yv3pgsb992y0lxp59f1gkl12vw18qipsm1vby6b7j2s";
+  };
+
+  unpackCmd = ''
+    ${unzip}/bin/unzip -qq -d invisigun-heroes "$src" || :
+  '';
+
+  arch = if stdenv.system == "x86_64-linux" then "x86_64" else "x86";
+  executable = "Invisigun Heroes.${arch}";
+
+  buildPhase = let
+    rpath = stdenv.lib.makeLibraryPath [
+      stdenv.cc.cc mesa xorg.libX11 xorg.libXcursor xorg.libXrandr
+      libpulseaudio libudev
+    ];
+
+    ssRpath = stdenv.lib.makeLibraryPath [
+      stdenv.cc.cc gtk2-x11 gdk_pixbuf glib
+    ];
+  in ''
+    patchelf \
+      --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
+      --set-rpath ${stdenv.lib.escapeShellArg rpath} "$executable"
+
+    patchelf --set-rpath ${stdenv.lib.escapeShellArg ssRpath} \
+      "Invisigun Heroes_Data/Plugins/x86_64/ScreenSelector.so"
+  '';
+
+  installPhase = ''
+    install -vD "$executable" "$out/libexec/invisigun-heroes/invisigun-heroes"
+    ln -s "$out/share/invisigun-heroes" "$out/libexec/invisigun-heroes/Data"
+
+    mkdir -p "$out/bin"
+    ln -s "$out/libexec/invisigun-heroes/invisigun-heroes" \
+          "$out/bin/invisigun-heroes"
+
+    mkdir -p "$out/share"
+    cp -vRd "Invisigun Heroes_Data" "$out/share/invisigun-heroes"
+  '';
+
+  dontStrip = true;
+  dontPatchELF = true;
+}