From eb301258ef2aa4c95245311a2e888a12ac0fd811 Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Mon, 3 Jan 2022 15:07:11 +0100 Subject: [PATCH] andyetitmoves: deprecate phases and refactor --- pkgs/games/andyetitmoves/default.nix | 67 ++++++++++++++-------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/pkgs/games/andyetitmoves/default.nix b/pkgs/games/andyetitmoves/default.nix index 9eb1c7594a10..ecd1dfc9b3cd 100644 --- a/pkgs/games/andyetitmoves/default.nix +++ b/pkgs/games/andyetitmoves/default.nix @@ -2,38 +2,43 @@ stdenv.mkDerivation rec { pname = "andyetitmoves"; - version = "1.2.2"; + version = "1.2.2"; - src = if stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux" + src = + if stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux" then - let postfix = if stdenv.hostPlatform.system == "i686-linux" then "i386" else "x86_64"; - commercialName = "${pname}-${version}_${postfix}.tar.gz"; - demoUrl = "http://www.andyetitmoves.net/demo/${pname}Demo-${version}_${postfix}.tar.gz"; + let + postfix = if stdenv.hostPlatform.system == "i686-linux" then "i386" else "x86_64"; + commercialName = "${pname}-${version}_${postfix}.tar.gz"; + demoUrl = "http://www.andyetitmoves.net/demo/${pname}Demo-${version}_${postfix}.tar.gz"; in if commercialVersion - then requireFile { - message = '' - We cannot download the commercial 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:///\$PWD/${commercialName}" in the - directory where yousaved it. - ''; - name = commercialName; - sha256 = if stdenv.hostPlatform.system == "i686-linux" - then "15wvzmmidvykwjrbnq70h5jrvnjx1hcrm0357qj85q4aqbzavh01" - else "1v8z16qa9ka8sf7qq45knsxj87s6sipvv3a7xq11pb5xk08fb2ql"; - } - else fetchurl { - url = demoUrl; - sha256 = if stdenv.hostPlatform.system == "i686-linux" - then "0f14vrrbq05hsbdajrb5y9za65fpng1lc8f0adb4aaz27x7sh525" - else "0mg41ya0b27blq3b5498kwl4rj46dj21rcd7qd0rw1kyvr7sx4v4"; - } + then + requireFile + { + message = '' + We cannot download the commercial 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:///\$PWD/${commercialName}" in the + directory where yousaved it. + ''; + name = commercialName; + sha256 = + if stdenv.hostPlatform.system == "i686-linux" + then "15wvzmmidvykwjrbnq70h5jrvnjx1hcrm0357qj85q4aqbzavh01" + else "1v8z16qa9ka8sf7qq45knsxj87s6sipvv3a7xq11pb5xk08fb2ql"; + } + else + fetchurl { + url = demoUrl; + sha256 = + if stdenv.hostPlatform.system == "i686-linux" + then "0f14vrrbq05hsbdajrb5y9za65fpng1lc8f0adb4aaz27x7sh525" + else "0mg41ya0b27blq3b5498kwl4rj46dj21rcd7qd0rw1kyvr7sx4v4"; + } else throw "And Yet It Moves nix package only supports linux and intel cpu's."; - phases = "unpackPhase installPhase"; - installPhase = '' mkdir -p $out/{opt/andyetitmoves,bin} cp -r * $out/opt/andyetitmoves/ @@ -54,19 +59,15 @@ stdenv.mkDerivation rec { chmod +x $out/bin/$binName ''; - buildInputs = [libvorbis libogg libtheora SDL libXft SDL_image zlib libX11 libpng openal]; + buildInputs = [ libvorbis libogg libtheora SDL libXft SDL_image zlib libX11 libpng openal ]; - meta = { + meta = with lib; { description = "Physics/Gravity Platform game"; - longDescription = '' 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. ''; - homepage = "http://www.andyetitmoves.net/"; - - license = lib.licenses.unfree; - - maintainers = with lib.maintainers; [bluescreen303]; + license = licenses.unfree; + maintainers = with maintainers; [ bluescreen303 ]; }; }