diff --git a/flake.nix b/flake.nix index 283a6e4..9fc8ba7 100644 --- a/flake.nix +++ b/flake.nix @@ -84,7 +84,7 @@ name = "patched-nixpkgs-unstable"; src = nixpkgs-unstable-raw; patches = [ - + ./nixpkgs-patches/288913.patch ]; }; nixpkgs-patched = nixpkgs-raw.legacyPackages.x86_64-linux.applyPatches { diff --git a/nixpkgs-patches/288913.patch b/nixpkgs-patches/288913.patch new file mode 100644 index 0000000..6cbc106 --- /dev/null +++ b/nixpkgs-patches/288913.patch @@ -0,0 +1,309 @@ +From e62dac66f96a8b02b612d58438e1d11324083794 Mon Sep 17 00:00:00 2001 +From: annalee <150648636+a-n-n-a-l-e-e@users.noreply.github.com> +Date: Wed, 14 Feb 2024 03:31:15 +0000 +Subject: [PATCH 1/3] duckdb,python311Packages.duckdb: 0.9.2 -> 0.10.0 + +--- + pkgs/development/libraries/duckdb/default.nix | 42 +++++++++++----- + .../libraries/duckdb/version.patch | 2 +- + .../python-modules/duckdb/default.nix | 48 ++++++++++++------- + .../python-modules/duckdb/setup.patch | 30 ------------ + 4 files changed, 62 insertions(+), 60 deletions(-) + delete mode 100644 pkgs/development/python-modules/duckdb/setup.patch + +diff --git a/pkgs/development/libraries/duckdb/default.nix b/pkgs/development/libraries/duckdb/default.nix +index 801ad7979aee91..e6645480d2b24a 100644 +--- a/pkgs/development/libraries/duckdb/default.nix ++++ b/pkgs/development/libraries/duckdb/default.nix +@@ -1,10 +1,13 @@ + { lib + , stdenv + , fetchFromGitHub ++, fetchpatch ++, substituteAll + , cmake + , ninja + , openssl + , openjdk11 ++, python3 + , unixODBC + , withJdbc ? false + , withOdbc ? false +@@ -15,22 +18,31 @@ let + in + stdenv.mkDerivation rec { + pname = "duckdb"; +- version = "0.9.2"; ++ version = "0.10.0"; + + src = fetchFromGitHub { + owner = pname; + repo = pname; +- rev = "v${version}"; +- hash = "sha256-QFK8mEMcqQwALFNvAdD8yWixwMYHSbeo6xqx86PvejU="; ++ rev = "refs/tags/v${version}"; ++ hash = "sha256-qGUq0iYTaLNHKqbXNLRmvqHMqunvIlP991IKb4qdSt4="; + }; + +- patches = [ ./version.patch ]; +- +- postPatch = '' +- substituteInPlace CMakeLists.txt --subst-var-by DUCKDB_VERSION "v${version}" +- ''; ++ patches = [ ++ # remove calls to git and set DUCKDB_VERSION to version ++ (substituteAll { ++ src = ./version.patch; ++ version = "v${version}"; ++ }) ++ # add missing file needed for httpfs compile ++ # remove on next update ++ (fetchpatch { ++ name = "missing-httpfs-file.patch"; ++ url = "https://github.com/duckdb/duckdb/commit/3d7aa3ed46ecf5f18122559e385b75f1f5e9aba8.patch"; ++ hash = "sha256-Q4IHCpMpxn86OquUZdEF7P0nHEPOcWS0TQijTkvBYbQ="; ++ }) ++ ]; + +- nativeBuildInputs = [ cmake ninja ]; ++ nativeBuildInputs = [ cmake ninja python3 ]; + buildInputs = [ openssl ] + ++ lib.optionals withJdbc [ openjdk11 ] + ++ lib.optionals withOdbc [ unixODBC ]; +@@ -54,7 +66,7 @@ stdenv.mkDerivation rec { + + installCheckPhase = + let +- excludes = map (pattern: "exclude:'${pattern}'") [ ++ 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" +@@ -91,16 +103,22 @@ stdenv.mkDerivation rec { + "[!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" ++ # can re-enable next update (broken for 0.10.0) ++ "test/sql/secrets/create_secret_non_writable_persistent_dir.test" ++ # https://github.com/duckdb/duckdb/issues/10722 ++ "test/sql/types/nested/list/list_aggregate_dict.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 + +- $PWD/test/unittest ${lib.concatStringsSep " " excludes} ++ ./test/unittest ${toString excludes} + + runHook postInstallCheck + ''; +diff --git a/pkgs/development/libraries/duckdb/version.patch b/pkgs/development/libraries/duckdb/version.patch +index f40785b430797b..122ad4295d41e9 100644 +--- a/pkgs/development/libraries/duckdb/version.patch ++++ b/pkgs/development/libraries/duckdb/version.patch +@@ -52,7 +52,7 @@ index 2b49e11288..0a4a69b9a0 100644 + - set(DUCKDB_DEV_ITERATION 0) + - set(DUCKDB_VERSION "v${DUCKDB_MAJOR_VERSION}.${DUCKDB_MINOR_VERSION}.${DUCKDB_PATCH_VERSION}-dev${DUCKDB_DEV_ITERATION}") + -endif() +-+set(DUCKDB_VERSION "@DUCKDB_VERSION@") +++set(DUCKDB_VERSION "@version@") + + message(STATUS "git hash ${GIT_COMMIT_HASH}, version ${DUCKDB_VERSION}") + +diff --git a/pkgs/development/python-modules/duckdb/default.nix b/pkgs/development/python-modules/duckdb/default.nix +index a7cd1aa36dd45f..fd197f9305d63d 100644 +--- a/pkgs/development/python-modules/duckdb/default.nix ++++ b/pkgs/development/python-modules/duckdb/default.nix +@@ -1,4 +1,5 @@ + { lib ++, stdenv + , buildPythonPackage + , duckdb + , fsspec +@@ -13,25 +14,24 @@ + }: + + buildPythonPackage rec { +- inherit (duckdb) pname version src; +- format = "setuptools"; +- +- # 1. let nix control build cores +- # 2. default to extension autoload & autoinstall disabled +- # 3. unconstrain setuptools_scm version +- patches = (duckdb.patches or []) ++ [ ./setup.patch ]; ++ inherit (duckdb) patches pname src version; ++ pyproject = true; + + postPatch = (duckdb.postPatch or "") + '' + # we can't use sourceRoot otherwise patches don't apply, because the patches apply to the C++ library + cd tools/pythonpkg + +- substituteInPlace setup.py --subst-var NIX_BUILD_CORES +- +- # avoid dependency on mypy +- rm tests/stubs/test_stubs.py ++ # 1. let nix control build cores ++ # 2. default to extension autoload & autoinstall disabled ++ substituteInPlace setup.py \ ++ --replace-fail "ParallelCompile()" 'ParallelCompile("NIX_BUILD_CORES")' \ ++ --replace-fail "define_macros.extend([('DUCKDB_EXTENSION_AUTOLOAD_DEFAULT', '1'), ('DUCKDB_EXTENSION_AUTOINSTALL_DEFAULT', '1')])" "" + ''; + +- BUILD_HTTPFS = 1; ++ env = { ++ BUILD_HTTPFS = 1; ++ DUCKDB_BUILD_UNITY = 1; ++ }; + + nativeBuildInputs = [ + pybind11 +@@ -52,21 +52,35 @@ buildPythonPackage rec { + pytestCheckHook + ]; + ++ # test flags from .github/workflows/Python.yml ++ pytestFlagsArray = [ ++ "--verbose" ++ ] ++ lib.optionals stdenv.isDarwin [ ++ "tests/fast" ++ ]; ++ ++ disabledTestPaths = [ ++ # avoid dependency on mypy ++ "tests/stubs/test_stubs.py" ++ ]; ++ + disabledTests = [ + # tries to make http request + "test_install_non_existent_extension" +- # test is racy and interrupt can be delivered before or after target point ++ ++ # https://github.com/duckdb/duckdb/issues/10702 ++ # tests are racy and interrupt can be delivered before or after target point ++ # causing a later test to fail with a spurious KeyboardInterrupt + "test_connection_interrupt" ++ "test_query_interruption" + ]; + ++ # remove duckdb dir to prevent import confusion by pytest + preCheck = '' + export HOME="$(mktemp -d)" ++ rm -rf duckdb + ''; + +- setupPyBuildFlags = [ +- "--inplace" +- ]; +- + pythonImportsCheck = [ + "duckdb" + ]; +diff --git a/pkgs/development/python-modules/duckdb/setup.patch b/pkgs/development/python-modules/duckdb/setup.patch +deleted file mode 100644 +index 8c8f790a66a1d1..00000000000000 +--- a/pkgs/development/python-modules/duckdb/setup.patch ++++ /dev/null +@@ -1,30 +0,0 @@ +-diff --git a/tools/pythonpkg/setup.py b/tools/pythonpkg/setup.py +-index 30f1e1ccdd..6784169fcb 100644 +---- a/tools/pythonpkg/setup.py +-+++ b/tools/pythonpkg/setup.py +-@@ -96,7 +96,7 @@ def parallel_cpp_compile( +- return +- self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) +- +-- list(multiprocessing.pool.ThreadPool(multiprocessing.cpu_count()).imap(_single_compile, objects)) +-+ list(multiprocessing.pool.ThreadPool(@NIX_BUILD_CORES@).imap(_single_compile, objects)) +- return objects +- +- +-@@ -163,7 +163,6 @@ if 'BUILD_HTTPFS' in os.environ: +- for ext in extensions: +- toolchain_args.extend(['-DDUCKDB_EXTENSION_{}_LINKED'.format(ext.upper())]) +- +--toolchain_args.extend(['-DDUCKDB_EXTENSION_AUTOLOAD_DEFAULT=1', '-DDUCKDB_EXTENSION_AUTOINSTALL_DEFAULT=1']) +- +- +- class get_pybind_include(object): +-@@ -348,7 +347,7 @@ setup( +- packages=packages, +- include_package_data=True, +- python_requires='>=3.7.0', +-- setup_requires=setup_requires + ["setuptools_scm<7.0.0", 'pybind11>=2.6.0'], +-+ setup_requires=setup_requires + ["setuptools_scm", 'pybind11>=2.6.0'], +- use_scm_version=setuptools_scm_conf, +- tests_require=['google-cloud-storage', 'mypy', 'pytest'], +- classifiers=[ + +From e72db5d1718ab74321efde3b05039e202677afae Mon Sep 17 00:00:00 2001 +From: annalee <150648636+a-n-n-a-l-e-e@users.noreply.github.com> +Date: Wed, 14 Feb 2024 23:04:47 +0000 +Subject: [PATCH 2/3] python311Packages.duckdb-engine: 0.9.2 -> 0.11.1 + +--- + pkgs/development/python-modules/duckdb-engine/default.nix | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/pkgs/development/python-modules/duckdb-engine/default.nix b/pkgs/development/python-modules/duckdb-engine/default.nix +index ab82edb0893b7b..efdc1d10ace37c 100644 +--- a/pkgs/development/python-modules/duckdb-engine/default.nix ++++ b/pkgs/development/python-modules/duckdb-engine/default.nix +@@ -14,8 +14,8 @@ + + buildPythonPackage rec { + pname = "duckdb-engine"; +- version = "0.9.2"; +- format = "pyproject"; ++ version = "0.11.1"; ++ pyproject = true; + + disabled = pythonOlder "3.7"; + +@@ -23,7 +23,7 @@ buildPythonPackage rec { + repo = "duckdb_engine"; + owner = "Mause"; + rev = "refs/tags/v${version}"; +- hash = "sha256-T02nGF+YlughRQPinb0I3NC6xsarh4+qRhG8YfhTvhI="; ++ hash = "sha256-GMtQtcKEn2mdryl1KMYnYYeGpdbowP3o4dStwuL8AcU="; + }; + + patches = [ ./remote_data.patch ]; + +From fc7168d8d918b9a8fd11f0c27685b31d9a571f26 Mon Sep 17 00:00:00 2001 +From: annalee <150648636+a-n-n-a-l-e-e@users.noreply.github.com> +Date: Wed, 14 Feb 2024 23:14:49 +0000 +Subject: [PATCH 3/3] python311Packages.sqlglot: 20.9.0 -> 21.1.1 + +--- + pkgs/development/python-modules/sqlglot/default.nix | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/pkgs/development/python-modules/sqlglot/default.nix b/pkgs/development/python-modules/sqlglot/default.nix +index f02a32d0f64f86..7eb9ee70eca91b 100644 +--- a/pkgs/development/python-modules/sqlglot/default.nix ++++ b/pkgs/development/python-modules/sqlglot/default.nix +@@ -11,7 +11,7 @@ + + buildPythonPackage rec { + pname = "sqlglot"; +- version = "20.9.0"; ++ version = "21.1.1"; + pyproject = true; + + disabled = pythonOlder "3.8"; +@@ -20,7 +20,7 @@ buildPythonPackage rec { + repo = "sqlglot"; + owner = "tobymao"; + rev = "refs/tags/v${version}"; +- hash = "sha256-4czhmAJUDRj0x8dCmIXg5BQ1Uvie5vx+UtWdSSY5mnM="; ++ hash = "sha256-xMKDkhotVBkLzn+f9RMGCPfWTF4Rz9a193nSJv5z+iA="; + }; + + nativeBuildInputs = [