Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

minecraft: 2015-07-24 -> 2.1.5965

switched to the new official launcher, renamed to minecraft-launcher,
and added an update script

(cherry picked from commit 3a635da857bbbbaf0714e9483c7e3f8ef4c99653)

authored by hyperfekt and committed by Silvan Mosberger 7086c810 e6707624

+121 -28
+114 -28
pkgs/games/minecraft/default.nix
··· 1 - { stdenv, fetchurl, makeDesktopItem, makeWrapper 2 - , jdk, jre, libpulseaudio, libXxf86vm 1 + { stdenv 2 + , fetchurl 3 + , makeDesktopItem 4 + , makeWrapper 5 + , jre # old or modded versions of the game may require Java 8 (https://aur.archlinux.org/packages/minecraft-launcher/#pinned-674960) 6 + , xorg 7 + , zlib 8 + , nss 9 + , nspr 10 + , fontconfig 11 + , gnome2 12 + , cairo 13 + , expat 14 + , alsaLib 15 + , cups 16 + , dbus 17 + , atk 18 + , gtk2-x11 19 + , gdk_pixbuf 20 + , glib 21 + , curl 22 + , freetype 23 + , libpulseaudio 24 + , systemd 25 + , flite ? null 26 + , libXxf86vm ? null 3 27 }: 4 28 5 29 let 6 30 desktopItem = makeDesktopItem { 7 - name = "minecraft"; 8 - exec = "minecraft"; 9 - icon = "minecraft"; 10 - comment = "A sandbox-building game"; 11 - desktopName = "Minecraft"; 12 - genericName = "minecraft"; 13 - categories = "Game;"; 31 + name = "minecraft-launcher"; 32 + exec = "minecraft-launcher"; 33 + icon = "minecraft-launcher"; 34 + comment = "Official launcher for Minecraft, a sandbox-building game"; 35 + desktopName = "Minecraft Launcher"; 36 + categories = "Game;Application;"; 14 37 }; 15 38 16 - libPath = stdenv.lib.makeLibraryPath [ 17 - libpulseaudio 18 - libXxf86vm # Needed only for versions <1.13 19 - ]; 39 + envLibPath = stdenv.lib.makeLibraryPath [ 40 + curl 41 + libpulseaudio 42 + systemd 43 + alsaLib # needed for narrator 44 + flite # needed for narrator 45 + libXxf86vm # needed only for versions <1.13 46 + ]; 20 47 21 - in stdenv.mkDerivation { 22 - name = "minecraft-2015-07-24"; 48 + libPath = stdenv.lib.makeLibraryPath ([ 49 + alsaLib 50 + atk 51 + cairo 52 + cups 53 + dbus 54 + expat 55 + fontconfig 56 + freetype 57 + gdk_pixbuf 58 + glib 59 + gnome2.GConf 60 + gnome2.pango 61 + gtk2-x11 62 + nspr 63 + nss 64 + stdenv.cc.cc 65 + zlib 66 + ] ++ 67 + (with xorg; [ 68 + libX11 69 + libxcb 70 + libXcomposite 71 + libXcursor 72 + libXdamage 73 + libXext 74 + libXfixes 75 + libXi 76 + libXrandr 77 + libXrender 78 + libXtst 79 + libXScrnSaver 80 + ])); 81 + in 82 + stdenv.mkDerivation rec { 83 + pname = "minecraft-launcher"; 84 + 85 + version = "2.1.5965"; 23 86 24 87 src = fetchurl { 25 - url = "https://s3.amazonaws.com/Minecraft.Download/launcher/Minecraft.jar"; 26 - sha256 = "04pj4l5q0a64jncm2kk45r7nxnxa2z9n110dcxbbahdi6wk0png8"; 88 + url = "https://launcher.mojang.com/download/linux/x86_64/minecraft-launcher_${version}.tar.gz"; 89 + sha256 = "0wlc49s541li4cbxdmlw8fp34hp1q9m6ngr7l5hfdhv1i13s5845"; 90 + }; 91 + 92 + icon = fetchurl { 93 + url = "https://launcher.mojang.com/download/minecraft-launcher.svg"; 94 + sha256 = "0w8z21ml79kblv20wh5lz037g130pxkgs8ll9s3bi94zn2pbrhim"; 27 95 }; 28 96 29 97 nativeBuildInputs = [ makeWrapper ]; 30 98 31 - unpackPhase = "${jdk}/bin/jar xf $src favicon.png"; 99 + sourceRoot = "."; 100 + 101 + dontConfigure = true; 102 + dontBuild = true; 32 103 33 104 installPhase = '' 34 - mkdir -p $out/bin $out/share/minecraft 105 + mkdir -p $out/opt 106 + mv minecraft-launcher $out/opt 35 107 36 - makeWrapper ${jre}/bin/java $out/bin/minecraft \ 37 - --add-flags "-jar $out/share/minecraft/minecraft.jar" \ 38 - --suffix LD_LIBRARY_PATH : ${libPath} 108 + ${desktopItem.buildCommand} 109 + install -D $icon $out/share/icons/hicolor/symbolic/apps/minecraft-launcher.svg 39 110 40 - cp $src $out/share/minecraft/minecraft.jar 41 - cp -r ${desktopItem}/share/applications $out/share 42 - install -D favicon.png $out/share/icons/hicolor/32x32/apps/minecraft.png 111 + makeWrapper $out/opt/minecraft-launcher/minecraft-launcher $out/bin/minecraft-launcher \ 112 + --prefix LD_LIBRARY_PATH : ${envLibPath} \ 113 + --prefix PATH : ${stdenv.lib.makeBinPath [ jre ]} 114 + ''; 115 + 116 + preFixup = '' 117 + patchelf \ 118 + --set-interpreter ${stdenv.cc.bintools.dynamicLinker} \ 119 + --set-rpath '$ORIGIN/'":${libPath}" \ 120 + $out/opt/minecraft-launcher/minecraft-launcher 121 + patchelf \ 122 + --set-rpath '$ORIGIN/'":${libPath}" \ 123 + $out/opt/minecraft-launcher/libcef.so 124 + patchelf \ 125 + --set-rpath '$ORIGIN/'":${libPath}" \ 126 + $out/opt/minecraft-launcher/liblauncher.so 43 127 ''; 44 128 45 129 meta = with stdenv.lib; { 46 - description = "A sandbox-building game"; 47 - homepage = https://minecraft.net; 130 + description = "Official launcher for Minecraft, a sandbox-building game"; 131 + homepage = "https://minecraft.net"; 48 132 maintainers = with maintainers; [ cpages ryantm infinisil ]; 49 - license = licenses.unfreeRedistributable; 133 + license = licenses.unfree; 50 134 }; 135 + 136 + passthru.updateScript = ./update.sh; 51 137 }
+7
pkgs/games/minecraft/update.sh
··· 1 + #!/usr/bin/env nix-shell 2 + #!nix-shell -i bash -p curl jq gnugrep common-updater-scripts 3 + 4 + set -eu -o pipefail 5 + 6 + version=$(curl -s 'https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=minecraft-launcher' | jq '.results[0].Version' | grep -Po '[.\d]*(?=-)') 7 + update-source-version minecraft "$version"