Unverified Commit ea64fcaf authored by Pol Dellaiera's avatar Pol Dellaiera Committed by GitHub
Browse files

turingdb: init at 1.22 (#498707)

parents a9dc6f46 4d2b52ef
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -5709,6 +5709,12 @@
    githubId = 217899;
    name = "Cyryl Płotnicki";
  };
  cyrusknopf = {
    email = "cyrus.knopf@gmail.com";
    github = "cyrusknopf";
    githubId = 26168196;
    name = "Cyrus Knopf";
  };
  cything = {
    name = "cy";
    email = "nix@cything.io";
@@ -23238,6 +23244,12 @@
    githubId = 55679162;
    keys = [ { fingerprint = "1401 1B63 393D 16C1 AA9C  C521 8526 B757 4A53 6236"; } ];
  };
  roquess = {
    name = "Steve Roques";
    email = "steve.roques@gmail.com";
    github = "roquess";
    githubId = 8398054;
  };
  rorosen = {
    email = "robert.rose@mailbox.org";
    github = "rorosen";
+92 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  cmake,
  pkg-config,
  curl,
  curlpp,
  inih,
  openssl,
  pugixml,
  nlohmann_json,
  zlib,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "minio-cpp";
  version = "0.3.0";

  src = fetchFromGitHub {
    owner = "minio";
    repo = "minio-cpp";
    tag = "v${finalAttrs.version}";
    hash = "sha256-JKC9SYgb5+nQ3M5C6j6QLfltM+U18oaFrep4gOKPlCI=";
  };

  postPatch = ''
    substituteInPlace CMakeLists.txt \
      --replace-fail \
        'find_package(unofficial-curlpp CONFIG REQUIRED)' \
        'find_package(PkgConfig REQUIRED)
    pkg_check_modules(CURLPP REQUIRED IMPORTED_TARGET curlpp)' \
      --replace-fail \
        'unofficial::curlpp::curlpp' \
        'PkgConfig::CURLPP' \
      --replace-fail \
        'find_package(unofficial-inih CONFIG REQUIRED)' \
        'pkg_check_modules(INIH REQUIRED IMPORTED_TARGET INIReader)' \
      --replace-fail \
        'unofficial::inih::inireader' \
        'PkgConfig::INIH'

    substituteInPlace miniocpp-config.cmake.in \
      --replace-fail \
        'find_package(unofficial-curlpp CONFIG REQUIRED)' \
        'find_package(PkgConfig REQUIRED)
    pkg_check_modules(CURLPP REQUIRED IMPORTED_TARGET curlpp)' \
      --replace-fail \
        'find_package(unofficial-inih CONFIG REQUIRED)' \
        'pkg_check_modules(INIH REQUIRED IMPORTED_TARGET INIReader)'

    substituteInPlace miniocpp.pc.in \
      --replace-fail \
        'libdir=''${exec_prefix}/@CMAKE_INSTALL_LIBDIR@' \
        'libdir=@CMAKE_INSTALL_FULL_LIBDIR@' \
      --replace-fail \
        'includedir=''${prefix}/@CMAKE_INSTALL_INCLUDEDIR@' \
        'includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@'
  '';

  strictDeps = true;
  nativeBuildInputs = [
    cmake
    pkg-config
  ];
  buildInputs = [
    curl
    curlpp
    inih
    nlohmann_json
    openssl
    pugixml
    zlib
  ];

  cmakeFlags = [
    (lib.cmakeBool "MINIO_CPP_TEST" false)
    (lib.cmakeBool "MINIO_CPP_MAKE_DOC" false)
  ];

  meta = {
    description = "MinIO C++ Client SDK for Amazon S3 Compatible Cloud Storage";
    homepage = "https://github.com/minio/minio-cpp";
    license = lib.licenses.asl20;
    platforms = lib.platforms.unix;
    maintainers = with lib.maintainers; [
      cyrusknopf
      drupol
      roquess
    ];
  };
})
+114 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  cmake,
  pkg-config,
  gitMinimal,
  bison,
  flex,
  inih,
  minio-cpp,
  curl,
  curlpp,
  nlohmann_json,
  openssl,
  openblas,
  pugixml,
  faiss,
  zlib,
  llvmPackages_20,
  versionCheckHook,
}:

let
  turingstdenv = if stdenv.isDarwin then llvmPackages_20.stdenv else stdenv;
in
turingstdenv.mkDerivation (finalAttrs: {
  pname = "turingdb";
  version = "1.22";

  src = fetchFromGitHub {
    owner = "turing-db";
    repo = "turingdb";
    tag = "v${finalAttrs.version}";
    hash = "sha256-gG3KzEC90nLbIisBt4xnHXtz6LesqJxaviIkTrcTMG0=";

    fetchSubmodules = true;

    leaveDotGit = true;
    postFetch = ''
      git -C $out log -1 --format=%ct > $out/HEAD_COMMIT_TIMESTAMP
      rm -rf $out/.git
    '';
  };

  postPatch = ''
    substituteInPlace storage/dump/DumpConfig.h \
      --replace-fail HEAD_COMMIT_TIMESTAMP "$(cat $src/HEAD_COMMIT_TIMESTAMP)"
  '';

  strictDeps = true;

  nativeBuildInputs = [
    bison
    cmake
    flex
    gitMinimal
    pkg-config
  ];

  buildInputs = [
    curl
    curlpp
    faiss
    inih
    minio-cpp
    nlohmann_json
    openblas
    openssl
    pugixml
    zlib
  ]
  ++ lib.optionals turingstdenv.isDarwin [ llvmPackages_20.openmp ]
  ++ lib.optionals stdenv.isLinux [ stdenv.cc.cc.lib ];

  cmakeFlags = [
    (lib.cmakeBool "NIX_BUILD" true)
    (lib.cmakeFeature "CMAKE_BUILD_TYPE" "Release")
    (lib.cmakeFeature "CMAKE_CXX_FLAGS" "-fopenmp")
    (lib.cmakeFeature "CMAKE_EXE_LINKER_FLAGS" "-lgomp")
    (lib.cmakeFeature "FLEX_INCLUDE_DIR" "${lib.getDev flex}/include")
  ]
  ++ lib.optionals stdenv.isDarwin [
    (lib.cmakeFeature "OpenMP_CXX_FLAGS" "-fopenmp")
    (lib.cmakeFeature "OpenMP_CXX_LIB_NAMES" "omp")
    (lib.cmakeFeature "OpenMP_omp_LIBRARY" "${lib.getLib llvmPackages_20.openmp}/lib/libomp.dylib")
  ];

  nativeInstallCheckInputs = [ versionCheckHook ];
  # Upstream tests require running a TuringDB server and performing
  # network operations, which are incompatible with the Nix build sandbox.
  doCheck = false;

  meta = {
    description = "High performance in-memory column-oriented graph database engine";
    longDescription = ''
      TuringDB is a high-performance in-memory column-oriented graph
      database engine designed for analytical and read-intensive workloads.
    '';
    homepage = "https://turingdb.ai";
    changelog = "https://github.com/turing-db/turingdb/releases/tag/v${finalAttrs.version}";
    license = lib.licenses.bsl11;
    platforms = [
      "x86_64-linux"
      "aarch64-darwin"
    ];
    mainProgram = "turingdb";
    maintainers = with lib.maintainers; [
      cyrusknopf
      drupol
      roquess
    ];
  };
})