From b594ac0d726e58f1d9c4353fbee7af70de646dc5 Mon Sep 17 00:00:00 2001 From: John Soo Date: Thu, 27 Oct 2022 12:38:56 -0700 Subject: [PATCH] arangodb: parameterize target architecture If -DTARGET_ARCHITECTURE is supplied arango's cmake configuration will not use /proc/cpuinfo for feature detection. However, `generic` and `none` options both fail when building the vendored v8. This workaround provides some defaults, but warns if no override is provided. --- pkgs/servers/nosql/arangodb/default.nix | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/nosql/arangodb/default.nix b/pkgs/servers/nosql/arangodb/default.nix index 7f1c6eb9e4c3..7db4c434cdf0 100644 --- a/pkgs/servers/nosql/arangodb/default.nix +++ b/pkgs/servers/nosql/arangodb/default.nix @@ -14,10 +14,30 @@ , snappy , lzo , which +, targetArchitecture ? null }: -gcc10Stdenv.mkDerivation rec { +let pname = "arangodb"; + + default_arch = + if gcc10Stdenv.isx86_64 + then "haswell" + else if gcc10Stdenv.isAarch64 + then "zen" + else "none"; + + target_arch = + if isNull targetArchitecture + then + lib.warn + "${pname} target architecture not specified, choosing ${default_arch}" + default_arch + else targetArchitecture; +in + +gcc10Stdenv.mkDerivation rec { + inherit pname; version = "3.10.0"; src = fetchFromGitHub { @@ -51,7 +71,7 @@ gcc10Stdenv.mkDerivation rec { "-DCMAKE_BUILD_TYPE=RelWithDebInfo" # avoid reading /proc/cpuinfo for feature detection - "-DTARGET_ARCHITECTURE=generic" + "-DTARGET_ARCHITECTURE=${target_arch}" ]; meta = with lib; {