2020-04-01 22:59:14 -07:00
|
|
|
{ stdenv, fetchurl, jre_headless }:
|
2019-08-13 14:52:01 -07:00
|
|
|
stdenv.mkDerivation {
|
2019-08-15 05:41:18 -07:00
|
|
|
pname = "minecraft-server";
|
2020-11-02 11:10:14 -08:00
|
|
|
version = "1.16.4";
|
2014-03-29 02:48:08 -07:00
|
|
|
|
2019-06-27 01:50:47 -07:00
|
|
|
src = fetchurl {
|
2020-11-02 11:10:14 -08:00
|
|
|
url = "https://launcher.mojang.com/v1/objects/35139deedbd5182953cf1caa23835da59ca3d7cd/server.jar";
|
2020-06-02 09:48:53 -07:00
|
|
|
# sha1 because that comes from mojang via api
|
2020-11-02 11:10:14 -08:00
|
|
|
sha1 = "35139deedbd5182953cf1caa23835da59ca3d7cd";
|
2019-06-27 01:50:47 -07:00
|
|
|
};
|
2018-08-20 16:34:03 -07:00
|
|
|
|
2019-06-27 01:50:47 -07:00
|
|
|
preferLocalBuild = true;
|
2018-08-20 16:34:03 -07:00
|
|
|
|
2019-06-27 01:50:47 -07:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin $out/lib/minecraft
|
|
|
|
cp -v $src $out/lib/minecraft/server.jar
|
2018-08-20 16:34:03 -07:00
|
|
|
|
2019-06-27 01:50:47 -07:00
|
|
|
cat > $out/bin/minecraft-server << EOF
|
|
|
|
#!/bin/sh
|
2020-04-01 22:59:14 -07:00
|
|
|
exec ${jre_headless}/bin/java \$@ -jar $out/lib/minecraft/server.jar nogui
|
2019-06-27 01:50:47 -07:00
|
|
|
EOF
|
2018-08-20 16:34:03 -07:00
|
|
|
|
2019-06-27 01:50:47 -07:00
|
|
|
chmod +x $out/bin/minecraft-server
|
|
|
|
'';
|
2019-04-26 05:01:23 -07:00
|
|
|
|
2019-06-27 01:50:47 -07:00
|
|
|
phases = "installPhase";
|
2014-03-29 02:48:08 -07:00
|
|
|
|
2020-06-02 09:48:53 -07:00
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
|
2020-04-01 22:59:14 -07:00
|
|
|
meta = with stdenv.lib; {
|
2019-06-27 01:50:47 -07:00
|
|
|
description = "Minecraft Server";
|
2020-04-01 22:59:14 -07:00
|
|
|
homepage = "https://minecraft.net";
|
|
|
|
license = licenses.unfreeRedistributable;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ thoughtpolice tomberek costrouc ];
|
2014-03-29 02:48:08 -07:00
|
|
|
};
|
|
|
|
}
|