python313Packages.chromadb: migrate to finalAttrs

This commit is contained in:
Fabian Affolter
2026-01-17 12:57:29 +01:00
parent 6797226ba1
commit 51198b882d
@@ -66,7 +66,7 @@
nix-update-script,
}:
buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
pname = "chromadb";
version = "1.4.1";
pyproject = true;
@@ -74,7 +74,7 @@ buildPythonPackage rec {
src = fetchFromGitHub {
owner = "chroma-core";
repo = "chroma";
tag = version;
tag = finalAttrs.version;
hash = "sha256-mtUxyuLiwA4l9u+pTPVIsYcvsLPPCI6c8iWK6Lgbwjc=";
};
@@ -82,7 +82,7 @@ buildPythonPackage rec {
disabled = pythonAtLeast "3.14";
cargoDeps = rustPlatform.fetchCargoVendor {
inherit pname version src;
inherit (finalAttrs) pname version src;
hash = "sha256-WdWc/8vNzcEtdxmAAbBDWxhMamxSnK2YaZPWwQ2zzU4=";
};
@@ -95,7 +95,7 @@ buildPythonPackage rec {
postPatch = ''
# Nixpkgs is taking the version from `chromadb_rust_bindings` which is versioned independently
substituteInPlace pyproject.toml \
--replace-fail "dynamic = [\"version\"]" "version = \"${version}\""
--replace-fail "dynamic = [\"version\"]" "version = \"${finalAttrs.version}\""
# Flip anonymized telemetry to opt in versus current opt-in out for privacy
substituteInPlace chromadb/config.py \
@@ -108,9 +108,7 @@ buildPythonPackage rec {
"posthog"
];
build-system = [
rustPlatform.maturinBuildHook
];
build-system = [ rustPlatform.maturinBuildHook ];
nativeBuildInputs = [
cargo
@@ -177,14 +175,14 @@ buildPythonPackage rec {
# Disable on aarch64-linux due to broken onnxruntime
# https://github.com/microsoft/onnxruntime/issues/10038
pythonImportsCheck = lib.optionals doCheck [ "chromadb" ];
pythonImportsCheck = lib.optionals finalAttrs.doCheck [ "chromadb" ];
# Test collection breaks on aarch64-linux
doCheck = with stdenv.buildPlatform; !(isAarch && isLinux);
env = {
ZSTD_SYS_USE_PKG_CONFIG = true;
SWAGGER_UI_DOWNLOAD_URL = "file://${swagger-ui}";
SWAGGER_UI_DOWNLOAD_URL = "file://${finalAttrs.swagger-ui}";
};
pytestFlags = [
@@ -269,7 +267,7 @@ buildPythonPackage rec {
meta = {
description = "AI-native open-source embedding database";
homepage = "https://github.com/chroma-core/chroma";
changelog = "https://github.com/chroma-core/chroma/releases/tag/${version}";
changelog = "https://github.com/chroma-core/chroma/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [
fab
@@ -277,4 +275,4 @@ buildPythonPackage rec {
];
mainProgram = "chroma";
};
}
})