From d1254fa27ec31f9d96f189b444cfa684efa2ba0c Mon Sep 17 00:00:00 2001 From: Jack Cummings Date: Sun, 16 Dec 2012 23:24:31 -0800 Subject: [PATCH] add Vessel, a fluid physics puzzle game. --- pkgs/games/vessel/default.nix | 77 +++++++++++++++++++++++++++++++++ pkgs/games/vessel/isatty.c | 6 +++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 85 insertions(+) create mode 100644 pkgs/games/vessel/default.nix create mode 100644 pkgs/games/vessel/isatty.c diff --git a/pkgs/games/vessel/default.nix b/pkgs/games/vessel/default.nix new file mode 100644 index 000000000000..24fc759762a2 --- /dev/null +++ b/pkgs/games/vessel/default.nix @@ -0,0 +1,77 @@ +{ stdenv, requireFile, SDL }: + +stdenv.mkDerivation rec { + name = "vessel-12082012"; + + goBuyItNow = '' + We cannot download the full version automatically, as you require a license. + Once you bought a license, you need to add your downloaded version to the nix store. + You can do this by using "nix-prefetch-url file://${name}-bin" in the + directory where you saved it. + ''; + + src = if (stdenv.isi686) then + requireFile { + message = goBuyItNow; + name = "${name}-bin"; + sha256 = "1vpwcrjiln2mx43h7ib3jnccyr3chk7a5x2bw9kb4lw8ycygvg96"; + } else throw "unsupported platform ${stdenv.s:ystem} only i686-linux supported for now."; + + phases = "installPhase"; + ld_preload = ./isatty.c; + + libPath = stdenv.lib.makeLibraryPath [ stdenv.gcc.gcc stdenv.gcc.libc ] + + ":" + stdenv.lib.makeLibraryPath [ SDL ] ; + + installPhase = '' + ensureDir $out/libexec/strangeloop/vessel/ + ensureDir $out/bin + + # allow scripting of the mojoinstaller + gcc -fPIC -shared -o isatty.so $ld_preload + + echo @@@ + echo @@@ this next step appears to hang for a while + echo @@@ + + # if we call ld.so $(bin) we don't need to set the ELF interpreter, and save a patchelf step. + LD_PRELOAD=./isatty.so $(cat $NIX_GCC/nix-support/dynamic-linker) $src << IM_A_BOT + n + $out/libexec/strangeloop/vessel/ + IM_A_BOT + + # use nix SDL libraries + rm $out/libexec/strangeloop/vessel/x86/libSDL* + rm $out/libexec/strangeloop/vessel/x86/libstdc++* + + # props to Ethan Lee (the Vessel porter) for understanding + # how $ORIGIN works in rpath. There is hope for humanity. + patchelf \ + --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \ + --set-rpath $libPath:$out/libexec/strangeloop/vessel/x86/ \ + $out/libexec/strangeloop/vessel/x86/vessel.x86 + + cat > $out/bin/Vessel << EOW + #!/bin/sh + cd $out/libexec/strangeloop/vessel/ + exec ./x86/vessel.x86 + EOW + + chmod +x $out/bin/Vessel + ''; + + meta = { + description = "A fluid physics based puzzle game"; + longDescription = '' + Living liquid machines have overrun this world of unstoppable progress, + and it is the role of their inventor, Arkwright, to stop the chaos they are + causing. Vessel is a game about a man with the power to bring ordinary matter + to life, and all the consequences that ensue. + ''; + homepage = http://www.strangeloopgames.com; + license = [ "unfree" ]; + maintainers = with stdenv.lib.maintainers; [ jcumming ]; + platforms = [ "i686-linux"] ; + }; + +} diff --git a/pkgs/games/vessel/isatty.c b/pkgs/games/vessel/isatty.c new file mode 100644 index 000000000000..38ee2b6ce2e8 --- /dev/null +++ b/pkgs/games/vessel/isatty.c @@ -0,0 +1,6 @@ +// We override isatty to help 'automate' installers. + +// Some installers (mojoinstall) have a stdio GUI that refuses to run if you +// feed it a file on stdin. This should help that. + +int isatty(int fd) { return 1; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d291708df88d..03408febd93a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8351,6 +8351,8 @@ let vectoroids = callPackage ../games/vectoroids { }; + vessel = callPackage_i686 ../games/vessel { }; + warmux = callPackage ../games/warmux { }; warsow = callPackage ../games/warsow {