Skip to content

Commit

Permalink
besu: use jemalloc if possible (#511)
Browse files Browse the repository at this point in the history
* besu: use jemalloc if possible

* besu: add aarch64-darwin as supported platform
  • Loading branch information
rolfschr authored May 2, 2024
1 parent 31fa0d6 commit 26cd856
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions pkgs/besu/default.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{
fetchurl,
jemalloc,
jre,
lib,
makeWrapper,
runCommand,
stdenv,
testers,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: rec {
pname = "besu";
version = "24.3.3";

Expand All @@ -14,22 +17,44 @@ stdenv.mkDerivation rec {
hash = "sha256-ua7lGVIYf/VQ3kgfLAQFE3uF8dCqOCYWDfbX5QXzWa4=";
};

buildInputs = lib.optionals stdenv.isLinux [jemalloc];
nativeBuildInputs = [makeWrapper];

installPhase = ''
mkdir -p $out/bin
cp -r bin $out/
mkdir -p $out/lib
cp -r lib $out/
wrapProgram $out/bin/${pname} --set JAVA_HOME "${jre}"
wrapProgram $out/bin/${pname} --set JAVA_HOME "${jre}" --suffix ${
if stdenv.isDarwin
then "DYLD_LIBRARY_PATH"
else "LD_LIBRARY_PATH"
} : ${lib.makeLibraryPath buildInputs}
'';

passthru.tests = {
version = testers.testVersion {
package = finalAttrs.finalPackage;
version = "v${version}";
};
jemalloc =
runCommand "${pname}-test-jemalloc"
{
nativeBuildInputs = [finalAttrs.finalPackage];
meta.platforms = with lib.platforms; linux;
} ''
# Expect to find this string in the output, ignore other failures.
(besu 2>&1 || true) | grep -q "# jemalloc: ${jemalloc.version}"
mkdir $out
'';
};

meta = with lib; {
description = "Besu is an Apache 2.0 licensed, MainNet compatible, Ethereum client written in Java";
homepage = "https://github.com/hyperledger/besu";
license = licenses.asl20;
mainProgram = "besu";
platforms = ["x86_64-linux"];
platforms = ["aarch64-darwin" "x86_64-linux"];
sourceProvenance = with sourceTypes; [binaryBytecode];
};
}
})

0 comments on commit 26cd856

Please sign in to comment.