nixpkgs/pkgs/games/minecraft-server/default.nix

38 lines
1003 B
Nix
Raw Normal View History

{ stdenv, fetchurl, jre_headless }:
2019-08-13 22:52:01 +01:00
stdenv.mkDerivation {
pname = "minecraft-server";
2020-06-26 09:30:00 +01:00
version = "1.16.1";
src = fetchurl {
2020-06-26 09:30:00 +01:00
url = "https://launcher.mojang.com/v1/objects/a412fd69db1f81db3f511c1463fd304675244077/server.jar";
# sha1 because that comes from mojang via api
2020-06-26 09:30:00 +01:00
sha1 = "a412fd69db1f81db3f511c1463fd304675244077";
};
preferLocalBuild = true;
installPhase = ''
mkdir -p $out/bin $out/lib/minecraft
cp -v $src $out/lib/minecraft/server.jar
cat > $out/bin/minecraft-server << EOF
#!/bin/sh
exec ${jre_headless}/bin/java \$@ -jar $out/lib/minecraft/server.jar nogui
EOF
chmod +x $out/bin/minecraft-server
'';
2019-04-26 13:01:23 +01:00
phases = "installPhase";
passthru.updateScript = ./update.sh;
meta = with stdenv.lib; {
description = "Minecraft Server";
homepage = "https://minecraft.net";
license = licenses.unfreeRedistributable;
platforms = platforms.unix;
maintainers = with maintainers; [ thoughtpolice tomberek costrouc ];
};
}