nixpkgs/pkgs/games/uqm/3dovideo.nix

65 lines
2 KiB
Nix
Raw Normal View History

{ stdenv, requireFile, writeText, fetchgit, 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; cabal.mkDerivation (self: {
pname = "uqm3donix";
version = "0.1.0.0";
src = fetchgit {
url = "git://github.com/aszlig/uqm3donix.git";
rev = "c4e43b0d2eeb15e4caa93b0ddcf6b886d1cdaf8f";
sha256 = "15vkgqsnwqn758nb3b55gbk5fw49lakax344sj9gvkpn8vxjn10y";
};
isLibrary = false;
isExecutable = true;
buildDepends = [ binary filepath tar ];
meta = {
description = "Extract video files from a Star Control II 3DO image";
license = self.stdenv.lib.licenses.bsd3;
platforms = self.ghc.meta.platforms;
};
});
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"
'';
}