Skip to content

Commit

Permalink
papermc: cleanup
Browse files Browse the repository at this point in the history
- Use Nix store path for the shebang to make this work on systems
  without /bin/sh.
- Replace phases by dont*.
- Install jar file to $out/share/papermc rather than $out.
- License gpl3 -> gpl3Only (couldn't find any evidence that this is
  gpl3Plus).
  • Loading branch information
danieldk committed Aug 25, 2020
1 parent 7dd3f3d commit 4bb0728
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions pkgs/games/papermc/default.nix
@@ -1,4 +1,4 @@
{ stdenv, fetchurl, jre }:
{ stdenv, fetchurl, bash, jre }:
let
mcVersion = "1.16.2";
buildNum = "141";
Expand All @@ -13,22 +13,23 @@ in stdenv.mkDerivation {
preferLocalBuild = true;

dontUnpack = true;
installPhase = ''
mkdir -p $out/bin
cp ${jar} $out/papermc.jar
cat > $out/bin/minecraft-server << EOF
#!/bin/sh
exec ${jre}/bin/java \$@ -jar $out/papermc.jar nogui
EOF
chmod +x $out/bin/minecraft-server
dontConfigure = true;

buildPhase = ''
cat > minecraft-server << EOF
#!${bash}/bin/sh
exec ${jre}/bin/java \$@ -jar $out/share/papermc/papermc.jar nogui
'';

phases = "installPhase";
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 = stdenv.lib.licenses.gpl3;
license = stdenv.lib.licenses.gpl3Only;
platforms = stdenv.lib.platforms.unix;
maintainers = with stdenv.lib.maintainers; [ aaronjanse ];
};
Expand Down

0 comments on commit 4bb0728

Please sign in to comment.