Skip to content

Commit 212fb27

Browse files
authored
Merge pull request #2 from cleverca22/master
2 parents b2c26b2 + 9fda02f commit 212fb27

File tree

2 files changed

+35
-43
lines changed

2 files changed

+35
-43
lines changed

nixos/optina/minecraft-bedrock-server.nix

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,9 @@
11
{ config, lib, pkgs, ... }:
22

3-
let
4-
version = "1.18.32.02";
5-
sha256 = "sha256-rp7lEqloNcYl6YnXKK06+UDU9xgWtEcZDeCNzsoxPe8=";
6-
7-
minecraft-bedrock-server = with pkgs; stdenv.mkDerivation rec {
8-
name = "${pname}-${version}";
9-
pname = "minecraft-bedrock-server";
10-
inherit version;
11-
src = fetchurl {
12-
url = "https://minecraft.azureedge.net/bin-linux/bedrock-server-${version}.zip";
13-
inherit sha256;
14-
};
15-
postPatch = ''
16-
rm -f Makefile cmake_install.cmake *.debug
17-
'';
18-
sourceRoot = ".";
19-
nativeBuildInputs = [
20-
(patchelf.overrideDerivation (old: {
21-
postPatch = ''
22-
substituteInPlace src/patchelf.cc \
23-
--replace "32 * 1024 * 1024" "512 * 1024 * 1024"
24-
'';
25-
}))
26-
autoPatchelfHook
27-
curl
28-
gcc-unwrapped
29-
openssl
30-
unzip
31-
];
32-
installPhase = ''
33-
install -m755 -D bedrock_server $out/bin/bedrock_server
34-
rm bedrock_server
35-
rm server.properties
36-
mkdir -p $out/var
37-
cp -a . $out/var/lib
38-
'';
39-
fixupPhase = ''
40-
autoPatchelf $out/bin/bedrock_server
41-
'';
42-
};
43-
44-
in
45-
463
with lib;
474

485
let
6+
minecraft-bedrock-server = pkgs.callPackage ./minecraft-bedrock.nix {};
497
cfg = config.services.minecraft-bedrock-server;
508

519
cfgToString = v: if builtins.isBool v then boolToString v else toString v;

nixos/optina/minecraft-bedrock.nix

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{ stdenv, fetchurl, patchelf, openssl, unzip, lib, zlib }:
2+
3+
let
4+
version = "1.18.32.02";
5+
sha256 = "sha256-rp7lEqloNcYl6YnXKK06+UDU9xgWtEcZDeCNzsoxPe8=";
6+
rpath = lib.makeLibraryPath [ zlib openssl stdenv.cc.cc ];
7+
in
8+
stdenv.mkDerivation rec {
9+
name = "${pname}-${version}";
10+
pname = "minecraft-bedrock-server";
11+
inherit version;
12+
src = fetchurl {
13+
url = "https://minecraft.azureedge.net/bin-linux/bedrock-server-${version}.zip";
14+
inherit sha256;
15+
};
16+
postPatch = ''
17+
rm -f Makefile cmake_install.cmake *.debug
18+
'';
19+
sourceRoot = ".";
20+
nativeBuildInputs = [
21+
unzip
22+
];
23+
installPhase = ''
24+
install -m755 -D bedrock_server $out/bin/bedrock_server
25+
rm bedrock_server
26+
rm server.properties
27+
mkdir -p $out/var
28+
cp -a . $out/var/lib
29+
'';
30+
fixupPhase = ''
31+
echo RPATH: ${rpath}
32+
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) --set-rpath "${rpath}" $out/bin/bedrock_server
33+
'';
34+
}

0 commit comments

Comments
 (0)