2024-06-14 10:11:22 +00:00
|
|
|
{ lib, stdenv, fetchurl, nixosTests, jre_headless, makeWrapper, udev, version, url, sha1 }:
|
2021-12-10 11:45:19 +00:00
|
|
|
stdenv.mkDerivation {
|
|
|
|
pname = "minecraft-server";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchurl { inherit url sha1; };
|
|
|
|
|
|
|
|
preferLocalBuild = true;
|
|
|
|
|
2024-06-14 10:11:22 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
2021-12-10 11:45:19 +00:00
|
|
|
installPhase = ''
|
2024-06-14 10:11:22 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
install -Dm644 $src $out/lib/minecraft/server.jar
|
2021-12-10 11:45:19 +00:00
|
|
|
|
2024-06-14 10:11:22 +00:00
|
|
|
makeWrapper ${lib.getExe jre_headless} $out/bin/minecraft-server \
|
|
|
|
--append-flags "-jar $out/lib/minecraft/server.jar nogui" \
|
2024-06-26 21:34:01 +00:00
|
|
|
${lib.optionalString stdenv.hostPlatform.isLinux "--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ udev ]}"}
|
2021-12-10 11:45:19 +00:00
|
|
|
|
2024-06-14 10:11:22 +00:00
|
|
|
runHook postInstall
|
2021-12-10 11:45:19 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
dontUnpack = true;
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
tests = { inherit (nixosTests) minecraft-server; };
|
|
|
|
updateScript = ./update.py;
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Minecraft Server";
|
|
|
|
homepage = "https://minecraft.net";
|
2022-06-02 13:38:41 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryBytecode ];
|
2021-12-10 11:45:19 +00:00
|
|
|
license = licenses.unfreeRedistributable;
|
|
|
|
platforms = platforms.unix;
|
2024-08-22 23:46:20 +00:00
|
|
|
maintainers = with maintainers; [ thoughtpolice tomberek costrouc ];
|
2021-12-10 11:45:19 +00:00
|
|
|
};
|
|
|
|
}
|