git.iko.soy/typeable/nixpkgs
on master help sign in
minecraft: 2015-07-24 -> 2.1.5965 (closes #68123) (#68175)

minecraft: 2015-07-24 -> 2.1.5965 (closes #68123)

commitc545e85de875d54a71d15983cbdc4dba46a5eb44 authorSilvan Mosberger <contact@infinisil.com> dateFri 20 Sep 2019, 21:54 (7 years ago) parent55d63ef3a635da
2 files changed+121−28
pkgs/games/minecraft/default.nix+114−28 pkgs/games/minecraft/update.sh+7
pkgs/games/minecraft/default.nix+114−28
@@ -1,51 +1,137 @@
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
327}:
428
529let
630 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;";
1437 };
1538
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+ ];
2047
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";
2386
2487 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";
2795 };
2896
2997 nativeBuildInputs = [ makeWrapper ];
3098
31− unpackPhase = "${jdk}/bin/jar xf $src favicon.png";
99+ sourceRoot = ".";
100+
101+ dontConfigure = true;
102+ dontBuild = true;
32103
33104 installPhase = ''
34− mkdir -p $out/bin $out/share/minecraft
105+ mkdir -p $out/opt
106+ mv minecraft-launcher $out/opt
35107
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
39110
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
43127 '';
44128
45129 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";
48132 maintainers = with maintainers; [ cpages ryantm infinisil ];
49− license = licenses.unfreeRedistributable;
133+ license = licenses.unfree;
50134 };
135+
136+ passthru.updateScript = ./update.sh;
51137}
pkgs/games/minecraft/update.shnew file+7
@@ -0,0 +1,7 @@
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"