about summary refs log tree commit diff
path: root/pkgs/games/humblebundle
diff options
context:
space:
mode:
authorsternenseemann <git@lukasepple.de>2016-09-05 22:34:42 +0200
committersternenseemann <git@lukasepple.de>2016-09-05 22:36:57 +0200
commit4fca46cfcfd9c80f8beb76d053e157d5c31ddcd4 (patch)
treefcc4041e7cd9b9f0ec8032ab47116d0d67398aee /pkgs/games/humblebundle
parentcf1e355dff0577b99bd017e5b16a58e74cf9813f (diff)
pkgs/games/humblebundle: add pico-8
Not really a game but a emulator of an imaginary console, so close
enough.

This package uses the dynamically linked pico-8 version, the (probably)
statically linked one had an inexplicable issue with SDL.
Diffstat (limited to 'pkgs/games/humblebundle')
-rw-r--r--pkgs/games/humblebundle/default.nix1
-rw-r--r--pkgs/games/humblebundle/pico-8.nix45
2 files changed, 46 insertions, 0 deletions
diff --git a/pkgs/games/humblebundle/default.nix b/pkgs/games/humblebundle/default.nix
index 1c1e7a21..e1c7c0e1 100644
--- a/pkgs/games/humblebundle/default.nix
+++ b/pkgs/games/humblebundle/default.nix
@@ -21,6 +21,7 @@ let
     jamestown = callPackage ./jamestown.nix {};
     liads = callPackage ./liads.nix {};
     megabytepunch = callPackage ./megabytepunch.nix {};
+    pico-8 = callPackage ./pico-8.nix {};
     rocketbirds = callPackage ./rocketbirds.nix {};
     spaz = callPackage ./spaz.nix {};
     starbound = callPackage ./starbound.nix {};
diff --git a/pkgs/games/humblebundle/pico-8.nix b/pkgs/games/humblebundle/pico-8.nix
new file mode 100644
index 00000000..e54e3302
--- /dev/null
+++ b/pkgs/games/humblebundle/pico-8.nix
@@ -0,0 +1,45 @@
+{ stdenv, fetchHumbleBundle, SDL2, unzip }:
+
+stdenv.mkDerivation rec {
+  name = "pico-8-${version}";
+  version = "0.1.8";
+
+  src = fetchHumbleBundle {
+    name = "pico8_linux";
+    machineName = "pico8_linux";
+    downloadName = {
+      "x86_64-linux" = "64-bit";
+      "i686-linux"   = "32-bit";
+    }.${stdenv.system};
+    md5 = "5866cf247c3390011fb4e84092c3ac8e";
+  };
+
+  unpackCmd = ''
+    ${unzip}/bin/unzip -qq -d . "$src" || :
+  '';
+
+  phases = [ "unpackPhase" "buildPhase" "installPhase" ];
+
+  buildPhase = let
+    rpath = stdenv.lib.makeLibraryPath [
+      stdenv.cc.cc SDL2
+    ];
+  in ''
+    patchelf \
+      --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
+      --set-rpath "${rpath}" pico8_dyn
+  '';
+
+  installPhase = ''
+    install -vD pico8_dyn "$out/share/pico8"
+    install -vD pico8.dat "$out/share/pico8.dat"
+    install -vD pico-8.txt "$out/share/pico-8.txt"
+    install -vD license.txt "$out/share/license.txt"
+    install -vD lexaloffle-pico8.png "$out/share/lexaloffle-pico8.png"
+
+    mkdir -p "$out/bin"
+    ln -s "$out/share/pico8" "$out/bin/pico8"
+  '';
+
+  dontPatchELF = true;
+}