about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/nosql/arangodb/default.nix
blob: 52b9125e99d5d4a5735b5d7f757e786f5fff5358 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{
  # gcc 11.2 suggested on 3.10.5.2.
  # gcc 11.3.0 unsupported yet, investigate gcc support when upgrading
  # See https://github.com/arangodb/arangodb/issues/17454
  gcc10Stdenv
, git
, lib
, fetchFromGitHub
, openssl
, zlib
, cmake
, python3
, perl
, snappy
, lzo
, which
, targetArchitecture ? null
, asmOptimizations ? gcc10Stdenv.hostPlatform.isx86
}:

let
  defaultTargetArchitecture =
    if gcc10Stdenv.hostPlatform.isx86
    then "haswell"
    else "core";

  targetArch =
    if targetArchitecture == null
    then defaultTargetArchitecture
    else targetArchitecture;
in

gcc10Stdenv.mkDerivation rec {
  pname = "arangodb";
  version = "3.10.5.2";

  src = fetchFromGitHub {
    repo = "arangodb";
    owner = "arangodb";
    rev = "v${version}";
    sha256 = "sha256-64iTxhG8qKTSrTlH/BWDJNnLf8VnaCteCKfQ9D2lGDQ=";
    fetchSubmodules = true;
  };

  nativeBuildInputs = [ cmake git perl python3 which ];

  buildInputs = [ openssl zlib snappy lzo ];

  # prevent failing with "cmake-3.13.4/nix-support/setup-hook: line 10: ./3rdParty/rocksdb/RocksDBConfig.cmake.in: No such file or directory"
  dontFixCmake = true;
  env.NIX_CFLAGS_COMPILE = "-Wno-error";

  postPatch = ''
    sed -ie 's!/bin/echo!echo!' 3rdParty/V8/gypfiles/*.gypi

    # with nixpkgs, it has no sense to check for a version update
    substituteInPlace js/client/client.js --replace "require('@arangodb').checkAvailableVersions();" ""
    substituteInPlace js/server/server.js --replace "require('@arangodb').checkAvailableVersions();" ""
  '';

  preConfigure = ''
    patchShebangs utils
  '';

  cmakeBuildType = "RelWithDebInfo";

  cmakeFlags = [
    "-DUSE_MAINTAINER_MODE=OFF"
    "-DUSE_GOOGLE_TESTS=OFF"

    # avoid reading /proc/cpuinfo for feature detection
    "-DTARGET_ARCHITECTURE=${targetArch}"
  ] ++ lib.optionals asmOptimizations [
    "-DASM_OPTIMIZATIONS=ON"
    "-DHAVE_SSE42=${if gcc10Stdenv.hostPlatform.sse4_2Support then "ON" else "OFF"}"
  ];

  meta = with lib; {
    homepage = "https://www.arangodb.com";
    description = "A native multi-model database with flexible data models for documents, graphs, and key-values";
    license = licenses.asl20;
    platforms = [ "x86_64-linux" ];
    maintainers = with maintainers; [ flosse jsoo1 ];
  };
}