2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, fetchurl, nixosTests, jre_headless }:
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation {
|
|
|
|
pname = "minecraft-server";
|
2021-01-15 22:18:51 +00:00
|
|
|
version = "1.16.5";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-01-15 22:18:51 +00:00
|
|
|
url = "https://launcher.mojang.com/v1/objects/1b557e7b033b583cd9f66746b7a9ab1ec1673ced/server.jar";
|
2020-06-02 18:00:15 +00:00
|
|
|
# sha1 because that comes from mojang via api
|
2021-01-15 22:18:51 +00:00
|
|
|
sha1 = "1b557e7b033b583cd9f66746b7a9ab1ec1673ced";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
|
|
|
phases = "installPhase";
|
|
|
|
|
2020-11-30 08:33:03 +00:00
|
|
|
passthru = {
|
|
|
|
tests = { inherit (nixosTests) minecraft-server; };
|
|
|
|
updateScript = ./update.sh;
|
|
|
|
};
|
2020-06-02 18:00:15 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Minecraft Server";
|
|
|
|
homepage = "https://minecraft.net";
|
|
|
|
license = licenses.unfreeRedistributable;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ thoughtpolice tomberek costrouc ];
|
|
|
|
};
|
|
|
|
}
|