···1+{ stdenv, requireFile, SDL }:
2+3+stdenv.mkDerivation rec {
4+ name = "vessel-12082012";
5+6+ goBuyItNow = ''
7+ We cannot download the full version automatically, as you require a license.
8+ Once you bought a license, you need to add your downloaded version to the nix store.
9+ You can do this by using "nix-prefetch-url file://${name}-bin" in the
10+ directory where you saved it.
11+ '';
12+13+ src = if (stdenv.isi686) then
14+ requireFile {
15+ message = goBuyItNow;
16+ name = "${name}-bin";
17+ sha256 = "1vpwcrjiln2mx43h7ib3jnccyr3chk7a5x2bw9kb4lw8ycygvg96";
18+ } else throw "unsupported platform ${stdenv.s:ystem} only i686-linux supported for now.";
19+20+ phases = "installPhase";
21+ ld_preload = ./isatty.c;
22+23+ libPath = stdenv.lib.makeLibraryPath [ stdenv.gcc.gcc stdenv.gcc.libc ]
24+ + ":" + stdenv.lib.makeLibraryPath [ SDL ] ;
25+26+ installPhase = ''
27+ ensureDir $out/libexec/strangeloop/vessel/
28+ ensureDir $out/bin
29+30+ # allow scripting of the mojoinstaller
31+ gcc -fPIC -shared -o isatty.so $ld_preload
32+33+ echo @@@
34+ echo @@@ this next step appears to hang for a while
35+ echo @@@
36+37+ # if we call ld.so $(bin) we don't need to set the ELF interpreter, and save a patchelf step.
38+ LD_PRELOAD=./isatty.so $(cat $NIX_GCC/nix-support/dynamic-linker) $src << IM_A_BOT
39+ n
40+ $out/libexec/strangeloop/vessel/
41+ IM_A_BOT
42+43+ # use nix SDL libraries
44+ rm $out/libexec/strangeloop/vessel/x86/libSDL*
45+ rm $out/libexec/strangeloop/vessel/x86/libstdc++*
46+47+ # props to Ethan Lee (the Vessel porter) for understanding
48+ # how $ORIGIN works in rpath. There is hope for humanity.
49+ patchelf \
50+ --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
51+ --set-rpath $libPath:$out/libexec/strangeloop/vessel/x86/ \
52+ $out/libexec/strangeloop/vessel/x86/vessel.x86
53+54+ cat > $out/bin/Vessel << EOW
55+ #!/bin/sh
56+ cd $out/libexec/strangeloop/vessel/
57+ exec ./x86/vessel.x86
58+ EOW
59+60+ chmod +x $out/bin/Vessel
61+ '';
62+63+ meta = {
64+ description = "A fluid physics based puzzle game";
65+ longDescription = ''
66+ Living liquid machines have overrun this world of unstoppable progress,
67+ and it is the role of their inventor, Arkwright, to stop the chaos they are
68+ causing. Vessel is a game about a man with the power to bring ordinary matter
69+ to life, and all the consequences that ensue.
70+ '';
71+ homepage = http://www.strangeloopgames.com;
72+ license = [ "unfree" ];
73+ maintainers = with stdenv.lib.maintainers; [ jcumming ];
74+ platforms = [ "i686-linux"] ;
75+ };
76+77+}
+6
pkgs/games/vessel/isatty.c
···000000
···1+// We override isatty to help 'automate' installers.
2+3+// Some installers (mojoinstall) have a stdio GUI that refuses to run if you
4+// feed it a file on stdin. This should help that.
5+6+int isatty(int fd) { return 1; }