2022-02-12 11:23:04 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-05-27 02:27:11 +01:00
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
2022-02-11 20:53:27 +00:00
|
|
|
, ninja
|
2022-02-12 11:23:04 +00:00
|
|
|
, openssl
|
|
|
|
, openjdk11
|
|
|
|
, unixODBC
|
|
|
|
, withHttpFs ? true
|
|
|
|
, withJdbc ? false
|
|
|
|
, withOdbc ? false
|
2020-05-27 02:27:11 +01:00
|
|
|
}:
|
|
|
|
|
2022-02-12 11:23:04 +00:00
|
|
|
let
|
|
|
|
enableFeature = yes: if yes then "ON" else "OFF";
|
|
|
|
in
|
2020-05-27 02:27:11 +01:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "duckdb";
|
2022-04-30 13:48:25 +01:00
|
|
|
version = "0.3.4";
|
2020-05-27 02:27:11 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2021-10-22 09:42:51 +01:00
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
2020-05-27 02:27:11 +01:00
|
|
|
rev = "v${version}";
|
2022-04-30 13:48:25 +01:00
|
|
|
sha256 = "sha256-2PBc5qe2md87u2nvMTx/XZVzLsr8QrvUkw46/6VTlGs=";
|
2020-05-27 02:27:11 +01:00
|
|
|
};
|
|
|
|
|
2022-02-12 11:23:04 +00:00
|
|
|
patches = [ ./version.patch ];
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace CMakeLists.txt --subst-var-by DUCKDB_VERSION "v${version}"
|
|
|
|
'';
|
|
|
|
|
2022-02-11 20:53:45 +00:00
|
|
|
cmakeFlags = [
|
2022-04-30 13:48:25 +01:00
|
|
|
"-DBUILD_EXCEL_EXTENSION=ON"
|
2022-02-12 11:23:04 +00:00
|
|
|
"-DBUILD_FTS_EXTENSION=ON"
|
|
|
|
"-DBUILD_HTTPFS_EXTENSION=${enableFeature withHttpFs}"
|
|
|
|
"-DBUILD_ICU_EXTENSION=ON"
|
2022-04-30 13:48:25 +01:00
|
|
|
"-DBUILD_JSON_EXTENSION=ON"
|
2022-02-12 11:23:04 +00:00
|
|
|
"-DBUILD_ODBC_DRIVER=${enableFeature withOdbc}"
|
|
|
|
"-DBUILD_PARQUET_EXTENSION=ON"
|
2022-04-30 13:48:25 +01:00
|
|
|
"-DBUILD_REST=ON"
|
|
|
|
"-DBUILD_SUBSTRAIT_EXTENSION=ON"
|
2022-02-12 11:23:04 +00:00
|
|
|
"-DBUILD_TPCDS_EXTENSION=ON"
|
2022-04-30 13:48:25 +01:00
|
|
|
"-DBUILD_TPCE=ON"
|
2022-02-12 11:23:04 +00:00
|
|
|
"-DBUILD_TPCH_EXTENSION=ON"
|
|
|
|
"-DBUILD_VISUALIZER_EXTENSION=ON"
|
|
|
|
"-DJDBC_DRIVER=${enableFeature withJdbc}"
|
2022-02-11 20:53:45 +00:00
|
|
|
];
|
2022-02-12 11:23:04 +00:00
|
|
|
|
2022-05-01 15:19:26 +01:00
|
|
|
doInstallCheck = true;
|
|
|
|
|
2022-05-02 11:44:57 +01:00
|
|
|
preInstallCheck = lib.optionalString stdenv.isDarwin ''
|
|
|
|
export DYLD_LIBRARY_PATH="$out/lib''${DYLD_LIBRARY_PATH:+:}''${DYLD_LIBRARY_PATH}"
|
|
|
|
'';
|
|
|
|
|
2022-05-01 17:16:08 +01:00
|
|
|
installCheckPhase =
|
|
|
|
let
|
|
|
|
excludes = map (pattern: "exclude:'${pattern}'") [
|
|
|
|
"*test_slow"
|
|
|
|
"Test file buffers for reading/writing to file"
|
|
|
|
"[test_slow]"
|
|
|
|
"test/common/test_cast_hugeint.test"
|
|
|
|
"test/sql/copy/csv/test_csv_remote.test"
|
|
|
|
"test/sql/copy/parquet/test_parquet_remote.test"
|
|
|
|
] ++ lib.optionals stdenv.isAarch64 [
|
|
|
|
"test/sql/aggregate/aggregates/test_kurtosis.test"
|
|
|
|
"test/sql/aggregate/aggregates/test_skewness.test"
|
|
|
|
"test/sql/function/list/aggregates/skewness.test"
|
|
|
|
];
|
|
|
|
in
|
|
|
|
''
|
|
|
|
runHook preInstallCheck
|
2022-05-01 15:19:26 +01:00
|
|
|
|
2022-05-02 11:45:13 +01:00
|
|
|
$PWD/test/unittest ${lib.concatStringsSep " " excludes}
|
2022-05-01 15:19:26 +01:00
|
|
|
|
2022-05-01 17:16:08 +01:00
|
|
|
runHook postInstallCheck
|
|
|
|
'';
|
2022-05-01 15:19:26 +01:00
|
|
|
|
2022-02-11 20:53:27 +00:00
|
|
|
nativeBuildInputs = [ cmake ninja ];
|
2022-02-12 11:23:04 +00:00
|
|
|
buildInputs = lib.optionals withHttpFs [ openssl ]
|
|
|
|
++ lib.optionals withJdbc [ openjdk11 ]
|
|
|
|
++ lib.optionals withOdbc [ unixODBC ];
|
2020-05-27 02:27:11 +01:00
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2021-10-22 09:42:51 +01:00
|
|
|
homepage = "https://github.com/duckdb/duckdb";
|
2020-10-26 04:08:40 +00:00
|
|
|
description = "Embeddable SQL OLAP Database Management System";
|
2020-05-27 02:27:11 +01:00
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.all;
|
2022-02-11 20:54:00 +00:00
|
|
|
maintainers = with maintainers; [ costrouc cpcloud ];
|
2020-05-27 02:27:11 +01:00
|
|
|
};
|
|
|
|
}
|