mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 23:22:37 +00:00
Merge pull request #43774 from Infinisil/fix/minecraft
minecraft: clean and fix up
This commit is contained in:
commit
4ccaa7de8e
@ -1,11 +1,6 @@
|
|||||||
{ stdenv, fetchurl, makeDesktopItem
|
{ stdenv, fetchurl, makeDesktopItem, makeWrapper
|
||||||
, jre, libX11, libXext, libXcursor, libXrandr, libXxf86vm
|
, jdk, jre, libpulseaudio
|
||||||
, openjdk
|
}:
|
||||||
, libGLU_combined, openal
|
|
||||||
, useAlsa ? false, alsaOss ? null }:
|
|
||||||
with stdenv.lib;
|
|
||||||
|
|
||||||
assert useAlsa -> alsaOss != null;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
desktopItem = makeDesktopItem {
|
desktopItem = makeDesktopItem {
|
||||||
@ -19,41 +14,33 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
in stdenv.mkDerivation {
|
in stdenv.mkDerivation {
|
||||||
name = "minecraft-2015.07.24";
|
name = "minecraft-2015-07-24";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://s3.amazonaws.com/Minecraft.Download/launcher/Minecraft.jar";
|
url = "https://s3.amazonaws.com/Minecraft.Download/launcher/Minecraft.jar";
|
||||||
sha256 = "04pj4l5q0a64jncm2kk45r7nxnxa2z9n110dcxbbahdi6wk0png8";
|
sha256 = "04pj4l5q0a64jncm2kk45r7nxnxa2z9n110dcxbbahdi6wk0png8";
|
||||||
};
|
};
|
||||||
|
|
||||||
phases = "installPhase";
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
|
|
||||||
|
unpackPhase = "${jdk}/bin/jar xf $src favicon.png";
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
set -x
|
mkdir -p $out/bin $out/share/minecraft
|
||||||
mkdir -pv $out/bin
|
|
||||||
cp -v $src $out/minecraft.jar
|
|
||||||
|
|
||||||
cat > $out/bin/minecraft << EOF
|
makeWrapper ${jre}/bin/java $out/bin/minecraft \
|
||||||
#!${stdenv.shell}
|
--add-flags "-jar $out/share/minecraft/minecraft.jar" \
|
||||||
|
--suffix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ libpulseaudio ]}
|
||||||
|
|
||||||
export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:${makeLibraryPath [ libX11 libXext libXcursor libXrandr libXxf86vm libGLU_combined openal ]}
|
cp $src $out/share/minecraft/minecraft.jar
|
||||||
${if useAlsa then "${alsaOss}/bin/aoss" else "" } \
|
cp -r ${desktopItem}/share/applications $out/share
|
||||||
${jre}/bin/java -jar $out/minecraft.jar
|
|
||||||
EOF
|
|
||||||
|
|
||||||
chmod +x $out/bin/minecraft
|
|
||||||
|
|
||||||
mkdir -p $out/share/applications
|
|
||||||
ln -s ${desktopItem}/share/applications/* $out/share/applications/
|
|
||||||
|
|
||||||
${openjdk}/bin/jar xf $out/minecraft.jar favicon.png
|
|
||||||
install -D favicon.png $out/share/icons/hicolor/32x32/apps/minecraft.png
|
install -D favicon.png $out/share/icons/hicolor/32x32/apps/minecraft.png
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = with stdenv.lib; {
|
||||||
description = "A sandbox-building game";
|
description = "A sandbox-building game";
|
||||||
homepage = http://www.minecraft.net;
|
homepage = https://minecraft.net;
|
||||||
maintainers = with stdenv.lib.maintainers; [ cpages ryantm ];
|
maintainers = with maintainers; [ cpages ryantm infinisil ];
|
||||||
license = stdenv.lib.licenses.unfreeRedistributable;
|
license = licenses.unfreeRedistributable;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -19681,9 +19681,7 @@ with pkgs;
|
|||||||
|
|
||||||
megaglest = callPackage ../games/megaglest {};
|
megaglest = callPackage ../games/megaglest {};
|
||||||
|
|
||||||
minecraft = callPackage ../games/minecraft {
|
minecraft = callPackage ../games/minecraft { };
|
||||||
useAlsa = config.minecraft.alsa or false;
|
|
||||||
};
|
|
||||||
|
|
||||||
minecraft-server = callPackage ../games/minecraft-server { };
|
minecraft-server = callPackage ../games/minecraft-server { };
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user