nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 ninja,
7 openssl,
8 openjdk11,
9 python3,
10 unixODBC,
11 withJdbc ? false,
12 withOdbc ? false,
13 versionCheckHook,
14}:
15
16let
17 versions = lib.importJSON ./versions.json;
18in
19stdenv.mkDerivation (finalAttrs: {
20 pname = "duckdb";
21 inherit (versions) rev version;
22
23 src = fetchFromGitHub {
24 # to update run:
25 # nix-shell maintainers/scripts/update.nix --argstr path duckdb
26 inherit (versions) hash;
27 owner = "duckdb";
28 repo = "duckdb";
29 tag = "v${finalAttrs.version}";
30 };
31
32 outputs = [
33 "out"
34 "lib"
35 "dev"
36 ];
37
38 nativeBuildInputs = [
39 cmake
40 ninja
41 python3
42 ];
43 buildInputs = [
44 openssl
45 ]
46 ++ lib.optionals withJdbc [ openjdk11 ]
47 ++ lib.optionals withOdbc [ unixODBC ];
48
49 cmakeFlags = [
50 (lib.cmakeFeature "DUCKDB_EXTENSION_CONFIGS" "${finalAttrs.src}/.github/config/in_tree_extensions.cmake")
51 (lib.cmakeBool "BUILD_ODBC_DRIVER" withOdbc)
52 (lib.cmakeBool "JDBC_DRIVER" withJdbc)
53 (lib.cmakeFeature "OVERRIDE_GIT_DESCRIBE" "v${finalAttrs.version}-0-g${finalAttrs.rev}")
54 # development settings
55 (lib.cmakeBool "BUILD_UNITTESTS" finalAttrs.doInstallCheck)
56 ];
57
58 doInstallCheck = true;
59
60 nativeInstallCheckInputs = [ versionCheckHook ];
61
62 installCheckPhase =
63 let
64 excludes = map (pattern: "exclude:'${pattern}'") (
65 [
66 "[s3]"
67 "Test closing database during long running query"
68 "Test using a remote optimizer pass in case thats important to someone"
69 "test/common/test_cast_hugeint.test"
70 "test/sql/copy/csv/test_csv_remote.test"
71 "test/sql/copy/parquet/test_parquet_remote.test"
72 "test/sql/copy/parquet/test_parquet_remote_foreign_files.test"
73 "test/sql/storage/compression/chimp/chimp_read.test"
74 "test/sql/storage/compression/chimp/chimp_read_float.test"
75 "test/sql/storage/compression/patas/patas_compression_ratio.test_coverage"
76 "test/sql/storage/compression/patas/patas_read.test"
77 "test/sql/json/read_json_objects.test"
78 "test/sql/json/read_json.test"
79 "test/sql/json/table/read_json_objects.test"
80 "test/sql/json/table/read_json.test"
81 "test/sql/copy/parquet/parquet_5968.test"
82 "test/fuzzer/pedro/buffer_manager_out_of_memory.test"
83 "test/sql/storage/compression/bitpacking/bitpacking_size_calculation.test"
84 "test/sql/copy/parquet/delta_byte_array_length_mismatch.test"
85 "test/sql/function/timestamp/test_icu_strptime.test"
86 "test/sql/timezone/test_icu_timezone.test"
87 "test/sql/copy/parquet/snowflake_lineitem.test"
88 "test/sql/copy/parquet/test_parquet_force_download.test"
89 "test/sql/copy/parquet/delta_byte_array_multiple_pages.test"
90 "test/sql/copy/csv/test_csv_httpfs_prepared.test"
91 "test/sql/copy/csv/test_csv_httpfs.test"
92 "test/sql/settings/test_disabled_file_system_httpfs.test"
93 "test/sql/copy/csv/parallel/test_parallel_csv.test"
94 "test/sql/copy/csv/parallel/csv_parallel_httpfs.test"
95 "test/common/test_cast_struct.test"
96 # test is order sensitive
97 "test/sql/copy/parquet/parquet_glob.test"
98 # these are only hidden if no filters are passed in
99 "[!hide]"
100 # this test apparently never terminates
101 "test/sql/copy/csv/auto/test_csv_auto.test"
102 # test expects installed file timestamp to be > 2024
103 "test/sql/table_function/read_text_and_blob.test"
104 # fails with Out of Memory Error
105 "test/sql/copy/parquet/batched_write/batch_memory_usage.test"
106 # wants http connection
107 "test/sql/copy/csv/recursive_query_csv.test"
108 "test/sql/copy/csv/test_mixed_lines.test"
109 "test/parquet/parquet_long_string_stats.test"
110 "test/sql/attach/attach_remote.test"
111 "test/sql/copy/csv/test_sniff_httpfs.test"
112 "test/sql/httpfs/internal_issue_2490.test"
113 # fails with incorrect result
114 # Upstream issue https://github.com/duckdb/duckdb/issues/14294
115 "test/sql/copy/file_size_bytes.test"
116 # https://github.com/duckdb/duckdb/issues/17757#issuecomment-3032080432
117 "test/issues/general/test_17757.test"
118 ]
119 ++ lib.optionals stdenv.hostPlatform.isAarch64 [
120 "test/sql/aggregate/aggregates/test_kurtosis.test"
121 "test/sql/aggregate/aggregates/test_skewness.test"
122 "test/sql/function/list/aggregates/skewness.test"
123 "test/sql/aggregate/aggregates/histogram_table_function.test"
124 ]
125 );
126 LD_LIBRARY_PATH = lib.optionalString stdenv.hostPlatform.isDarwin "DY" + "LD_LIBRARY_PATH";
127 in
128 ''
129 runHook preInstallCheck
130 (($(ulimit -n) < 1024)) && ulimit -n 1024
131
132 HOME="$(mktemp -d)" ${LD_LIBRARY_PATH}="$lib/lib" ./test/unittest ${toString excludes}
133
134 runHook postInstallCheck
135 '';
136
137 passthru.updateScript = ./update.sh;
138 passthru.pythonHash = versions.python_hash;
139
140 meta = {
141 changelog = "https://github.com/duckdb/duckdb/releases/tag/v${finalAttrs.version}";
142 description = "Embeddable SQL OLAP Database Management System";
143 homepage = "https://duckdb.org/";
144 license = lib.licenses.mit;
145 mainProgram = "duckdb";
146 maintainers = with lib.maintainers; [
147 costrouc
148 cpcloud
149 ];
150 platforms = lib.platforms.all;
151 };
152})