diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/duckdb')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/duckdb/default.nix | 128 | ||||
-rwxr-xr-x | nixpkgs/pkgs/development/libraries/duckdb/update.sh | 45 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/libraries/duckdb/versions.json | 5 |
3 files changed, 178 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/duckdb/default.nix b/nixpkgs/pkgs/development/libraries/duckdb/default.nix new file mode 100644 index 000000000000..be1a20987881 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/duckdb/default.nix @@ -0,0 +1,128 @@ +{ lib +, stdenv +, fetchFromGitHub +, fetchpatch +, substituteAll +, cmake +, ninja +, openssl +, openjdk11 +, python3 +, unixODBC +, withJdbc ? false +, withOdbc ? false +}: + +let + enableFeature = yes: if yes then "ON" else "OFF"; + versions = lib.importJSON ./versions.json; +in +stdenv.mkDerivation (finalAttrs: { + pname = "duckdb"; + inherit (versions) rev version; + + src = fetchFromGitHub { + # to update run: + # nix-shell maintainers/scripts/update.nix --argstr path duckdb + inherit (versions) hash; + owner = "duckdb"; + repo = "duckdb"; + rev = "refs/tags/v${finalAttrs.version}"; + }; + + outputs = [ "out" "lib" "dev" ]; + + nativeBuildInputs = [ cmake ninja python3 ]; + buildInputs = [ openssl ] + ++ lib.optionals withJdbc [ openjdk11 ] + ++ lib.optionals withOdbc [ unixODBC ]; + + cmakeFlags = [ + "-DDUCKDB_EXTENSION_CONFIGS=${finalAttrs.src}/.github/config/in_tree_extensions.cmake" + "-DBUILD_ODBC_DRIVER=${enableFeature withOdbc}" + "-DJDBC_DRIVER=${enableFeature withJdbc}" + "-DOVERRIDE_GIT_DESCRIBE=v${finalAttrs.version}-0-g${finalAttrs.rev}" + ] ++ lib.optionals finalAttrs.doInstallCheck [ + # development settings + "-DBUILD_UNITTESTS=ON" + ]; + + postInstall = '' + mkdir -p $lib + mv $out/lib $lib + ''; + + doInstallCheck = true; + + installCheckPhase = + let + excludes = map (pattern: "exclude:'${pattern}'") ([ + "[s3]" + "Test closing database during long running query" + "Test using a remote optimizer pass in case thats important to someone" + "test/common/test_cast_hugeint.test" + "test/sql/copy/csv/test_csv_remote.test" + "test/sql/copy/parquet/test_parquet_remote.test" + "test/sql/copy/parquet/test_parquet_remote_foreign_files.test" + "test/sql/storage/compression/chimp/chimp_read.test" + "test/sql/storage/compression/chimp/chimp_read_float.test" + "test/sql/storage/compression/patas/patas_compression_ratio.test_coverage" + "test/sql/storage/compression/patas/patas_read.test" + "test/sql/json/read_json_objects.test" + "test/sql/json/read_json.test" + "test/sql/json/table/read_json_objects.test" + "test/sql/json/table/read_json.test" + "test/sql/copy/parquet/parquet_5968.test" + "test/fuzzer/pedro/buffer_manager_out_of_memory.test" + "test/sql/storage/compression/bitpacking/bitpacking_size_calculation.test" + "test/sql/copy/parquet/delta_byte_array_length_mismatch.test" + "test/sql/function/timestamp/test_icu_strptime.test" + "test/sql/timezone/test_icu_timezone.test" + "test/sql/copy/parquet/snowflake_lineitem.test" + "test/sql/copy/parquet/test_parquet_force_download.test" + "test/sql/copy/parquet/delta_byte_array_multiple_pages.test" + "test/sql/copy/csv/test_csv_httpfs_prepared.test" + "test/sql/copy/csv/test_csv_httpfs.test" + "test/sql/settings/test_disabled_file_system_httpfs.test" + "test/sql/copy/csv/parallel/test_parallel_csv.test" + "test/sql/copy/csv/parallel/csv_parallel_httpfs.test" + "test/common/test_cast_struct.test" + # test is order sensitive + "test/sql/copy/parquet/parquet_glob.test" + # these are only hidden if no filters are passed in + "[!hide]" + # this test apparently never terminates + "test/sql/copy/csv/auto/test_csv_auto.test" + # test expects installed file timestamp to be > 2024 + "test/sql/table_function/read_text_and_blob.test" + # fails with Out of Memory Error + "test/sql/copy/parquet/batched_write/batch_memory_usage.test" + # wants http connection + "test/sql/copy/csv/test_mixed_lines.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" + ]); + LD_LIBRARY_PATH = lib.optionalString stdenv.isDarwin "DY" + "LD_LIBRARY_PATH"; + in + '' + runHook preInstallCheck + + HOME="$(mktemp -d)" ${LD_LIBRARY_PATH}="$lib/lib" ./test/unittest ${toString excludes} + + runHook postInstallCheck + ''; + + passthru.updateScript = ./update.sh; + + meta = with lib; { + changelog = "https://github.com/duckdb/duckdb/releases/tag/v${finalAttrs.version}"; + description = "Embeddable SQL OLAP Database Management System"; + homepage = "https://duckdb.org/"; + license = licenses.mit; + mainProgram = "duckdb"; + maintainers = with maintainers; [ costrouc cpcloud ]; + platforms = platforms.all; + }; +}) diff --git a/nixpkgs/pkgs/development/libraries/duckdb/update.sh b/nixpkgs/pkgs/development/libraries/duckdb/update.sh new file mode 100755 index 000000000000..f3acd176ee86 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/duckdb/update.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env nix-shell +#!nix-shell --pure -i bash -p cacert curl jq moreutils nix-prefetch +# shellcheck shell=bash + +set -euo pipefail +cd "$(dirname "${BASH_SOURCE[0]}")" + +nixpkgs=$(while [[ ! -e .git ]]; do [[ ${PWD} != / ]] || exit 1; cd ..; done; echo "${PWD}") + +repo=duckdb +owner=duckdb + +msg() { + echo "$*" >&2 +} + +json_get() { + jq -r "$1" < 'versions.json' +} + +json_set() { + jq --arg x "$2" "$1 = \$x" < 'versions.json' | sponge 'versions.json' +} + +get_latest() { + curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} -s \ + "https://api.github.com/repos/${owner}/${repo}/releases/latest" | jq -r .tag_name +} + +get_sha() { + curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} -s \ + "https://api.github.com/repos/${owner}/${repo}/git/ref/tags/$1" | jq -r .object.sha +} + +tag=$(get_latest) +version=${tag/v/} + +[[ ${version} = $(json_get .version) ]] && { msg "${version} is up to date"; exit 0; } + +sha=$(get_sha "${tag}") +sri=$(nix-prefetch -I nixpkgs="${nixpkgs}" -E "duckdb.overrideAttrs { version = \"${version}\"; }") + +json_set ".version" "${version}" +json_set ".rev" "${sha}" +json_set ".hash" "${sri}" diff --git a/nixpkgs/pkgs/development/libraries/duckdb/versions.json b/nixpkgs/pkgs/development/libraries/duckdb/versions.json new file mode 100644 index 000000000000..efb151413e3d --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/duckdb/versions.json @@ -0,0 +1,5 @@ +{ + "version": "0.10.1", + "rev": "4a89d97db8a5a23a15f3025c8d2d2885337c2637", + "hash": "sha256-/j/DaUzsfACI5Izr4lblkYmIEmKsOXr760UTwC0l/qg=" +} |