Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 cargo, 4 fetchFromGitHub, 5 installShellFiles, 6 pkg-config, 7 protobuf, 8 python3, 9 rustc, 10 rustPlatform, 11 versionCheckHook, 12 13 lspSupport ? true, 14}: 15 16let 17 python = python3.override { 18 packageOverrides = self: super: { 19 # https://github.com/Davidyz/VectorCode/pull/36 20 chromadb = super.chromadb.overridePythonAttrs (old: rec { 21 version = "0.6.3"; 22 src = fetchFromGitHub { 23 owner = "chroma-core"; 24 repo = "chroma"; 25 tag = version; 26 hash = "sha256-yvAX8buETsdPvMQmRK5+WFz4fVaGIdNlfhSadtHwU5U="; 27 }; 28 cargoDeps = rustPlatform.fetchCargoVendor { 29 pname = "chromadb"; 30 inherit version src; 31 hash = "sha256-lHRBXJa/OFNf4x7afEJw9XcuDveTBIy3XpQ3+19JXn4="; 32 }; 33 postPatch = null; 34 build-system = with self; [ 35 setuptools 36 setuptools-scm 37 ]; 38 nativeBuildInputs = [ 39 cargo 40 pkg-config 41 protobuf 42 rustc 43 rustPlatform.cargoSetupHook 44 ]; 45 dependencies = old.dependencies ++ [ 46 self.chroma-hnswlib 47 ]; 48 49 # The base package disables additional tests, so explicitly override 50 disabledTests = [ 51 # Tests are flaky / timing sensitive 52 "test_fastapi_server_token_authn_allows_when_it_should_allow" 53 "test_fastapi_server_token_authn_rejects_when_it_should_reject" 54 55 # Issue with event loop 56 "test_http_client_bw_compatibility" 57 58 # httpx ReadError 59 "test_not_existing_collection_delete" 60 ]; 61 62 disabledTestPaths = [ 63 # Tests require network access 64 "chromadb/test/auth/test_simple_rbac_authz.py" 65 "chromadb/test/db/test_system.py" 66 "chromadb/test/ef/test_default_ef.py" 67 "chromadb/test/property/" 68 "chromadb/test/property/test_cross_version_persist.py" 69 "chromadb/test/stress/" 70 "chromadb/test/test_api.py" 71 72 # httpx failures 73 "chromadb/test/api/test_delete_database.py" 74 75 # Cannot be loaded by pytest without path hacks (fixed in 1.0.0) 76 "chromadb/test/test_logservice.py" 77 "chromadb/test/proto/test_utils.py" 78 "chromadb/test/segment/distributed/test_protobuf_translation.py" 79 80 # Hypothesis FailedHealthCheck due to nested @given tests 81 "chromadb/test/cache/test_cache.py" 82 83 # Tests fail when running in parallel. 84 # E.g. when building the building python 3.12 and 3.13 versions simultaneously. 85 # ValueError: An instance of Chroma already exists for ephemeral with different settings 86 "chromadb/test/test_chroma.py" 87 "chromadb/test/test_client.py" 88 "chromadb/test/ef/test_multimodal_ef.py" 89 ]; 90 }); 91 }; 92 }; 93in 94python.pkgs.buildPythonApplication rec { 95 pname = "vectorcode"; 96 version = "0.7.7"; 97 pyproject = true; 98 99 src = fetchFromGitHub { 100 owner = "Davidyz"; 101 repo = "VectorCode"; 102 tag = version; 103 hash = "sha256-c8Wp/bP5KHDN/i2bMyiOQgnHDw8tPbg4IZIQ5Ut4SIo="; 104 }; 105 106 build-system = with python.pkgs; [ 107 pdm-backend 108 ]; 109 110 pythonRelaxDeps = [ 111 "posthog" 112 ]; 113 dependencies = 114 with python.pkgs; 115 [ 116 chromadb 117 colorlog 118 httpx 119 json5 120 numpy 121 pathspec 122 psutil 123 pygments 124 python-dotenv 125 sentence-transformers 126 shtab 127 tabulate 128 transformers 129 tree-sitter 130 tree-sitter-language-pack 131 ] 132 ++ lib.optionals lspSupport optional-dependencies.lsp; 133 134 optional-dependencies = with python.pkgs; { 135 intel = [ 136 openvino 137 optimum 138 ]; 139 legacy = [ 140 numpy 141 torch 142 transformers 143 ]; 144 lsp = [ 145 lsprotocol 146 pygls 147 ]; 148 mcp = [ 149 mcp 150 pydantic 151 ]; 152 }; 153 154 nativeBuildInputs = [ 155 installShellFiles 156 ]; 157 158 postInstall = '' 159 $out/bin/vectorcode --print-completion=bash >vectorcode.bash 160 $out/bin/vectorcode --print-completion=zsh >vectorcode.zsh 161 installShellCompletion vectorcode.{bash,zsh} 162 ''; 163 164 makeWrapperArgs = [ 165 "--prefix" 166 "PYTHONPATH" 167 ":" 168 "$PYTHONPATH" 169 ]; 170 171 pythonImportsCheck = [ "vectorcode" ]; 172 173 nativeCheckInputs = [ 174 versionCheckHook 175 ] 176 ++ (with python.pkgs; [ 177 mcp 178 pygls 179 pytestCheckHook 180 ]); 181 versionCheckProgramArg = "version"; 182 183 disabledTests = [ 184 # Require internet access 185 "test_get_embedding_function" 186 "test_get_embedding_function_fallback" 187 "test_get_reranker" 188 "test_supported_rerankers_initialization" 189 ]; 190 191 passthru = { 192 # Expose these overridden inputs for debugging 193 inherit python; 194 inherit (python.pkgs) chromadb; 195 }; 196 197 meta = { 198 description = "Code repository indexing tool to supercharge your LLM experience"; 199 homepage = "https://github.com/Davidyz/VectorCode"; 200 changelog = "https://github.com/Davidyz/VectorCode/releases/tag/${src.tag}"; 201 license = lib.licenses.mit; 202 maintainers = with lib.maintainers; [ GaetanLepage ]; 203 mainProgram = "vectorcode"; 204 badPlatforms = [ 205 # Error in cpuinfo: failed to parse the list of possible processors in /sys/devices/system/cpu/possible 206 # Error in cpuinfo: failed to parse the list of present processors in /sys/devices/system/cpu/present 207 # Error in cpuinfo: failed to parse both lists of possible and present processors 208 # terminate called after throwing an instance of 'onnxruntime::OnnxRuntimeException' 209 # what(): /build/source/include/onnxruntime/core/common/logging/logging.h:371 static const onnxruntime::logging::Logger& onnxruntime::logging::LoggingManager::DefaultLogger() Attempt to use DefaultLogger but none has been registered. 210 # 211 # Since 0.7.4, disabling `pythonImportsCheck` and `pytestCheckPhase` is not enough anymore. 212 # The error above happens at the end of `pypaInstallPhase`. 213 "aarch64-linux" 214 ]; 215 }; 216}