Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 55 lines 1.2 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 nixosTests, 6 jre_headless, 7 makeWrapper, 8 udev, 9 version, 10 url, 11 sha1, 12}: 13stdenv.mkDerivation { 14 pname = "minecraft-server"; 15 inherit version; 16 17 src = fetchurl { inherit url sha1; }; 18 19 preferLocalBuild = true; 20 21 nativeBuildInputs = [ makeWrapper ]; 22 23 installPhase = '' 24 runHook preInstall 25 26 install -Dm644 $src $out/lib/minecraft/server.jar 27 28 makeWrapper ${lib.getExe jre_headless} $out/bin/minecraft-server \ 29 --append-flags "-jar $out/lib/minecraft/server.jar nogui" \ 30 ${lib.optionalString stdenv.hostPlatform.isLinux "--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ udev ]}"} 31 32 runHook postInstall 33 ''; 34 35 dontUnpack = true; 36 37 passthru = { 38 tests = { inherit (nixosTests) minecraft-server; }; 39 updateScript = ./update.py; 40 }; 41 42 meta = with lib; { 43 description = "Minecraft Server"; 44 homepage = "https://minecraft.net"; 45 sourceProvenance = with sourceTypes; [ binaryBytecode ]; 46 license = licenses.unfreeRedistributable; 47 platforms = platforms.unix; 48 maintainers = with maintainers; [ 49 thoughtpolice 50 tomberek 51 costrouc 52 ]; 53 mainProgram = "minecraft-server"; 54 }; 55}