summary refs log tree commit diff
path: root/pkgs/games/uqm/3dovideo.nix
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2015-05-07 07:56:03 +0200
committeraszlig <aszlig@redmoonstudios.org>2015-05-07 08:03:06 +0200
commitc7e7f12ef679f53a76e811d3e047d97fd34331ea (patch)
tree594cca7d8b8458262a95a719e2e0e0fb72bbfec1 /pkgs/games/uqm/3dovideo.nix
parent5454be28aa919032fbf0a4f3c13891e36750d44b (diff)
downloadnixpkgs-c7e7f12ef679f53a76e811d3e047d97fd34331ea.tar
nixpkgs-c7e7f12ef679f53a76e811d3e047d97fd34331ea.tar.gz
nixpkgs-c7e7f12ef679f53a76e811d3e047d97fd34331ea.tar.bz2
nixpkgs-c7e7f12ef679f53a76e811d3e047d97fd34331ea.tar.lz
nixpkgs-c7e7f12ef679f53a76e811d3e047d97fd34331ea.tar.xz
nixpkgs-c7e7f12ef679f53a76e811d3e047d97fd34331ea.tar.zst
nixpkgs-c7e7f12ef679f53a76e811d3e047d97fd34331ea.zip
uqm: Bring back package and fix 3do extractor.
It was dropped in 324719a5a611501d7b54e14f205465f5da1242b1.

The UQM package itself doesn't require Haskell, but in order to extract
contents from the 3do version of the game, we need to have a small
helper utility which I wrote in Haskell a while ago. In order to switch
it to Haskell NG, only very minor modifications were necessary, which
are now done with this commit instead of dropping the whole game.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'pkgs/games/uqm/3dovideo.nix')
-rw-r--r--pkgs/games/uqm/3dovideo.nix60
1 files changed, 60 insertions, 0 deletions
diff --git a/pkgs/games/uqm/3dovideo.nix b/pkgs/games/uqm/3dovideo.nix
new file mode 100644
index 00000000000..ca5a1197a32
--- /dev/null
+++ b/pkgs/games/uqm/3dovideo.nix
@@ -0,0 +1,60 @@
+{ stdenv, requireFile, writeText, fetchurl, haskellPackages }:
+
+with stdenv.lib;
+
+let
+  makeSpin = num: let
+    padded = (optionalString (lessThan num 10) "0") + toString num;
+  in "slides.spins.${padded} = 3DOVID:" +
+     "addons/3dovideo/spins/ship${padded}.duk:" +
+     "addons/3dovideo/spins/spin.aif:" +
+     "addons/3dovideo/spins/ship${padded}.aif:89";
+
+  videoRMP = writeText "3dovideo.rmp" (''
+    slides.ending = 3DOVID:addons/3dovideo/ending/victory.duk
+    slides.intro = 3DOVID:addons/3dovideo/intro/intro.duk
+  '' + concatMapStrings makeSpin (range 0 24));
+
+  helper = with haskellPackages; mkDerivation {
+    pname = "uqm3donix";
+    version = "0.1.0.0";
+
+    src = fetchurl {
+      url = "https://github.com/aszlig/uqm3donix/archive/v0.1.0.0.tar.gz";
+      sha256 = "0d40gpc3bqkw68varjxwgbdzxw0dvwqksijmvij5ixmlcspbjgvb";
+    };
+
+    isLibrary = false;
+    isExecutable = true;
+
+    buildDepends = [ base binary bytestring filepath tar ];
+
+    description = "Extract video files from a Star Control II 3DO image";
+    license = stdenv.lib.licenses.bsd3;
+  };
+
+in stdenv.mkDerivation {
+  name = "uqm-3dovideo";
+
+  src = requireFile rec {
+    name = "videos.tar";
+    sha256 = "044h0cl69r0kc43vk4n0akk0prwzb7inq324h5yfqb38sd4zkds1";
+    message = ''
+      In order to get the intro and ending sequences from the 3DO version, you
+      need to have the original 3DO Star Control II CD. Create an image from the
+      CD and use uqm3donix* to extract a tarball with the videos from it. The
+      reason for this is because the 3DO uses its own proprietary disk format.
+
+      Save the file as videos.tar and use "nix-prefetch-url file://${name}" to
+      add it to the Nix store.
+
+      [*] ${helper}/bin/uqm3donix CDIMAGE ${name}
+    '';
+  };
+
+  buildCommand = ''
+    mkdir -vp "$out"
+    tar xf "$src" -C "$out" --strip-components=3
+    cp "${videoRMP}" "$out/3dovideo.rmp"
+  '';
+}