Remove forge servers that wasn't working for neoforge

This commit is contained in:
Jimbo 2024-09-18 02:08:20 -04:00
parent 80c641c13b
commit 17e384265c
8 changed files with 0 additions and 3415 deletions

View file

@ -2,5 +2,4 @@
{pkgs, ...}: { {pkgs, ...}: {
xash3d = pkgs.callPackage ./xash/xash3d.nix {}; xash3d = pkgs.callPackage ./xash/xash3d.nix {};
hlsdk = pkgs.callPackage ./xash/hlsdk.nix {}; hlsdk = pkgs.callPackage ./xash/hlsdk.nix {};
forgeServers = pkgs.callPackage ./forge-servers/default.nix {};
} }

View file

@ -1,53 +0,0 @@
# based on:
# - https://github.com/Infinidoge/nix-minecraft/blob/ab4790259bf8ed20f4417de5a0e5ee592094c7c3/pkgs/fabric-servers/default.nix
# - https://github.com/Faeranne/nix-minecraft/blob/f4e4514f1d65b6a19704eab85070741e40c1d272/pkgs/forge-servers/default.nix
{ callPackage
, lib
, jre8_headless
, jre_headless
}:
with lib;
let
loader_versions = lib.importJSON ./lock_launcher.json;
# Older Minecraft versions that were written for Java 8, required Java 8.
# Mojang has since rewritten a lot of their codebase so that Java versions
# are no longer as important for stability as they used to be. Meaning we can
# target latest the latest JDK for all newer versions of Minecraft.
# TODO: Assert that jre_headless >= java version
getJavaVersion = v: if v == 8 then jre8_headless else jre_headless;
# Copied from https://github.com/Infinidoge/nix-minecraft/blob/ab4790259bf8ed20f4417de5a0e5ee592094c7c3/lib/default.nix
chain = {
func = id;
__functor = self: input:
if (typeOf input) == "lambda"
then self // { func = e: input (self.func e); }
else self.func input;
};
escapeVersion = replaceStrings [ "." " " ] [ "_" "_" ];
isNormalVersion = v: isList (match "([[:digit:]]+\.[[:digit:]]+(\.[[:digit:]]+)?)" v);
latestVersion = versions: chain
(filter isNormalVersion)
(sort versionOlder)
last
(attrNames versions);
#####
mkServer = gameVersion: (callPackage ./server.nix {
inherit gameVersion;
loaderVersion = latestVersion loader_versions.${gameVersion};
jre_headless = getJavaVersion 17;
loaderDrv = ./derivation.nix;
extraJavaArgs = "-Dlog4j.configurationFile=${./log4j.xml}";
});
gameVersions = attrNames loader_versions;
packagesRaw = lib.genAttrs gameVersions mkServer;
packages = lib.mapAttrs' (version: drv: nameValuePair "forge-${escapeVersion version}" drv) packagesRaw;
in
packages

View file

@ -1,148 +0,0 @@
# based on:
# - https://github.com/Faeranne/nix-minecraft/blob/f4e4514f1d65b6a19704eab85070741e40c1d272/pkgs/forge-servers/derivation.nix
# - https://github.com/Infinidoge/nix-minecraft/blob/ab4790259bf8ed20f4417de5a0e5ee592094c7c3/pkgs/build-support/mkTextileLoader.nix
#
# Locks (lock_game.json, lock_launcher.json, lock_libraries.json)
# are copied from https://github.com/Faeranne/nix-minecraft/tree/f4e4514f1d65b6a19704eab85070741e40c1d272/pkgs/forge-servers
#
# Locks are modified to have only one version of Forge (1.20.1-47.3.1)
# I didn't want to deal with many versions of Forge
{ lib
, stdenvNoCC
, fetchurl
, gameVersion
, loaderVersion
, jre_headless
, jq
}:
let
minecraftInfo = (lib.importJSON ./lock_game.json).${gameVersion};
forge-installer = "forge-${gameVersion}-${loaderVersion}-installer";
mappingsInfo = minecraftInfo.mappings;
mappings = fetchurl {
name = "minecraft-mappings";
version = "${gameVersion}";
inherit (mappingsInfo) sha1 url;
};
vanillaInfo = minecraftInfo.server;
vanilla = fetchurl {
name = "vanilla-server";
version = "${gameVersion}";
inherit (vanillaInfo) sha1 url;
};
loader = (lib.importJSON ./lock_launcher.json).${gameVersion}.${loaderVersion};
libraries = minecraftInfo.libraries;
libraries_lock = lib.importJSON ./lock_libraries.json;
fetchedLibraries = lib.forEach libraries (l:
let
library = libraries_lock.${l};
in
fetchurl {
inherit (library) url sha1;
}
);
in
stdenvNoCC.mkDerivation {
pname = "forge-loader";
version = "${gameVersion}-${loaderVersion}";
libraries = fetchedLibraries;
src = fetchurl {
name = forge-installer;
inherit (loader) url;
hash = loader.md5;
};
preferLocalBuild = true;
installPhase = if (loader.type == "installer") then (
let
libraries_path = lib.concatStringsSep " " (lib.forEach libraries (l: libraries_lock.${l}.path));
in
''
LIB_PATHS=(${libraries_path})
mkdir $out
for i in $libraries; do
NIX_LIB=$(basename $i)
NIX_LIB_NAME="''${NIX_LIB:33}"
for l in ''${!LIB_PATHS[@]}; do
LIB="''${LIB_PATHS[$l]}"
LIB_NAME=$(basename $LIB)
if [[ $LIB_NAME == $NIX_LIB_NAME ]]; then
mkdir -p "$out/libraries/$(dirname $LIB)"
ln -s $i $out/libraries/$LIB
echo Linking library: $LIB_NAME
break
fi
done
done
MOJMAP_DIR_NAME=$(basename $out/libraries/de/oceanlabs/mcp/mcp_config/${gameVersion}-*)
echo $MOJMAP_DIR_NAME
MOJMAP_DIR=$out/libraries/net/minecraft/server/$MOJMAP_DIR_NAME
mkdir -p "$MOJMAP_DIR"
ln -s ${mappings} $MOJMAP_DIR/server-$MOJMAP_DIR_NAME-mappings.txt
MINECRAFT_LIB=$out/libraries/net/minecraft/server/${gameVersion}
mkdir -p "$MINECRAFT_LIB"
ln -s ${vanilla} $MINECRAFT_LIB/server-${gameVersion}.jar
cp $src $out/forge-installer.jar
echo Patching forge installer...
pushd $out
${jre_headless}/bin/jar xf $out/forge-installer.jar install_profile.json
mv $out/install_profile.json $out/install_profile_original.json
${lib.getExe jq} 'del(.processors[] | select(.args[1]=="DOWNLOAD_MOJMAPS"))' $out/install_profile_original.json > $out/install_profile.json
mkdir -p $out/META-INF
touch $out/META-INF/FORGE.RSA
${jre_headless}/bin/jar uf $out/forge-installer.jar install_profile.json META-INF/FORGE.RSA
popd
rm $out/install_profile.json
rm $out/install_profile_original.json
rm -rf $out/META-INF
echo Running installer...
${jre_headless}/bin/java -jar $out/forge-installer.jar --offline --installServer $out
echo Cleaning up...
rm $out/run.bat
rm $out/run.sh
rm $out/user_jvm_args.txt
rm $out/forge-installer.jar
substituteInPlace $out/libraries/net/minecraftforge/forge/1.20.1-47.3.1/unix_args.txt \
--replace libraries $out/libraries
'') else throw "Cannot work with other types of packaging than installer!";
dontUnpack = true;
meta = with lib; {
description = "Minecraft Server";
homepage = "https://minecraft.net";
license = licenses.unfreeRedistributable;
platforms = platforms.unix;
maintainers = with maintainers; [ infinidoge ];
mainProgram = "minecraft-server";
};
}

View file

@ -1,114 +0,0 @@
{
"1.21": {
"sha1": "177e49d3233cb6eac42f0495c0a48e719870c2ae",
"server": {
"sha1": "450698d1863ab5180c25d7c804ef0fe6369dd1ba",
"size": 51623779,
"url": "https://piston-data.mojang.com/v1/objects/450698d1863ab5180c25d7c804ef0fe6369dd1ba/server.jar"
},
"mappings": {
"sha1": "31c77994d96f05ba25a870ada70f47f315330437",
"size": 7454609,
"url": "https://piston-data.mojang.com/v1/objects/31c77994d96f05ba25a870ada70f47f315330437/server.txt"
},
"libraries": [
"ca.weblite:java-objc-bridge:1.1",
"com.github.oshi:oshi-core:6.4.10",
"com.google.code.gson:gson:2.10.1",
"com.google.guava:failureaccess:1.0.1",
"com.google.guava:guava:32.1.2-jre",
"com.ibm.icu:icu4j:73.2",
"com.mojang:authlib:6.0.54",
"com.mojang:blocklist:1.0.10",
"com.mojang:brigadier:1.2.9",
"com.mojang:datafixerupper:8.0.16",
"com.mojang:logging:1.2.7",
"com.mojang:patchy:2.2.10",
"com.mojang:text2speech:1.17.9",
"commons-codec:commons-codec:1.16.0",
"commons-io:commons-io:2.15.1",
"commons-logging:commons-logging:1.2",
"io.netty:netty-buffer:4.1.97.Final",
"io.netty:netty-codec:4.1.97.Final",
"io.netty:netty-common:4.1.97.Final",
"io.netty:netty-handler:4.1.97.Final",
"io.netty:netty-resolver:4.1.97.Final",
"io.netty:netty-transport-classes-epoll:4.1.97.Final",
"io.netty:netty-transport-native-epoll:4.1.97.Final:linux-aarch_64",
"io.netty:netty-transport-native-epoll:4.1.97.Final:linux-x86_64",
"io.netty:netty-transport-native-unix-common:4.1.97.Final",
"io.netty:netty-transport:4.1.97.Final",
"it.unimi.dsi:fastutil:8.5.12",
"net.java.dev.jna:jna-platform:5.14.0",
"net.java.dev.jna:jna:5.14.0",
"net.sf.jopt-simple:jopt-simple:5.0.4",
"org.apache.commons:commons-compress:1.26.0",
"org.apache.commons:commons-lang3:3.14.0",
"org.apache.httpcomponents:httpclient:4.5.13",
"org.apache.httpcomponents:httpcore:4.4.16",
"org.apache.logging.log4j:log4j-api:2.22.1",
"org.apache.logging.log4j:log4j-core:2.22.1",
"org.apache.logging.log4j:log4j-slf4j2-impl:2.22.1",
"org.jcraft:jorbis:0.0.17",
"org.joml:joml:1.10.5",
"org.lwjgl:lwjgl-freetype:3.3.3",
"org.lwjgl:lwjgl-freetype:3.3.3:natives-linux",
"org.lwjgl:lwjgl-freetype:3.3.3:natives-macos-arm64",
"org.lwjgl:lwjgl-freetype:3.3.3:natives-macos-patch",
"org.lwjgl:lwjgl-freetype:3.3.3:natives-windows",
"org.lwjgl:lwjgl-freetype:3.3.3:natives-windows-arm64",
"org.lwjgl:lwjgl-freetype:3.3.3:natives-windows-x86",
"org.lwjgl:lwjgl-glfw:3.3.3",
"org.lwjgl:lwjgl-glfw:3.3.3:natives-linux",
"org.lwjgl:lwjgl-glfw:3.3.3:natives-macos",
"org.lwjgl:lwjgl-glfw:3.3.3:natives-macos-arm64",
"org.lwjgl:lwjgl-glfw:3.3.3:natives-windows",
"org.lwjgl:lwjgl-glfw:3.3.3:natives-windows-arm64",
"org.lwjgl:lwjgl-glfw:3.3.3:natives-windows-x86",
"org.lwjgl:lwjgl-jemalloc:3.3.3",
"org.lwjgl:lwjgl-jemalloc:3.3.3:natives-linux",
"org.lwjgl:lwjgl-jemalloc:3.3.3:natives-macos",
"org.lwjgl:lwjgl-jemalloc:3.3.3:natives-macos-arm64",
"org.lwjgl:lwjgl-jemalloc:3.3.3:natives-windows",
"org.lwjgl:lwjgl-jemalloc:3.3.3:natives-windows-arm64",
"org.lwjgl:lwjgl-jemalloc:3.3.3:natives-windows-x86",
"org.lwjgl:lwjgl-openal:3.3.3",
"org.lwjgl:lwjgl-openal:3.3.3:natives-linux",
"org.lwjgl:lwjgl-openal:3.3.3:natives-macos",
"org.lwjgl:lwjgl-openal:3.3.3:natives-macos-arm64",
"org.lwjgl:lwjgl-openal:3.3.3:natives-windows",
"org.lwjgl:lwjgl-openal:3.3.3:natives-windows-arm64",
"org.lwjgl:lwjgl-openal:3.3.3:natives-windows-x86",
"org.lwjgl:lwjgl-opengl:3.3.3",
"org.lwjgl:lwjgl-opengl:3.3.3:natives-linux",
"org.lwjgl:lwjgl-opengl:3.3.3:natives-macos",
"org.lwjgl:lwjgl-opengl:3.3.3:natives-macos-arm64",
"org.lwjgl:lwjgl-opengl:3.3.3:natives-windows",
"org.lwjgl:lwjgl-opengl:3.3.3:natives-windows-arm64",
"org.lwjgl:lwjgl-opengl:3.3.3:natives-windows-x86",
"org.lwjgl:lwjgl-stb:3.3.3",
"org.lwjgl:lwjgl-stb:3.3.3:natives-linux",
"org.lwjgl:lwjgl-stb:3.3.3:natives-macos",
"org.lwjgl:lwjgl-stb:3.3.3:natives-macos-arm64",
"org.lwjgl:lwjgl-stb:3.3.3:natives-windows",
"org.lwjgl:lwjgl-stb:3.3.3:natives-windows-arm64",
"org.lwjgl:lwjgl-stb:3.3.3:natives-windows-x86",
"org.lwjgl:lwjgl-tinyfd:3.3.3",
"org.lwjgl:lwjgl-tinyfd:3.3.3:natives-linux",
"org.lwjgl:lwjgl-tinyfd:3.3.3:natives-macos",
"org.lwjgl:lwjgl-tinyfd:3.3.3:natives-macos-arm64",
"org.lwjgl:lwjgl-tinyfd:3.3.3:natives-windows",
"org.lwjgl:lwjgl-tinyfd:3.3.3:natives-windows-arm64",
"org.lwjgl:lwjgl-tinyfd:3.3.3:natives-windows-x86",
"org.lwjgl:lwjgl:3.3.3",
"org.lwjgl:lwjgl:3.3.3:natives-linux",
"org.lwjgl:lwjgl:3.3.3:natives-macos",
"org.lwjgl:lwjgl:3.3.3:natives-macos-arm64",
"org.lwjgl:lwjgl:3.3.3:natives-windows",
"org.lwjgl:lwjgl:3.3.3:natives-windows-arm64",
"org.lwjgl:lwjgl:3.3.3:natives-windows-x86",
"org.lz4:lz4-java:1.8.0",
"org.slf4j:slf4j-api:2.0.9"
]
}
}

View file

@ -1,9 +0,0 @@
{
"1.21.1": {
"47.3.1": {
"type": "installer",
"url": "https://maven.neoforged.net/releases/net/neoforged/neoforge/21.1.54/neoforge-21.1.54-installer.jar",
"md5": "md5-ucnga+57fSrZVDGMesAUpg=="
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" packages="com.mojang.util">
<Appenders>
<Console name="SysOut" target="SYSTEM_OUT">
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" />
</Console>
<Queue name="ServerGuiConsole">
<PatternLayout pattern="[%d{HH:mm:ss} %level]: %msg%n" />
</Queue>
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" />
<Policies>
<TimeBasedTriggeringPolicy />
<OnStartupTriggeringPolicy />
</Policies>
<DefaultRolloverStrategy max="1000"/>
</RollingRandomAccessFile>
</Appenders>
<Loggers>
<Root level="info">
<filters>
<MarkerFilter marker="NETWORK_PACKETS" onMatch="DENY" onMismatch="NEUTRAL" />
</filters>
<AppenderRef ref="SysOut"/>
<AppenderRef ref="File"/>
<AppenderRef ref="ServerGuiConsole"/>
</Root>
</Loggers>
</Configuration>

View file

@ -1,23 +0,0 @@
# based on https://github.com/Infinidoge/nix-minecraft/blob/master/pkgs/build-support/mkTextileServer.nix
{ callPackage
, lib
, writeShellScriptBin
, gameVersion
, jre_headless
, loaderVersion
, loaderDrv
, loader ? (callPackage loaderDrv { inherit loaderVersion gameVersion jre_headless; })
, extraJavaArgs ? ""
, extraMinecraftArgs ? ""
}:
(writeShellScriptBin "minecraft-server" ''
exec ${lib.getExe jre_headless} ${extraJavaArgs} $@ @${loader}/libraries/net/minecraftforge/forge/${gameVersion}-${loaderVersion}/unix_args.txt nogui ${extraMinecraftArgs}''
) // rec {
pname = "minecraft-server";
version = "${gameVersion}-forge-${loaderVersion}";
name = "${pname}-${version}";
passthru = {
inherit loader;
};
}