nixpkgs/pkgs/games/papermc/default.nix
Aaron Janse f1c4bec46a
papermc: 1.17.1r97 -> 1.17.1r399 (#149989)
* papermc: 1.17.1r97 -> 1.17.1r399

Co-authored-by: Joel <jyooru+github@protonmail.ch>
2021-12-11 15:46:12 +00:00

36 lines
1,020 B
Nix

{ lib, stdenv, fetchurl, bash, jre }:
let
mcVersion = "1.17.1";
buildNum = "399";
jar = fetchurl {
url = "https://papermc.io/api/v2/projects/paper/versions/${mcVersion}/builds/${buildNum}/downloads/paper-${mcVersion}-${buildNum}.jar";
sha256 = "01374201dkzrx28phy87wji7kzjwx8bpjzv85bjl6672ziskbmpd";
};
in stdenv.mkDerivation {
pname = "papermc";
version = "${mcVersion}r${buildNum}";
preferLocalBuild = true;
dontUnpack = true;
dontConfigure = true;
buildPhase = ''
cat > minecraft-server << EOF
#!${bash}/bin/sh
exec ${jre}/bin/java \$@ -jar $out/share/papermc/papermc.jar nogui
'';
installPhase = ''
install -Dm444 ${jar} $out/share/papermc/papermc.jar
install -Dm555 -t $out/bin minecraft-server
'';
meta = {
description = "High-performance Minecraft Server";
homepage = "https://papermc.io/";
license = lib.licenses.gpl3Only;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ aaronjanse neonfuz ];
};
}