From 2414fefb794f861708d303d84aee72b2dd7300af Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Fri, 20 Jun 2025 10:57:28 +0100 Subject: [PATCH 1/5] python3Packages.chromadb: improve doCheck condition On aarch64-linux onnxruntime cannot be imported, as it attempts to read /sys/devices/system/cpu, which does not exist in the sandbox. As onnxruntime cannot be imported, chromadb cannot be tested. However, this issue only applies in the build sandbox, not at runtime. Therefore the package doesn't need to be marked broken. Updated the condition to check `buildPlatform` instead of `hostPlatform`, as the issue relates to the build sandbox and is not a runtime issue. Use `isAarch` and `isLinux` attributes instead of doing string comparison. --- See https://github.com/NixOS/nixpkgs/pull/412528#discussion_r2129396116 And upstream onnxruntime issue: https://github.com/microsoft/onnxruntime/issues/10038 --- pkgs/development/python-modules/chromadb/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/chromadb/default.nix b/pkgs/development/python-modules/chromadb/default.nix index 868cd5a7ca42..af829cbb5c1a 100644 --- a/pkgs/development/python-modules/chromadb/default.nix +++ b/pkgs/development/python-modules/chromadb/default.nix @@ -171,10 +171,10 @@ buildPythonPackage rec { # Disable on aarch64-linux due to broken onnxruntime # https://github.com/microsoft/onnxruntime/issues/10038 - pythonImportsCheck = lib.optionals (stdenv.hostPlatform.system != "aarch64-linux") [ "chromadb" ]; + pythonImportsCheck = lib.optionals doCheck [ "chromadb" ]; # Test collection breaks on aarch64-linux - doCheck = stdenv.hostPlatform.system != "aarch64-linux"; + doCheck = with stdenv.buildPlatform; !(isAarch && isLinux); env = { ZSTD_SYS_USE_PKG_CONFIG = true; From 663fb4f23e837d1094fba8f6f2449deeae1b560a Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Fri, 20 Jun 2025 13:03:36 +0100 Subject: [PATCH 2/5] vectorcode: move installShellFiles to nativeBuildInputs It was accidentally in `nativeCheckInputs`, so the build fails when `doCheck = false`. --- pkgs/by-name/ve/vectorcode/package.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/ve/vectorcode/package.nix b/pkgs/by-name/ve/vectorcode/package.nix index 8d69ef0eb627..6113bfa084ca 100644 --- a/pkgs/by-name/ve/vectorcode/package.nix +++ b/pkgs/by-name/ve/vectorcode/package.nix @@ -107,6 +107,10 @@ python.pkgs.buildPythonApplication rec { ]; }; + nativeBuildInputs = [ + installShellFiles + ]; + postInstall = '' $out/bin/vectorcode --print-completion=bash >vectorcode.bash $out/bin/vectorcode --print-completion=zsh >vectorcode.zsh @@ -127,7 +131,6 @@ python.pkgs.buildPythonApplication rec { nativeCheckInputs = [ - installShellFiles versionCheckHook ] ++ (with python.pkgs; [ From f40c50966574298066d4a16b54053affd15bfda1 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Wed, 18 Jun 2025 12:36:22 +0100 Subject: [PATCH 3/5] vectorcode: add python passthru This allows accessing the overridden chromadb in the overridden python instance. --- pkgs/by-name/ve/vectorcode/package.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/by-name/ve/vectorcode/package.nix b/pkgs/by-name/ve/vectorcode/package.nix index 6113bfa084ca..ca61d11be394 100644 --- a/pkgs/by-name/ve/vectorcode/package.nix +++ b/pkgs/by-name/ve/vectorcode/package.nix @@ -148,6 +148,12 @@ python.pkgs.buildPythonApplication rec { "test_supported_rerankers_initialization" ]; + passthru = { + # Expose these overridden inputs for debugging + inherit python; + inherit (python.pkgs) chromadb; + }; + meta = { description = "Code repository indexing tool to supercharge your LLM experience"; homepage = "https://github.com/Davidyz/VectorCode"; From 57c2c422b2b655e1b9baa698a4df5b6e8a31defd Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Fri, 20 Jun 2025 12:13:00 +0100 Subject: [PATCH 4/5] vectorcode: inherit `doCheck` from chromadb The tests need to import onnxruntime (a transitive of chromadb), however it has issues running in the build sandbox on aarch64-linux. It may work at runtime, so the package is not marked broken, however it will break tests, so the check phase is disabled when building on aarch64-linux. Since the issue comes via chromadb, we inherit its `doCheck` attribute. --- pkgs/by-name/ve/vectorcode/package.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/by-name/ve/vectorcode/package.nix b/pkgs/by-name/ve/vectorcode/package.nix index ca61d11be394..7ada551b10b0 100644 --- a/pkgs/by-name/ve/vectorcode/package.nix +++ b/pkgs/by-name/ve/vectorcode/package.nix @@ -127,6 +127,12 @@ python.pkgs.buildPythonApplication rec { }; ''; + # Test collection breaks on aarch64-linux, because the transitive onnxruntime + # tries to read /sys/devices/system/cpu, which does not exist in the sandbox. + # + # We inherit the issue from chromadb, so inherit its `doCheck` attribute. + inherit (python.pkgs.chromadb) doCheck; + pythonImportsCheck = [ "vectorcode" ]; nativeCheckInputs = From 3cf4c4b9dd483dfbc72360bd69281dcd4e5a3dfb Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Wed, 18 Jun 2025 11:42:38 +0100 Subject: [PATCH 5/5] vectorcode.chromadb: enable check phase Using a subset of disabled tests from the base package, as others only apply to >1.0 --- Additionally, disable test_chroma.py and test_client.py: These tests have issues running in parallel, such as when building the python 3.12 and 3.13 versions simultaneously. E.g. when running nixpkgs-review or unlucky timing in hydra. Usually issues show up as: ValueError: An instance of Chroma already exists for ephemeral with different settings --- pkgs/by-name/ve/vectorcode/package.nix | 42 +++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/ve/vectorcode/package.nix b/pkgs/by-name/ve/vectorcode/package.nix index 7ada551b10b0..a54aac009134 100644 --- a/pkgs/by-name/ve/vectorcode/package.nix +++ b/pkgs/by-name/ve/vectorcode/package.nix @@ -45,7 +45,47 @@ let dependencies = old.dependencies ++ [ self.chroma-hnswlib ]; - doCheck = false; + + # The base package disables additional tests, so explicitly override + disabledTests = [ + # Tests are flaky / timing sensitive + "test_fastapi_server_token_authn_allows_when_it_should_allow" + "test_fastapi_server_token_authn_rejects_when_it_should_reject" + + # Issue with event loop + "test_http_client_bw_compatibility" + + # httpx ReadError + "test_not_existing_collection_delete" + ]; + + disabledTestPaths = [ + # Tests require network access + "chromadb/test/auth/test_simple_rbac_authz.py" + "chromadb/test/db/test_system.py" + "chromadb/test/ef/test_default_ef.py" + "chromadb/test/property/" + "chromadb/test/property/test_cross_version_persist.py" + "chromadb/test/stress/" + "chromadb/test/test_api.py" + + # httpx failures + "chromadb/test/api/test_delete_database.py" + + # Cannot be loaded by pytest without path hacks (fixed in 1.0.0) + "chromadb/test/test_logservice.py" + "chromadb/test/proto/test_utils.py" + "chromadb/test/segment/distributed/test_protobuf_translation.py" + + # Hypothesis FailedHealthCheck due to nested @given tests + "chromadb/test/cache/test_cache.py" + + # Tests fail when running in parallel. + # E.g. when building the building python 3.12 and 3.13 versions simultaneously. + # ValueError: An instance of Chroma already exists for ephemeral with different settings + "chromadb/test/test_chroma.py" + "chromadb/test/test_client.py" + ]; }); }; };