From 9fda02f6761d8b0002319c61e30a04f83aab7dbf Mon Sep 17 00:00:00 2001 From: Michael Bishop Date: Sun, 21 Aug 2022 07:36:33 -0300 Subject: [PATCH] fix minecraft bedrock --- nixos/optina/minecraft-bedrock-server.nix | 44 +---------------------- nixos/optina/minecraft-bedrock.nix | 34 ++++++++++++++++++ 2 files changed, 35 insertions(+), 43 deletions(-) create mode 100644 nixos/optina/minecraft-bedrock.nix diff --git a/nixos/optina/minecraft-bedrock-server.nix b/nixos/optina/minecraft-bedrock-server.nix index 1056822..7dbc97a 100644 --- a/nixos/optina/minecraft-bedrock-server.nix +++ b/nixos/optina/minecraft-bedrock-server.nix @@ -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; diff --git a/nixos/optina/minecraft-bedrock.nix b/nixos/optina/minecraft-bedrock.nix new file mode 100644 index 0000000..014bea5 --- /dev/null +++ b/nixos/optina/minecraft-bedrock.nix @@ -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 + ''; +}