nixos-config/packages/minecraft/papermc/default.nix
Charlotte 🦝 Delenk 8f227900d4
All checks were successful
Hydra packages.aarch64-linux.mautrix-whatsapp Hydra build #16995 of nixos-config:pr590:packages.aarch64-linux.mautrix-whatsapp
Hydra packages.x86_64-linux.papermc Hydra build #16998 of nixos-config:pr590:packages.x86_64-linux.papermc
Hydra packages.x86_64-linux.mautrix-whatsapp Hydra build #16997 of nixos-config:pr590:packages.x86_64-linux.mautrix-whatsapp
Hydra nas.x86_64-linux Hydra build #16994 of nixos-config:pr590:nas.x86_64-linux
Hydra packages.aarch64-linux.papermc Hydra build #16996 of nixos-config:pr590:packages.aarch64-linux.papermc
Hydra instance-20221213-1915.aarch64-linux Hydra build #16993 of nixos-config:pr590:instance-20221213-1915.aarch64-linux
update papermc
2024-10-17 13:21:45 +02:00

41 lines
1.4 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
stdenvNoCC,
openjdk_headless,
callPackage,
lib,
writeScript,
}: let
paperJar = callPackage ./jar.nix {};
versionInfo = builtins.fromJSON (builtins.readFile ./paper.json);
in
stdenvNoCC.mkDerivation {
preferLocalBuild = true;
pname = "paper";
version = "${versionInfo.version}.${toString versionInfo.build}";
dontUnpack = true;
dontConfigure = true;
buildPhase = ''
cat > minecraft-server << EOF
#!/bin/sh
exec ${openjdk_headless}/bin/java \$@ -jar $out/share/papermc/papermc.jar nogui
'';
installPhase = ''
mkdir -p $out/share/papermc
ln -s ${paperJar} $out/share/papermc/papermc.jar
install -Dm555 -t $out/bin minecraft-server
'';
meta = {
description = "High performance minecraft server";
# This is a fun one because while papermcs patches are released under the gpl, they apply patches to a proprietary binary which they then execute, so
license = lib.licenses.gpl3;
unfree = true;
};
passthru.updateScript = writeScript "update-paper" '' #! /usr/bin/env nix-shell
#! nix-shell -i bash -p curl jq
curl -L https://papermc.io/api/v2/projects/paper/versions/1.21.1/builds | jq '{"version":.version, "build":.builds[-1].build, "name":.builds[-1].downloads.application.name, "sha256":.builds[-1].downloads.application.sha256}' > minecraft/papermc/paper.json
'';
}