2024-05-08 02:53:23 +00:00
|
|
|
{ lib, stdenvNoCC, fetchurl, makeBinaryWrapper, jre, version, hash, udev }:
|
2024-02-26 09:14:59 +00:00
|
|
|
|
2024-03-17 20:44:35 +00:00
|
|
|
stdenvNoCC.mkDerivation (finalAttrs: {
|
2024-02-26 09:14:59 +00:00
|
|
|
pname = "papermc";
|
2024-03-17 20:44:35 +00:00
|
|
|
inherit version hash;
|
2024-02-26 09:14:59 +00:00
|
|
|
|
|
|
|
src =
|
|
|
|
let
|
2024-03-17 20:44:35 +00:00
|
|
|
version-split = lib.strings.splitString "-" finalAttrs.version;
|
2024-02-26 09:14:59 +00:00
|
|
|
mcVersion = builtins.elemAt version-split 0;
|
|
|
|
buildNum = builtins.elemAt version-split 1;
|
|
|
|
in
|
|
|
|
fetchurl {
|
2024-03-17 20:42:14 +00:00
|
|
|
url = "https://papermc.io/api/v2/projects/paper/versions/${mcVersion}/builds/${buildNum}/downloads/paper-${mcVersion}-${buildNum}.jar";
|
2024-03-17 20:44:35 +00:00
|
|
|
inherit (finalAttrs) hash;
|
2024-02-26 09:14:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
install -D $src $out/share/papermc/papermc.jar
|
|
|
|
|
|
|
|
makeWrapper ${lib.getExe jre} "$out/bin/minecraft-server" \
|
2024-05-08 02:53:23 +00:00
|
|
|
--append-flags "-jar $out/share/papermc/papermc.jar nogui" \
|
2024-06-26 14:45:48 +00:00
|
|
|
${lib.optionalString stdenvNoCC.hostPlatform.isLinux "--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ udev ]}"}
|
2024-02-26 09:14:59 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
makeBinaryWrapper
|
|
|
|
];
|
|
|
|
|
|
|
|
dontUnpack = true;
|
|
|
|
preferLocalBuild = true;
|
|
|
|
allowSubstitutes = false;
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
updateScript = ./update.py;
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "High-performance Minecraft Server";
|
|
|
|
homepage = "https://papermc.io/";
|
|
|
|
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
|
|
|
|
license = lib.licenses.gpl3Only;
|
|
|
|
platforms = lib.platforms.unix;
|
|
|
|
maintainers = with lib.maintainers; [ aaronjanse neonfuz MayNiklas ];
|
|
|
|
mainProgram = "minecraft-server";
|
|
|
|
};
|
2024-03-17 20:44:35 +00:00
|
|
|
})
|