postgresqlPackages.pgvecto-rs: 0.3.0 -> 0.4.0

This commit is contained in:
Diogo Correia 2024-11-21 11:25:15 +00:00
parent dc1e6a5f3e
commit 80e13b1032
No known key found for this signature in database
GPG Key ID: 12B4F3AC9C065D08
4 changed files with 20 additions and 3417 deletions

View File

@ -0,0 +1,9 @@
diff --git a/crates/base/src/lib.rs b/crates/base/src/lib.rs
index a303bbb..d776e8b 100644
--- a/crates/base/src/lib.rs
+++ b/crates/base/src/lib.rs
@@ -1,3 +1,4 @@
+#![feature(const_float_bits_conv)]
#![feature(avx512_target_feature)]
#![cfg_attr(target_arch = "x86_64", feature(stdarch_x86_avx512))]
#![cfg_attr(target_arch = "x86_64", feature(stdarch_x86_avx512_f16))]

View File

@ -1,19 +0,0 @@
diff --git a/crates/c/build.rs b/crates/c/build.rs
index 8d822e5..8b7e371 100644
--- a/crates/c/build.rs
+++ b/crates/c/build.rs
@@ -1,9 +1,13 @@
fn main() {
println!("cargo:rerun-if-changed=src/f16.h");
println!("cargo:rerun-if-changed=src/f16.c");
+ println!("cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS");
cc::Build::new()
- .compiler("clang-16")
+ .compiler("@clang@")
.file("./src/f16.c")
+ // read env var set by rustPlatform.bindgenHook
+ .try_flags_from_environment("BINDGEN_EXTRA_CLANG_ARGS")
+ .expect("the BINDGEN_EXTRA_CLANG_ARGS environment variable must be specified and UTF-8")
.opt_level(3)
.debug(true)
.compile("vectorsc");

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ lib
, buildPgrxExtension
, cargo-pgrx_0_12_0_alpha_1
, cargo-pgrx_0_12_5
, clang_16
, fetchFromGitHub
, nix-update-script
@ -10,13 +10,12 @@
, postgresql
, rustPlatform
, stdenv
, substituteAll
}:
let
# Upstream only works with clang 16, so we're pinning it here to
# avoid future incompatibility.
# See https://docs.pgvecto.rs/developers/development.html#environment, step 4
# See https://docs.pgvecto.rs/developers/development.html#set-up-development-environment, step 2
clang = clang_16;
rustPlatform' = rustPlatform // {
bindgenHook = rustPlatform.bindgenHook.override { inherit clang; };
@ -26,41 +25,31 @@ in
(buildPgrxExtension.override {
# Upstream only works with a fixed version of cargo-pgrx for each release,
# so we're pinning it here to avoid future incompatibility.
# See https://docs.pgvecto.rs/developers/development.html#environment, step 6
cargo-pgrx = cargo-pgrx_0_12_0_alpha_1;
# See https://docs.pgvecto.rs/developers/development.html#set-up-development-environment, step 5
cargo-pgrx = cargo-pgrx_0_12_5;
rustPlatform = rustPlatform';
}) rec {
inherit postgresql;
pname = "pgvecto-rs";
version = "0.3.0";
version = "0.4.0";
buildInputs = [ openssl ];
nativeBuildInputs = [ pkg-config ];
patches = [
# Tell the `c` crate to use the flags from the rust bindgen hook
(substituteAll {
src = ./0001-read-clang-flags-from-environment.diff;
clang = lib.getExe clang;
})
./0001-add-rustc-feature-flags.diff
];
src = fetchFromGitHub {
owner = "tensorchord";
repo = "pgvecto.rs";
rev = "v${version}";
hash = "sha256-X7BY2Exv0xQNhsS/GA7GNvj9OeVDqVCd/k3lUkXtfgE=";
hash = "sha256-4qrDWxYBJuQAtYlwU/zXVvX/ItqO26YAU/OHc/NLEUI=";
};
# Package has git dependencies on Cargo.lock (instead of just crate.io dependencies),
# so cargoHash does not work, therefore we have to include Cargo.lock in nixpkgs.
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"pgrx-0.12.0-alpha.1" = "sha256-HSQrAR9DFJsi4ZF4hLiJ1sIy+M9Ygva2+WxeUzflOLk=";
};
};
useFetchCargoVendor = true;
cargoHash = "sha256-cyXKfkLju0hZe7IdNQ50AhhaEFtj795iaRutiQRuwZc=";
# Set appropriate version on vectors.control, otherwise it won't show up on PostgreSQL
postPatch = ''
@ -68,7 +57,7 @@ in
'';
# Include upgrade scripts in the final package
# https://github.com/tensorchord/pgvecto.rs/blob/v0.2.0/scripts/ci_package.sh#L6-L8
# https://github.com/tensorchord/pgvecto.rs/blob/v0.4.0/scripts/package.sh#L15
postInstall = ''
cp sql/upgrade/* $out/share/postgresql/extension/
'';
@ -91,10 +80,7 @@ in
meta = with lib; {
# Upstream removed support for PostgreSQL 12 and 13 on 0.3.0: https://github.com/tensorchord/pgvecto.rs/issues/343
broken = stdenv.hostPlatform.isDarwin || (versionOlder postgresql.version "14") ||
# PostgreSQL 17 support issue upstream: https://github.com/tensorchord/pgvecto.rs/issues/607
# Check after next package update.
versionAtLeast postgresql.version "17" && version == "0.3.0";
broken = stdenv.hostPlatform.isDarwin || (versionOlder postgresql.version "14");
description = "Scalable, Low-latency and Hybrid-enabled Vector Search in Postgres";
homepage = "https://github.com/tensorchord/pgvecto.rs";
license = licenses.asl20;