nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, stdenv, fetchurl, libvorbis, libogg, libtheora, SDL, libXft, SDL_image, zlib, libX11, libpng, openal, runtimeShell, requireFile, commercialVersion ? false }:
2
3stdenv.mkDerivation rec {
4 pname = "andyetitmoves";
5 version = "1.2.2";
6
7 src =
8 if stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux"
9 then
10 let
11 postfix = if stdenv.hostPlatform.system == "i686-linux" then "i386" else "x86_64";
12 commercialName = "${pname}-${version}_${postfix}.tar.gz";
13 demoUrl = "http://www.andyetitmoves.net/demo/${pname}Demo-${version}_${postfix}.tar.gz";
14 in
15 if commercialVersion
16 then
17 requireFile
18 {
19 message = ''
20 We cannot download the commercial version automatically, as you require a license.
21 Once you bought a license, you need to add your downloaded version to the nix store.
22 You can do this by using "nix-prefetch-url file:///\$PWD/${commercialName}" in the
23 directory where yousaved it.
24 '';
25 name = commercialName;
26 sha256 =
27 if stdenv.hostPlatform.system == "i686-linux"
28 then "15wvzmmidvykwjrbnq70h5jrvnjx1hcrm0357qj85q4aqbzavh01"
29 else "1v8z16qa9ka8sf7qq45knsxj87s6sipvv3a7xq11pb5xk08fb2ql";
30 }
31 else
32 fetchurl {
33 url = demoUrl;
34 sha256 =
35 if stdenv.hostPlatform.system == "i686-linux"
36 then "0f14vrrbq05hsbdajrb5y9za65fpng1lc8f0adb4aaz27x7sh525"
37 else "0mg41ya0b27blq3b5498kwl4rj46dj21rcd7qd0rw1kyvr7sx4v4";
38 }
39 else
40 throw "And Yet It Moves nix package only supports linux and intel cpu's.";
41
42 installPhase = ''
43 mkdir -p $out/{opt/andyetitmoves,bin}
44 cp -r * $out/opt/andyetitmoves/
45
46 fullPath=${stdenv.cc.cc.lib}/lib64
47 for i in $nativeBuildInputs; do
48 fullPath=$fullPath''${fullPath:+:}$i/lib
49 done
50
51 binName=${if commercialVersion then "AndYetItMoves" else "AndYetItMovesDemo"}
52
53 patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) --set-rpath $fullPath $out/opt/andyetitmoves/lib/$binName
54 cat > $out/bin/$binName << EOF
55 #!${runtimeShell}
56 cd $out/opt/andyetitmoves
57 exec ./lib/$binName
58 EOF
59 chmod +x $out/bin/$binName
60 '';
61
62 buildInputs = [ libvorbis libogg libtheora SDL libXft SDL_image zlib libX11 libpng openal ];
63
64 meta = with lib; {
65 description = "Physics/Gravity Platform game";
66 longDescription = ''
67 And Yet It Moves is an award-winning physics-based platform game in which players rotate the game world at will to solve challenging puzzles. Tilting the world turns walls into floors, slides into platforms, and stacks of rocks into dangerous hazards.
68 '';
69 homepage = "http://www.andyetitmoves.net/";
70 license = licenses.unfree;
71 maintainers = with maintainers; [ bluescreen303 ];
72 };
73}