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

41 lines
1.1 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl, nixosTests, jre_headless }:
2019-08-13 23:52:01 +02:00
stdenv.mkDerivation {
pname = "minecraft-server";
2021-07-06 22:30:59 +02:00
version = "1.17.1";
src = fetchurl {
2021-07-06 22:30:59 +02:00
url = "https://launcher.mojang.com/v1/objects/a16d67e5807f57fc4e550299cf20226194497dc2/server.jar";
# sha1 because that comes from mojang via api
2021-07-06 22:30:59 +02:00
sha1 = "a16d67e5807f57fc4e550299cf20226194497dc2";
};
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 14:01:23 +02:00
2021-07-25 00:14:56 +02:00
dontUnpack = true;
2020-11-28 18:42:46 +01:00
passthru = {
tests = { inherit (nixosTests) minecraft-server; };
updateScript = ./update.sh;
};
meta = with lib; {
description = "Minecraft Server";
homepage = "https://minecraft.net";
license = licenses.unfreeRedistributable;
platforms = platforms.unix;
maintainers = with maintainers; [ thoughtpolice tomberek costrouc ];
};
}