From c7646ab5923d44122c8fd62566aa2245c38bfeb1 Mon Sep 17 00:00:00 2001 From: Daniel Olsen Date: Mon, 16 Nov 2020 08:42:24 +0100 Subject: [PATCH] minecraft-fabric --- default.nix | 2 ++ pkgs/minecraft-server-fabric/default.nix | 40 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 pkgs/minecraft-server-fabric/default.nix diff --git a/default.nix b/default.nix index 60ad5cb..4bdf816 100644 --- a/default.nix +++ b/default.nix @@ -41,5 +41,7 @@ in mesloNFp10k = pkgs.callPackage ./pkgs/fonts/MesloNFp10k.nix { }; + minecraft-server-fabric = pkgs.callPackage ./pkgs/minecraft-server-fabric { }; + wallpapers = pkgs.callPackage ./pkgs/wallpapers/monogatari { }; } diff --git a/pkgs/minecraft-server-fabric/default.nix b/pkgs/minecraft-server-fabric/default.nix new file mode 100644 index 0000000..d6deac3 --- /dev/null +++ b/pkgs/minecraft-server-fabric/default.nix @@ -0,0 +1,40 @@ +{stdenv, fetchurl, jre_headless, minecraft-server }: + +stdenv.mkDerivation rec { + pname = "minecraft-server-fabric"; + version = "0.6.1.51"; + + src = fetchurl { + url = "https://maven.fabricmc.net/net/fabricmc/fabric-installer/${version}/fabric-installer-${version}.jar"; + sha256 = "0cima0n3b37qha9a16kcvjnx9mg231v5wdg1063gxnq3vrxlcw23"; + }; + + preferLocalBuild = true; + + nativeBuildInputs = [ jre_headless ]; + + installPhase = '' + mkdir -p $out/bin $out/lib/minecraft-fabric + cp ${minecraft-server}/lib/minecraft/server.jar $out/lib/minecraft-fabric/server.jar + cp -v $src $out/lib/minecraft-fabric/fabric-installer-${version}.jar + pushd $out/lib/minecraft-fabric + ${jre_headless}/bin/java -jar fabric-installer-${version}.jar server + popd + cat > $out/bin/minecraft-server-fabric << EOF + #!/bin/sh + exec ${jre_headless}/bin/java \$@ -jar $out/lib/minecraft-fabric/fabric-server-launch.jar nogui + EOF + chmod +x $out/bin/minecraft-server + ''; + + phases = "installPhase"; + + meta = with stdenv.lib; { + description = "minecraft with the fabric modloader"; + license = licenses.unfree; + platforms = platforms.all; + + broken = true; + }; + +}