Loading pkgs/development/tools/rust/cargo-pgrx/default.nix +6 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,12 @@ 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="; Loading pkgs/servers/sql/postgresql/ext/pgvecto-rs/0001-add-rustc-feature-flags.diffdeleted 100644 → 0 +0 −9 Original line number Diff line number Diff line 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))] pkgs/servers/sql/postgresql/ext/pgvecto-rs/0001-read-clang-flags-from-environment.diff 0 → 100644 +19 −0 Original line number Diff line number Diff line 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"); pkgs/servers/sql/postgresql/ext/pgvecto-rs/Cargo.lock 0 → 100644 +3373 −0 File added.Preview size limit exceeded, changes collapsed. Show changes pkgs/servers/sql/postgresql/ext/pgvecto-rs/default.nix +28 −11 Original line number Diff line number Diff line { lib, buildPgrxExtension, cargo-pgrx_0_12_5, cargo-pgrx_0_12_0_alpha_1, clang_16, fetchFromGitHub, nix-update-script, Loading @@ -11,12 +11,13 @@ 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#set-up-development-environment, step 2 # See https://docs.pgvecto.rs/developers/development.html#environment, step 4 clang = clang_16; rustPlatform' = rustPlatform // { bindgenHook = rustPlatform.bindgenHook.override { inherit clang; }; Loading @@ -26,32 +27,42 @@ 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#set-up-development-environment, step 5 cargo-pgrx = cargo-pgrx_0_12_5; # See https://docs.pgvecto.rs/developers/development.html#environment, step 6 cargo-pgrx = cargo-pgrx_0_12_0_alpha_1; rustPlatform = rustPlatform'; }) rec { inherit postgresql; pname = "pgvecto-rs"; version = "0.4.0"; version = "0.3.0"; buildInputs = [ openssl ]; nativeBuildInputs = [ pkg-config ]; patches = [ ./0001-add-rustc-feature-flags.diff # 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; }) ]; src = fetchFromGitHub { owner = "tensorchord"; repo = "pgvecto.rs"; rev = "v${version}"; hash = "sha256-4qrDWxYBJuQAtYlwU/zXVvX/ItqO26YAU/OHc/NLEUI="; hash = "sha256-X7BY2Exv0xQNhsS/GA7GNvj9OeVDqVCd/k3lUkXtfgE="; }; useFetchCargoVendor = true; cargoHash = "sha256-cyXKfkLju0hZe7IdNQ50AhhaEFtj795iaRutiQRuwZc="; # 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="; }; }; # Set appropriate version on vectors.control, otherwise it won't show up on PostgreSQL postPatch = '' Loading @@ -59,7 +70,7 @@ in ''; # Include upgrade scripts in the final package # https://github.com/tensorchord/pgvecto.rs/blob/v0.4.0/scripts/package.sh#L15 # https://github.com/tensorchord/pgvecto.rs/blob/v0.2.0/scripts/ci_package.sh#L6-L8 postInstall = '' cp sql/upgrade/* $out/share/postgresql/extension/ ''; Loading @@ -82,7 +93,13 @@ 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"); 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; Loading Loading
pkgs/development/tools/rust/cargo-pgrx/default.nix +6 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,12 @@ 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="; Loading
pkgs/servers/sql/postgresql/ext/pgvecto-rs/0001-add-rustc-feature-flags.diffdeleted 100644 → 0 +0 −9 Original line number Diff line number Diff line 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))]
pkgs/servers/sql/postgresql/ext/pgvecto-rs/0001-read-clang-flags-from-environment.diff 0 → 100644 +19 −0 Original line number Diff line number Diff line 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");
pkgs/servers/sql/postgresql/ext/pgvecto-rs/Cargo.lock 0 → 100644 +3373 −0 File added.Preview size limit exceeded, changes collapsed. Show changes
pkgs/servers/sql/postgresql/ext/pgvecto-rs/default.nix +28 −11 Original line number Diff line number Diff line { lib, buildPgrxExtension, cargo-pgrx_0_12_5, cargo-pgrx_0_12_0_alpha_1, clang_16, fetchFromGitHub, nix-update-script, Loading @@ -11,12 +11,13 @@ 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#set-up-development-environment, step 2 # See https://docs.pgvecto.rs/developers/development.html#environment, step 4 clang = clang_16; rustPlatform' = rustPlatform // { bindgenHook = rustPlatform.bindgenHook.override { inherit clang; }; Loading @@ -26,32 +27,42 @@ 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#set-up-development-environment, step 5 cargo-pgrx = cargo-pgrx_0_12_5; # See https://docs.pgvecto.rs/developers/development.html#environment, step 6 cargo-pgrx = cargo-pgrx_0_12_0_alpha_1; rustPlatform = rustPlatform'; }) rec { inherit postgresql; pname = "pgvecto-rs"; version = "0.4.0"; version = "0.3.0"; buildInputs = [ openssl ]; nativeBuildInputs = [ pkg-config ]; patches = [ ./0001-add-rustc-feature-flags.diff # 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; }) ]; src = fetchFromGitHub { owner = "tensorchord"; repo = "pgvecto.rs"; rev = "v${version}"; hash = "sha256-4qrDWxYBJuQAtYlwU/zXVvX/ItqO26YAU/OHc/NLEUI="; hash = "sha256-X7BY2Exv0xQNhsS/GA7GNvj9OeVDqVCd/k3lUkXtfgE="; }; useFetchCargoVendor = true; cargoHash = "sha256-cyXKfkLju0hZe7IdNQ50AhhaEFtj795iaRutiQRuwZc="; # 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="; }; }; # Set appropriate version on vectors.control, otherwise it won't show up on PostgreSQL postPatch = '' Loading @@ -59,7 +70,7 @@ in ''; # Include upgrade scripts in the final package # https://github.com/tensorchord/pgvecto.rs/blob/v0.4.0/scripts/package.sh#L15 # https://github.com/tensorchord/pgvecto.rs/blob/v0.2.0/scripts/ci_package.sh#L6-L8 postInstall = '' cp sql/upgrade/* $out/share/postgresql/extension/ ''; Loading @@ -82,7 +93,13 @@ 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"); 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; Loading