Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 1 addition & 43 deletions nixos/optina/minecraft-bedrock-server.nix
Original file line number Diff line number Diff line change
@@ -1,51 +1,9 @@
{ config, lib, pkgs, ... }:

let
version = "1.18.32.02";
sha256 = "sha256-rp7lEqloNcYl6YnXKK06+UDU9xgWtEcZDeCNzsoxPe8=";

minecraft-bedrock-server = with pkgs; stdenv.mkDerivation rec {
name = "${pname}-${version}";
pname = "minecraft-bedrock-server";
inherit version;
src = fetchurl {
url = "https://minecraft.azureedge.net/bin-linux/bedrock-server-${version}.zip";
inherit sha256;
};
postPatch = ''
rm -f Makefile cmake_install.cmake *.debug
'';
sourceRoot = ".";
nativeBuildInputs = [
(patchelf.overrideDerivation (old: {
postPatch = ''
substituteInPlace src/patchelf.cc \
--replace "32 * 1024 * 1024" "512 * 1024 * 1024"
'';
}))
autoPatchelfHook
curl
gcc-unwrapped
openssl
unzip
];
installPhase = ''
install -m755 -D bedrock_server $out/bin/bedrock_server
rm bedrock_server
rm server.properties
mkdir -p $out/var
cp -a . $out/var/lib
'';
fixupPhase = ''
autoPatchelf $out/bin/bedrock_server
'';
};

in

with lib;

let
minecraft-bedrock-server = pkgs.callPackage ./minecraft-bedrock.nix {};
cfg = config.services.minecraft-bedrock-server;

cfgToString = v: if builtins.isBool v then boolToString v else toString v;
Expand Down
34 changes: 34 additions & 0 deletions nixos/optina/minecraft-bedrock.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{ stdenv, fetchurl, patchelf, openssl, unzip, lib, zlib }:

let
version = "1.18.32.02";
sha256 = "sha256-rp7lEqloNcYl6YnXKK06+UDU9xgWtEcZDeCNzsoxPe8=";
rpath = lib.makeLibraryPath [ zlib openssl stdenv.cc.cc ];
in
stdenv.mkDerivation rec {
name = "${pname}-${version}";
pname = "minecraft-bedrock-server";
inherit version;
src = fetchurl {
url = "https://minecraft.azureedge.net/bin-linux/bedrock-server-${version}.zip";
inherit sha256;
};
postPatch = ''
rm -f Makefile cmake_install.cmake *.debug
'';
sourceRoot = ".";
nativeBuildInputs = [
unzip
];
installPhase = ''
install -m755 -D bedrock_server $out/bin/bedrock_server
rm bedrock_server
rm server.properties
mkdir -p $out/var
cp -a . $out/var/lib
'';
fixupPhase = ''
echo RPATH: ${rpath}
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) --set-rpath "${rpath}" $out/bin/bedrock_server
'';
}