postgresqlPackages.pgvecto-rs: 0.3.0 -> 0.4.0 (#357677)
This commit is contained in:
commit
3ecfad3b77
@ -1,17 +1,19 @@
|
||||
{ lib
|
||||
, darwin
|
||||
, fetchCrate
|
||||
, openssl
|
||||
, pkg-config
|
||||
, rustPlatform
|
||||
, stdenv
|
||||
{
|
||||
lib,
|
||||
darwin,
|
||||
fetchCrate,
|
||||
openssl,
|
||||
pkg-config,
|
||||
rustPlatform,
|
||||
stdenv,
|
||||
}:
|
||||
|
||||
let
|
||||
generic =
|
||||
{ version
|
||||
, hash
|
||||
, cargoHash
|
||||
{
|
||||
version,
|
||||
hash,
|
||||
cargoHash,
|
||||
}:
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "cargo-pgrx";
|
||||
@ -24,14 +26,12 @@ let
|
||||
|
||||
inherit cargoHash;
|
||||
|
||||
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
];
|
||||
|
||||
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
|
||||
buildInputs = [
|
||||
openssl
|
||||
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
darwin.apple_sdk.frameworks.Security
|
||||
];
|
||||
|
||||
preCheck = ''
|
||||
@ -54,10 +54,10 @@ let
|
||||
};
|
||||
in
|
||||
{
|
||||
cargo-pgrx_0_12_0_alpha_1 = generic {
|
||||
version = "0.12.0-alpha.1";
|
||||
hash = "sha256-0m9oaqjU42RYyttkTihADDrRMjr2WoK/8sInZALeHws=";
|
||||
cargoHash = "sha256-9XTIcpoCnROP63ZTDgMMMmj0kPggiTazKlKQfCgXKzk=";
|
||||
cargo-pgrx_0_12_5 = generic {
|
||||
version = "0.12.5";
|
||||
hash = "sha256-U2kF+qjQwMTaocv5f4p5y3qmPUsTzdvAp8mz9cn/COw=";
|
||||
cargoHash = "sha256-nEgIOBGNG3TupA55/TgoXDPeJzjBjOGGfK+WjrH06VY=";
|
||||
};
|
||||
|
||||
cargo-pgrx_0_12_6 = generic {
|
||||
|
@ -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))]
|
@ -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");
|
3373
pkgs/servers/sql/postgresql/ext/pgvecto-rs/Cargo.lock
generated
3373
pkgs/servers/sql/postgresql/ext/pgvecto-rs/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -1,22 +1,22 @@
|
||||
{ lib
|
||||
, buildPgrxExtension
|
||||
, cargo-pgrx_0_12_0_alpha_1
|
||||
, clang_16
|
||||
, fetchFromGitHub
|
||||
, nix-update-script
|
||||
, nixosTests
|
||||
, openssl
|
||||
, pkg-config
|
||||
, postgresql
|
||||
, rustPlatform
|
||||
, stdenv
|
||||
, substituteAll
|
||||
{
|
||||
lib,
|
||||
buildPgrxExtension,
|
||||
cargo-pgrx_0_12_5,
|
||||
clang_16,
|
||||
fetchFromGitHub,
|
||||
nix-update-script,
|
||||
nixosTests,
|
||||
openssl,
|
||||
pkg-config,
|
||||
postgresql,
|
||||
rustPlatform,
|
||||
stdenv,
|
||||
}:
|
||||
|
||||
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,78 +26,69 @@ 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;
|
||||
})
|
||||
rec {
|
||||
inherit postgresql;
|
||||
|
||||
pname = "pgvecto-rs";
|
||||
version = "0.3.0";
|
||||
pname = "pgvecto-rs";
|
||||
version = "0.4.0";
|
||||
|
||||
buildInputs = [ openssl ];
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
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;
|
||||
})
|
||||
];
|
||||
patches = [
|
||||
./0001-add-rustc-feature-flags.diff
|
||||
];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "tensorchord";
|
||||
repo = "pgvecto.rs";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-X7BY2Exv0xQNhsS/GA7GNvj9OeVDqVCd/k3lUkXtfgE=";
|
||||
};
|
||||
|
||||
# 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=";
|
||||
src = fetchFromGitHub {
|
||||
owner = "tensorchord";
|
||||
repo = "pgvecto.rs";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-4qrDWxYBJuQAtYlwU/zXVvX/ItqO26YAU/OHc/NLEUI=";
|
||||
};
|
||||
};
|
||||
|
||||
# Set appropriate version on vectors.control, otherwise it won't show up on PostgreSQL
|
||||
postPatch = ''
|
||||
substituteInPlace ./vectors.control --subst-var-by CARGO_VERSION ${version}
|
||||
'';
|
||||
useFetchCargoVendor = true;
|
||||
cargoHash = "sha256-cyXKfkLju0hZe7IdNQ50AhhaEFtj795iaRutiQRuwZc=";
|
||||
|
||||
# Include upgrade scripts in the final package
|
||||
# https://github.com/tensorchord/pgvecto.rs/blob/v0.2.0/scripts/ci_package.sh#L6-L8
|
||||
postInstall = ''
|
||||
cp sql/upgrade/* $out/share/postgresql/extension/
|
||||
'';
|
||||
# Set appropriate version on vectors.control, otherwise it won't show up on PostgreSQL
|
||||
postPatch = ''
|
||||
substituteInPlace ./vectors.control --subst-var-by CARGO_VERSION ${version}
|
||||
'';
|
||||
|
||||
env = {
|
||||
# Needed to get openssl-sys to use pkg-config.
|
||||
OPENSSL_NO_VENDOR = 1;
|
||||
# Include upgrade scripts in the final package
|
||||
# https://github.com/tensorchord/pgvecto.rs/blob/v0.4.0/scripts/package.sh#L15
|
||||
postInstall = ''
|
||||
cp sql/upgrade/* $out/share/postgresql/extension/
|
||||
'';
|
||||
|
||||
# Bypass rust nightly features not being available on rust stable
|
||||
RUSTC_BOOTSTRAP = 1;
|
||||
};
|
||||
env = {
|
||||
# Needed to get openssl-sys to use pkg-config.
|
||||
OPENSSL_NO_VENDOR = 1;
|
||||
|
||||
# This crate does not have the "pg_test" feature
|
||||
usePgTestCheckFeature = false;
|
||||
# Bypass rust nightly features not being available on rust stable
|
||||
RUSTC_BOOTSTRAP = 1;
|
||||
};
|
||||
|
||||
passthru = {
|
||||
updateScript = nix-update-script { };
|
||||
tests = nixosTests.postgresql.pgvecto-rs.passthru.override postgresql;
|
||||
};
|
||||
# This crate does not have the "pg_test" feature
|
||||
usePgTestCheckFeature = false;
|
||||
|
||||
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";
|
||||
description = "Scalable, Low-latency and Hybrid-enabled Vector Search in Postgres";
|
||||
homepage = "https://github.com/tensorchord/pgvecto.rs";
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ diogotcorreia esclear ];
|
||||
};
|
||||
}
|
||||
passthru = {
|
||||
updateScript = nix-update-script { };
|
||||
tests = nixosTests.postgresql.pgvecto-rs.passthru.override postgresql;
|
||||
};
|
||||
|
||||
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");
|
||||
description = "Scalable, Low-latency and Hybrid-enabled Vector Search in Postgres";
|
||||
homepage = "https://github.com/tensorchord/pgvecto.rs";
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [
|
||||
diogotcorreia
|
||||
esclear
|
||||
];
|
||||
};
|
||||
}
|
||||
|
@ -6967,7 +6967,7 @@ with pkgs;
|
||||
inherit (darwin.apple_sdk.frameworks) CoreFoundation CoreServices Security SystemConfiguration;
|
||||
};
|
||||
inherit (callPackages ../development/tools/rust/cargo-pgrx { })
|
||||
cargo-pgrx_0_12_0_alpha_1
|
||||
cargo-pgrx_0_12_5
|
||||
cargo-pgrx_0_12_6
|
||||
;
|
||||
cargo-pgrx = cargo-pgrx_0_12_6;
|
||||
|
Loading…
Reference in New Issue
Block a user