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
41 lines
1.4 KiB
Nix
41 lines
1.4 KiB
Nix
{
|
||
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 papermc’s 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
|
||
'';
|
||
}
|