Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 bcrypt, 5 build, 6 buildPythonPackage, 7 cargo, 8 chroma-hnswlib, 9 darwin, 10 fastapi, 11 fetchFromGitHub, 12 grpcio, 13 httpx, 14 hypothesis, 15 importlib-resources, 16 kubernetes, 17 mmh3, 18 numpy, 19 onnxruntime, 20 openssl, 21 opentelemetry-api, 22 opentelemetry-exporter-otlp-proto-grpc, 23 opentelemetry-instrumentation-fastapi, 24 opentelemetry-sdk, 25 orjson, 26 overrides, 27 pkg-config, 28 posthog, 29 protobuf, 30 pulsar-client, 31 pydantic, 32 pypika, 33 pytest-asyncio, 34 pytestCheckHook, 35 pythonOlder, 36 pyyaml, 37 requests, 38 rustc, 39 rustPlatform, 40 setuptools, 41 setuptools-scm, 42 tenacity, 43 tokenizers, 44 tqdm, 45 typer, 46 typing-extensions, 47 uvicorn, 48 zstd, 49}: 50 51buildPythonPackage rec { 52 pname = "chromadb"; 53 version = "0.5.3"; 54 pyproject = true; 55 56 disabled = pythonOlder "3.9"; 57 58 src = fetchFromGitHub { 59 owner = "chroma-core"; 60 repo = "chroma"; 61 rev = "refs/tags/${version}"; 62 hash = "sha256-czDL2b+Jj7mrYZCTfnaZArkOHBaWyTV0BTE2wvykHps="; 63 }; 64 65 cargoDeps = rustPlatform.fetchCargoTarball { 66 inherit src; 67 name = "${pname}-${version}"; 68 hash = "sha256-eTVT1yowuDsajjceWojdUdX466FKneUt1i5QipBFdp4="; 69 }; 70 71 pythonRelaxDeps = [ 72 "chroma-hnswlib" 73 "orjson" 74 ]; 75 76 nativeBuildInputs = [ 77 cargo 78 pkg-config 79 protobuf 80 rustc 81 rustPlatform.cargoSetupHook 82 setuptools 83 setuptools-scm 84 ]; 85 86 buildInputs = [ 87 openssl 88 zstd 89 ] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ]; 90 91 propagatedBuildInputs = [ 92 bcrypt 93 build 94 chroma-hnswlib 95 fastapi 96 grpcio 97 httpx 98 importlib-resources 99 kubernetes 100 mmh3 101 numpy 102 onnxruntime 103 opentelemetry-api 104 opentelemetry-exporter-otlp-proto-grpc 105 opentelemetry-instrumentation-fastapi 106 opentelemetry-sdk 107 orjson 108 overrides 109 posthog 110 pulsar-client 111 pydantic 112 pypika 113 pyyaml 114 requests 115 tenacity 116 tokenizers 117 tqdm 118 typer 119 typing-extensions 120 uvicorn 121 ]; 122 123 nativeCheckInputs = [ 124 hypothesis 125 pytest-asyncio 126 pytestCheckHook 127 ]; 128 129 pythonImportsCheck = [ "chromadb" ]; 130 131 env = { 132 ZSTD_SYS_USE_PKG_CONFIG = true; 133 }; 134 135 pytestFlagsArray = [ "-x" ]; 136 137 preCheck = '' 138 (($(ulimit -n) < 1024)) && ulimit -n 1024 139 export HOME=$(mktemp -d) 140 ''; 141 142 disabledTests = [ 143 # flaky / timing sensitive 144 "test_fastapi_server_token_authn_allows_when_it_should_allow" 145 ]; 146 147 disabledTestPaths = [ 148 # Tests require network access 149 "chromadb/test/auth/test_simple_rbac_authz.py" 150 "chromadb/test/db/test_system.py" 151 "chromadb/test/ef/test_default_ef.py" 152 "chromadb/test/property/" 153 "chromadb/test/property/test_cross_version_persist.py" 154 "chromadb/test/stress/" 155 "chromadb/test/test_api.py" 156 ]; 157 158 __darwinAllowLocalNetworking = true; 159 160 meta = with lib; { 161 description = "AI-native open-source embedding database"; 162 homepage = "https://github.com/chroma-core/chroma"; 163 changelog = "https://github.com/chroma-core/chroma/releases/tag/${version}"; 164 license = licenses.asl20; 165 maintainers = with maintainers; [ fab ]; 166 mainProgram = "chroma"; 167 broken = stdenv.isLinux && stdenv.isAarch64; 168 }; 169}