2016-02-14 18:24:46 +00:00
|
|
|
{ stdenv, fetchurl, makeDesktopItem
|
|
|
|
, jre, libX11, libXext, libXcursor, libXrandr, libXxf86vm
|
2016-06-09 15:02:26 +01:00
|
|
|
, openjdk
|
2015-07-23 23:26:48 +01:00
|
|
|
, mesa, openal
|
|
|
|
, useAlsa ? false, alsaOss ? null }:
|
2016-04-30 23:26:54 +01:00
|
|
|
with stdenv.lib;
|
2012-04-29 15:09:58 +01:00
|
|
|
|
2015-07-23 23:26:48 +01:00
|
|
|
assert useAlsa -> alsaOss != null;
|
2014-07-28 10:30:31 +01:00
|
|
|
|
2016-02-14 18:24:46 +00:00
|
|
|
let
|
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = "minecraft";
|
|
|
|
exec = "minecraft";
|
2016-06-09 15:02:26 +01:00
|
|
|
icon = "minecraft";
|
2016-02-14 18:24:46 +00:00
|
|
|
comment = "A sandbox-building game";
|
|
|
|
desktopName = "Minecraft";
|
|
|
|
genericName = "minecraft";
|
|
|
|
categories = "Game;";
|
|
|
|
};
|
|
|
|
|
|
|
|
in stdenv.mkDerivation {
|
2015-07-23 23:26:48 +01:00
|
|
|
name = "minecraft-2015.07.24";
|
2012-04-29 15:09:58 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2014-03-30 18:34:33 +01:00
|
|
|
url = "https://s3.amazonaws.com/Minecraft.Download/launcher/Minecraft.jar";
|
|
|
|
sha256 = "04pj4l5q0a64jncm2kk45r7nxnxa2z9n110dcxbbahdi6wk0png8";
|
2012-04-29 15:09:58 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
phases = "installPhase";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
set -x
|
|
|
|
mkdir -pv $out/bin
|
|
|
|
cp -v $src $out/minecraft.jar
|
|
|
|
|
|
|
|
cat > $out/bin/minecraft << EOF
|
|
|
|
#!${stdenv.shell}
|
|
|
|
|
2016-04-30 23:26:54 +01:00
|
|
|
export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:${makeLibraryPath [ libX11 libXext libXcursor libXrandr libXxf86vm mesa openal ]}
|
2015-07-23 23:26:48 +01:00
|
|
|
${if useAlsa then "${alsaOss}/bin/aoss" else "" } \
|
2014-10-05 18:50:35 +01:00
|
|
|
${jre}/bin/java -jar $out/minecraft.jar
|
2012-04-29 15:09:58 +01:00
|
|
|
EOF
|
|
|
|
|
|
|
|
chmod +x $out/bin/minecraft
|
2016-02-14 18:24:46 +00:00
|
|
|
|
|
|
|
mkdir -p $out/share/applications
|
|
|
|
ln -s ${desktopItem}/share/applications/* $out/share/applications/
|
2016-06-09 15:02:26 +01:00
|
|
|
|
|
|
|
${openjdk}/bin/jar xf $out/minecraft.jar favicon.png
|
|
|
|
install -D favicon.png $out/share/icons/hicolor/32x32/apps/minecraft.png
|
2012-04-29 15:09:58 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "A sandbox-building game";
|
|
|
|
homepage = http://www.minecraft.net;
|
2017-01-20 11:23:57 +00:00
|
|
|
maintainers = with stdenv.lib.maintainers; [ cpages ryantm ];
|
2014-11-06 00:44:33 +00:00
|
|
|
license = stdenv.lib.licenses.unfreeRedistributable;
|
2012-04-29 15:09:58 +01:00
|
|
|
};
|
|
|
|
}
|