Skip to content

Instantly share code, notes, and snippets.

@hyperfekt
Created September 5, 2019 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyperfekt/841be248f3dd8bfad9966d8495ee844a to your computer and use it in GitHub Desktop.
Save hyperfekt/841be248f3dd8bfad9966d8495ee844a to your computer and use it in GitHub Desktop.
{ stdenv, fetchurl, dpkg, makeWrapper, jre, libpulseaudio
}:
stdenv.mkDerivation rec {
pname = "minecraft-launcher";
version = "2.1.5965";
src = fetchurl {
url = "https://launcher.mojang.com/download/Minecraft.deb";
sha256 = "1n559ywicg72ia1szmncifpfvjbvrnw1c8b477zmyjmfcd1lirbn";
};
buildInputs = [ dpkg makeWrapper ];
sourceRoot = ".";
unpackPhase = "dpkg-deb -x $src .";
dontConfigure = true;
dontBuild = true;
installPhase = ''
mkdir -p $out/bin
mv opt $out/opt
mv usr/share $out/share
substituteInPlace $out/share/applications/minecraft-launcher.desktop --replace /opt $out/opt
makeWrapper $out/opt/minecraft-launcher/minecraft-launcher $out/bin/minecraft-launcher --prefix PATH : ${stdenv.lib.makeBinPath [ jre ]}
'';
preFixup = let
libPath = stdenv.lib.makeLibraryPath [
stdenv.cc.cc.lib # libstdc++.so.6
];
in ''
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "$out/opt/minecraft-launcher:${libPath}" \
$out/opt/minecraft-launcher/minecraft-launcher
'';
meta = with stdenv.lib; {
description = "A sandbox-building game";
homepage = https://minecraft.net;
maintainers = with maintainers; [ cpages ryantm infinisil ];
license = licenses.unfreeRedistributable;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment