2024-06-20 14:57:18 +00:00
|
|
|
{ lib, stdenv, fetchurl, nixosTests, jre_headless, makeWrapper, udev, version, url, sha1 }:
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation {
|
|
|
|
pname = "minecraft-server";
|
2022-01-19 23:45:15 +00:00
|
|
|
inherit version;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
src = fetchurl { inherit url sha1; };
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
preferLocalBuild = true;
|
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
installPhase = ''
|
2024-06-20 14:57:18 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
install -Dm644 $src $out/lib/minecraft/server.jar
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
makeWrapper ${lib.getExe jre_headless} $out/bin/minecraft-server \
|
|
|
|
--append-flags "-jar $out/lib/minecraft/server.jar nogui" \
|
2024-07-27 06:49:29 +00:00
|
|
|
${lib.optionalString stdenv.isLinux "--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ udev ]}"}
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
dontUnpack = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-11-30 08:33:03 +00:00
|
|
|
passthru = {
|
|
|
|
tests = { inherit (nixosTests) minecraft-server; };
|
2022-01-19 23:45:15 +00:00
|
|
|
updateScript = ./update.py;
|
2020-11-30 08:33:03 +00:00
|
|
|
};
|
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";
|
2022-06-16 17:23:12 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryBytecode ];
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.unfreeRedistributable;
|
|
|
|
platforms = platforms.unix;
|
2023-01-20 10:41:00 +00:00
|
|
|
maintainers = with maintainers; [ thoughtpolice tomberek costrouc joelkoen ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|