nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 zlib,
7 lz4,
8 bzip2,
9 zstd,
10 spdlog,
11 tbb_2022,
12 openssl,
13 boost,
14 libpqxx,
15 clang-tools,
16 catch2_3,
17 python3,
18 doxygen,
19 fixDarwinDylibNames,
20 gtest,
21 rapidcheck,
22 libpng,
23 file,
24 runCommand,
25 useAVX2 ? stdenv.hostPlatform.avx2Support,
26}:
27
28let
29 rapidcheck' = runCommand "rapidcheck" { } ''
30 cp -r ${rapidcheck.out} $out
31 chmod -R +w $out
32 cp -r ${rapidcheck.dev}/* $out
33 '';
34 catch2 = catch2_3;
35 tbb = tbb_2022;
36in
37stdenv.mkDerivation rec {
38 pname = "tiledb";
39 version = "2.28.0";
40
41 src = fetchFromGitHub {
42 owner = "TileDB-Inc";
43 repo = "TileDB";
44 tag = version;
45 hash = "sha256-jNKnc8IPkXDxRUY9QJ+35qt2na1nO6RPeCVWBLb7lME=";
46 };
47
48 patches = lib.optionals stdenv.hostPlatform.isDarwin [ ./generate_embedded_data_header.patch ];
49
50 # libcxx (as of llvm-19) does not yet support `stop_token` and `jthread`
51 # without the -fexperimental-library flag. Tiledb adds its own
52 # implementations in the std namespace which conflict with libcxx. This
53 # test can be re-enabled once libcxx supports stop_token and jthread.
54 postPatch = lib.optionalString (stdenv.cc.libcxx != null) ''
55 truncate -s0 tiledb/stdx/test/CMakeLists.txt
56 '';
57
58 env.TILEDB_DISABLE_AUTO_VCPKG = "1";
59
60 # (bundled) blosc headers have a warning on some archs that it will be using
61 # unaccelerated routines.
62 cmakeFlags = [
63 "-DTILEDB_WEBP=OFF"
64 "-DTILEDB_WERROR=OFF"
65 # https://github.com/NixOS/nixpkgs/issues/144170
66 "-DCMAKE_INSTALL_INCLUDEDIR=include"
67 "-DCMAKE_INSTALL_LIBDIR=lib"
68 ]
69 ++ lib.optional (!useAVX2) "-DCOMPILER_SUPPORTS_AVX2=FALSE";
70
71 nativeBuildInputs = [
72 catch2
73 clang-tools
74 cmake
75 python3
76 doxygen
77 ]
78 ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
79
80 buildInputs = [
81 zlib
82 lz4
83 bzip2
84 zstd
85 spdlog
86 tbb
87 openssl
88 boost
89 libpqxx
90 libpng
91 file
92 rapidcheck'
93 catch2
94 ];
95
96 nativeCheckInputs = [
97 gtest
98 catch2
99 ];
100
101 # test commands taken from
102 # https://github.com/TileDB-Inc/TileDB/blob/dev/.github/workflows/unit-test-runs.yml
103 checkPhase = ''
104 runHook preCheck
105
106 pushd ..
107 cmake --build build --target tests
108 ctest --test-dir build -R '(^unit_|test_assert)' --no-tests=error
109 ctest --test-dir build -R 'test_ci_asserts'
110 popd
111
112 runHook postCheck
113 '';
114
115 installTargets = [
116 "install-tiledb"
117 "doc"
118 ];
119
120 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
121 install_name_tool -add_rpath ${tbb}/lib $out/lib/libtiledb.dylib
122 '';
123
124 meta = {
125 description = "TileDB allows you to manage the massive dense and sparse multi-dimensional array data";
126 homepage = "https://github.com/TileDB-Inc/TileDB";
127 license = lib.licenses.mit;
128 platforms = lib.platforms.unix;
129 maintainers = with lib.maintainers; [ rakesh4g ];
130 };
131}