mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 08:53:21 +00:00
85f544d85e
Reintroduces the use of finalAttrs that was introduced ind0bb02b106
and erroneously removed inef321a0ed6
.
51 lines
1.3 KiB
Nix
51 lines
1.3 KiB
Nix
{ lib, stdenvNoCC, fetchurl, makeBinaryWrapper, jre, version, hash }:
|
|
|
|
stdenvNoCC.mkDerivation (finalAttrs: {
|
|
pname = "papermc";
|
|
inherit version hash;
|
|
|
|
src =
|
|
let
|
|
version-split = lib.strings.splitString "-" finalAttrs.version;
|
|
mcVersion = builtins.elemAt version-split 0;
|
|
buildNum = builtins.elemAt version-split 1;
|
|
in
|
|
fetchurl {
|
|
url = "https://papermc.io/api/v2/projects/paper/versions/${mcVersion}/builds/${buildNum}/downloads/paper-${mcVersion}-${buildNum}.jar";
|
|
inherit (finalAttrs) hash;
|
|
};
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
install -D $src $out/share/papermc/papermc.jar
|
|
|
|
makeWrapper ${lib.getExe jre} "$out/bin/minecraft-server" \
|
|
--append-flags "-jar $out/share/papermc/papermc.jar nogui"
|
|
|
|
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";
|
|
};
|
|
})
|