forge-server: Fix issues caused by the installer's reproducibility
This seems to mostly be due to mcpatcher patches being not quite bit-for-bit reproducible. Oh well, at least this derivation should work now.
This commit is contained in:
parent
71d783ec11
commit
c3aea6e305
|
@ -13,34 +13,55 @@ let
|
||||||
|
|
||||||
unpackCmd = "mkdir -p src; cp $curSrc src/forge-${version}-installer.jar";
|
unpackCmd = "mkdir -p src; cp $curSrc src/forge-${version}-installer.jar";
|
||||||
|
|
||||||
|
nativeBuildInputs = [ jre_headless ];
|
||||||
|
|
||||||
# Somewhat evil pre-install step to run through the network
|
# Somewhat evil pre-install step to run through the network
|
||||||
# dependency resolution forge needs. This is also common for gradle
|
# dependency resolution forge needs. This is also common for gradle
|
||||||
# projects, so I think this is ok-ish here, though ideally I'd
|
# projects, so I think this is ok-ish here, though ideally I'd
|
||||||
# identify all the dependencies and package them as well.
|
# identify all the dependencies and package them as well.
|
||||||
deps = stdenv.mkDerivation {
|
deps = stdenv.mkDerivation {
|
||||||
name = "${name}-deps";
|
name = "${name}-deps";
|
||||||
inherit src unpackCmd;
|
inherit src unpackCmd nativeBuildInputs;
|
||||||
|
|
||||||
nativeBuildInputs = [ jre_headless ];
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
java -jar forge-${version}-installer.jar --installServer installation
|
java -jar forge-${version}-installer.jar --installServer installation
|
||||||
'';
|
'';
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
cp -r installation/forge-${version}.jar installation/libraries $out
|
|
||||||
|
# The installer will patch the Minecraft server jar in some
|
||||||
|
# fashion, and include it in "libraries". This'd be fine, if the
|
||||||
|
# patch was bit-for-bit reproducible. Sadly it is not, so we
|
||||||
|
# defer this to the *real* package build.
|
||||||
|
rm -r installation/libraries/net/minecraft/
|
||||||
|
|
||||||
|
# The forge installer also insists on re-creating this file.
|
||||||
|
rm installation/libraries/de/oceanlabs/mcp/mcp_config/*/mcp_config-*-mappings.txt
|
||||||
|
|
||||||
|
cp -r installation/* $out
|
||||||
'';
|
'';
|
||||||
|
|
||||||
outputHashAlgo = "sha256";
|
outputHashAlgo = "sha256";
|
||||||
outputHashMode = "recursive";
|
outputHashMode = "recursive";
|
||||||
outputHash = "lV4UxmSdv/I+HwvnT8CLcHpSKyDvKnldA5/Lw1GsJ/M=";
|
outputHash = "ZRU9ytoF1BXRQ4hx2ehPgqan6vX4l2yomzNDOOWdm0Q=";
|
||||||
};
|
};
|
||||||
|
|
||||||
in stdenv.mkDerivation rec {
|
in stdenv.mkDerivation rec {
|
||||||
inherit name version src unpackCmd;
|
inherit name version src unpackCmd nativeBuildInputs;
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
mkdir -p installation
|
||||||
|
|
||||||
|
# Take the input deps and patch the Minecraft server jar into our
|
||||||
|
# libraries to create the package.
|
||||||
|
cp -rv ${deps}/* installation/
|
||||||
|
java -jar forge-${version}-installer.jar --offline --installServer installation/
|
||||||
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/{bin,lib/forge}
|
mkdir -p $out/{bin,lib/forge}
|
||||||
cp -rv ${deps}/* $out/lib/forge/
|
|
||||||
|
cp -r installation/{forge-${version}.jar,libraries} $out/lib/forge/
|
||||||
|
|
||||||
cat > $out/bin/forge-server << EOF
|
cat > $out/bin/forge-server << EOF
|
||||||
#!${runtimeShell}
|
#!${runtimeShell}
|
||||||
|
@ -81,8 +102,6 @@ in stdenv.mkDerivation rec {
|
||||||
chmod +x $out/bin/forge-server
|
chmod +x $out/bin/forge-server
|
||||||
'';
|
'';
|
||||||
|
|
||||||
phases = "installPhase";
|
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "Forge Minecraft Server";
|
description = "Forge Minecraft Server";
|
||||||
homepage = "https://files.minecraftforge.net/";
|
homepage = "https://files.minecraftforge.net/";
|
||||||
|
|
Loading…
Reference in a new issue