minecraft-fabric-server
This commit is contained in:
parent
3cfc74e09e
commit
5dd0633d8c
|
@ -46,8 +46,8 @@ rec {
|
||||||
|
|
||||||
wii-u-gc-adapter = pkgs.callPackage ./pkgs/wii-u-gc-adapter { };
|
wii-u-gc-adapter = pkgs.callPackage ./pkgs/wii-u-gc-adapter { };
|
||||||
|
|
||||||
# minecraft-server-fabric = pkgs.callPackage ./pkgs/minecraft-server-fabric { };
|
|
||||||
mcaselector = pkgs.callPackage ./pkgs/mcaselector { };
|
mcaselector = pkgs.callPackage ./pkgs/mcaselector { };
|
||||||
|
minecraft-fabric = pkgs.callPackage ./pkgs/minecraft-fabric { };
|
||||||
|
|
||||||
dowlords-faf-client = pkgs.callPackage ./pkgs/downlords { jdk16 = pkgs.jdk; };
|
dowlords-faf-client = pkgs.callPackage ./pkgs/downlords { jdk16 = pkgs.jdk; };
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
{ callPackage, writeTextFile, writeShellScriptBin, minecraft-server, jre_headless }:
|
||||||
|
|
||||||
|
let
|
||||||
|
loader = callPackage ./generate-loader.nix {};
|
||||||
|
log4j = writeTextFile {
|
||||||
|
name = "log4j.xml";
|
||||||
|
text = ''
|
||||||
|
<?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="debug">
|
||||||
|
<AppenderRef ref="SysOut"/>
|
||||||
|
<AppenderRef ref="File"/>
|
||||||
|
<AppenderRef ref="ServerGuiConsole"/>
|
||||||
|
</Root>
|
||||||
|
</Loggers>
|
||||||
|
</Configuration>
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
writeShellScriptBin "minecraft-server" ''
|
||||||
|
echo "serverJar=${minecraft-server}/lib/minecraft/server.jar" >> fabric-server-launcher.properties
|
||||||
|
exec ${jre_headless}/bin/java -Dlog4j.configurationFile=${log4j} $@ -jar ${loader} nogui
|
||||||
|
''
|
|
@ -0,0 +1,35 @@
|
||||||
|
{ lib, fetchurl, stdenv, unzip, zip, jre_headless }:
|
||||||
|
|
||||||
|
let
|
||||||
|
lock = import ./lock.nix;
|
||||||
|
libraries = lib.forEach lock.libraries fetchurl;
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "fabric-server-launch.jar";
|
||||||
|
nativeBuildInputs = [ unzip zip jre_headless ];
|
||||||
|
|
||||||
|
libraries = libraries;
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
for i in $libraries; do
|
||||||
|
unzip -o $i
|
||||||
|
done
|
||||||
|
|
||||||
|
cat > META-INF/MANIFEST.MF << EOF
|
||||||
|
Manifest-Version: 1.0
|
||||||
|
Main-Class: net.fabricmc.loader.impl.launch.server.FabricServerLauncher
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat > fabric-server-launch.properties << EOF
|
||||||
|
launch.mainClass=net.fabricmc.loader.impl.launch.knot.KnotServer
|
||||||
|
EOF
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
jar cmvf META-INF/MANIFEST.MF "server.jar" .
|
||||||
|
zip -d server.jar 'META-INF/*.SF' 'META-INF/*.RSA' 'META-INF/*.DSA'
|
||||||
|
cp server.jar "$out"
|
||||||
|
'';
|
||||||
|
|
||||||
|
phases = [ "buildPhase" "installPhase" ];
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
curl https://meta.fabricmc.net/v2/versions/loader/1.18.1/0.12.12/server/json \
|
||||||
|
| jq -r '
|
||||||
|
.mainClass,
|
||||||
|
(.libraries[]
|
||||||
|
| .url as $url
|
||||||
|
| .name | split(":") as [$dir, $name, $version]
|
||||||
|
|"\($name)-\($version).zip|\($url)\($dir|sub("\\.";"/";"g"))/\($name)/\($version)/\($name)-\($version).jar"
|
||||||
|
)' \
|
||||||
|
| {
|
||||||
|
echo '{'
|
||||||
|
read mainClass;
|
||||||
|
echo " mainClass = \"$mainClass\";"
|
||||||
|
echo " libraries = ["
|
||||||
|
while IFS="|" read name url; do
|
||||||
|
hash=$(nix-prefetch-url $url);
|
||||||
|
echo " { name = \"$name\"; sha256 = \"$hash\"; url = \"$url\"; }"
|
||||||
|
done
|
||||||
|
echo " ];"
|
||||||
|
echo '}'
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
mainClass = "net.fabricmc.loader.impl.launch.knot.KnotServer";
|
||||||
|
libraries = [
|
||||||
|
{ name = "tiny-mappings-parser-0.3.0+build.17.zip"; sha256 = "19kvhxfk5v01f2rvl7j02vqhn3nd2bh5jsgbk44rpzqv9f6074db"; url = "https://maven.fabricmc.net/net/fabricmc/tiny-mappings-parser/0.3.0+build.17/tiny-mappings-parser-0.3.0+build.17.jar"; }
|
||||||
|
{ name = "sponge-mixin-0.10.7+mixin.0.8.4.zip"; sha256 = "18m5wksd9vjp676cxapkggnz8s3f8j89phln8gy5n8vxlrli8n0d"; url = "https://maven.fabricmc.net/net/fabricmc/sponge-mixin/0.10.7+mixin.0.8.4/sponge-mixin-0.10.7+mixin.0.8.4.jar"; }
|
||||||
|
{ name = "tiny-remapper-0.6.0.zip"; sha256 = "1ynjfxg7cj9rd9c4l450w7yp20p2csjdpnk3mcx5bdkjzhbgvgzf"; url = "https://maven.fabricmc.net/net/fabricmc/tiny-remapper/0.6.0/tiny-remapper-0.6.0.jar"; }
|
||||||
|
{ name = "access-widener-2.0.1.zip"; sha256 = "0a7s4x6dbaa9p59ps7pidzwrs0xwy5i17s35xrgh58i26szlsaxm"; url = "https://maven.fabricmc.net/net/fabricmc/access-widener/2.0.1/access-widener-2.0.1.jar"; }
|
||||||
|
{ name = "asm-9.2.zip"; sha256 = "1xa7kccwmcqcdw1xly6n2frzhk56m8ma9v7h764g73ckf56zxm5r"; url = "https://maven.fabricmc.net/org/ow2/asm/asm/9.2/asm-9.2.jar"; }
|
||||||
|
{ name = "asm-analysis-9.2.zip"; sha256 = "1i1kyirizs5sm2v0f06sdz86mbmyn61vjr9d9p8p5h1i2x9bx3w7"; url = "https://maven.fabricmc.net/org/ow2/asm/asm-analysis/9.2/asm-analysis-9.2.jar"; }
|
||||||
|
{ name = "asm-commons-9.2.zip"; sha256 = "19p04mr14ahndba65v4krbvf4p5syf8wz0fp5i9bnf5270qyak5y"; url = "https://maven.fabricmc.net/org/ow2/asm/asm-commons/9.2/asm-commons-9.2.jar"; }
|
||||||
|
{ name = "asm-tree-9.2.zip"; sha256 = "04g0zb7v65iz4k2m2grdpbv8jjryrzkkw7ww23yfp94i6399pgxa"; url = "https://maven.fabricmc.net/org/ow2/asm/asm-tree/9.2/asm-tree-9.2.jar"; }
|
||||||
|
{ name = "asm-util-9.2.zip"; sha256 = "16759v4hh3ijpf4cglrxybz29x2hiylhsa388y09m2mf679kqnzz"; url = "https://maven.fabricmc.net/org/ow2/asm/asm-util/9.2/asm-util-9.2.jar"; }
|
||||||
|
{ name = "intermediary-1.18.1.zip"; sha256 = "1rfz2gazvnivn6hlqiyjpiaycz8va87n5czy1p6w3lnrlfggj2i9"; url = "https://maven.fabricmc.net/net/fabricmc/intermediary/1.18.1/intermediary-1.18.1.jar"; }
|
||||||
|
{ name = "fabric-loader-0.12.12.zip"; sha256 = "070dpcp7kcj4xr75wp1j6pb1bgfzllwg8xmqk3sk79jfqiqwzizw"; url = "https://maven.fabricmc.net/net/fabricmc/fabric-loader/0.12.12/fabric-loader-0.12.12.jar"; }
|
||||||
|
];
|
||||||
|
}
|
|
@ -1,40 +0,0 @@
|
||||||
{ lib, 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 lib; {
|
|
||||||
description = "minecraft with the fabric modloader";
|
|
||||||
license = licenses.unfree;
|
|
||||||
platforms = platforms.all;
|
|
||||||
|
|
||||||
broken = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue