Skip to content

Commit f652f8b

Browse files
committed
feat: add VectorChord (vchord) extension for PG17
Add VectorChord 1.1.0, a scalable disk-friendly vector search extension. Requires pgrx 0.17.0 and Rust 1.90.0 — both bootstrapped via the pgrx-hash tool and added to cargo-pgrx packages.
1 parent 339be5e commit f652f8b

5 files changed

Lines changed: 74 additions & 1 deletion

File tree

nix/cargo-pgrx/default.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,10 @@ in
8282
hash = "sha256-3TsNpEqNm3Uol5XPW1i0XEbP2fF2+RKB2d7lO6BDnvQ=";
8383
cargoHash = "sha256-LZUXhjMxkBs3O5feH4X5NQC7Qk4Ja6M5+sAYaSCikrY=";
8484
};
85+
cargo-pgrx_0_17_0 = mkCargoPgrx {
86+
version = "0.17.0";
87+
hash = "sha256-Ld7m7ggxlf8FufpeiAE9qcu49X0SgX6XXHS6KIewGyA=";
88+
cargoHash = "sha256-hNj39YzJna8iZxnlrLz+uLduxaD+uvggQRM7ng3MN1k=";
89+
};
8590
inherit mkCargoPgrx;
8691
}

nix/cargo-pgrx/versions.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,13 @@
115115
"cargoHash": "sha256-95DHq5GLnAqb3bbKwwaeBeKEmkfRh81ZTRaJ7L59DAg="
116116
}
117117
}
118+
},
119+
"0.17.0": {
120+
"hash": "sha256-Ld7m7ggxlf8FufpeiAE9qcu49X0SgX6XXHS6KIewGyA=",
121+
"rust": {
122+
"1.90.0": {
123+
"cargoHash": "sha256-hNj39YzJna8iZxnlrLz+uLduxaD+uvggQRM7ng3MN1k="
124+
}
125+
}
118126
}
119127
}

nix/ext/vectorchord.nix

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
lib,
3+
stdenv,
4+
callPackages,
5+
postgresql,
6+
rust-bin,
7+
}:
8+
let
9+
pname = "vchord";
10+
version = "1.1.0";
11+
rustVersion = "1.90.0";
12+
pgrxVersion = "0.17.0";
13+
14+
cargo = rust-bin.stable.${rustVersion}.default;
15+
mkPgrxExtension = callPackages ../cargo-pgrx/mkPgrxExtension.nix {
16+
inherit rustVersion pgrxVersion;
17+
};
18+
19+
src = builtins.fetchGit {
20+
url = "https://github.com/tensorchord/VectorChord.git";
21+
rev = "c68a6aec9446899d0ab22662968053bd2820ddd4";
22+
shallow = true;
23+
};
24+
in
25+
mkPgrxExtension {
26+
inherit
27+
pname
28+
version
29+
postgresql
30+
src
31+
;
32+
33+
nativeBuildInputs = [ cargo ];
34+
buildInputs = [ postgresql ];
35+
36+
cargoLock = {
37+
lockFile = "${src}/Cargo.lock";
38+
allowBuiltinFetchGit = true;
39+
};
40+
41+
buildFeatures = [ "pg17" ];
42+
43+
CARGO = "${cargo}/bin/cargo";
44+
45+
env = lib.optionalAttrs stdenv.isDarwin {
46+
POSTGRES_LIB = "${postgresql}/lib";
47+
RUSTFLAGS = "-C link-arg=-undefined -C link-arg=dynamic_lookup";
48+
};
49+
50+
doCheck = false;
51+
auditable = false;
52+
53+
meta = with lib; {
54+
description = "Scalable, fast, and disk-friendly vector search for Postgres";
55+
homepage = "https://github.com/tensorchord/VectorChord";
56+
platforms = postgresql.meta.platforms;
57+
license = licenses.agpl3Plus;
58+
};
59+
}

nix/packages/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
cargo-pgrx_0_12_6
111111
cargo-pgrx_0_12_9
112112
cargo-pgrx_0_14_3
113+
cargo-pgrx_0_17_0
113114
;
114115
}
115116
// lib.optionalAttrs pkgs.stdenv.isDarwin {

nix/packages/postgres.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
) ourExtensions;
6262

6363
orioledbExtensions = orioleFilteredExtensions ++ [ ../ext/orioledb.nix ];
64-
dbExtensions17 = orioleFilteredExtensions ++ [ ../ext/kilobase.nix ];
64+
dbExtensions17 = orioleFilteredExtensions ++ [ ../ext/kilobase.nix ../ext/vectorchord.nix ];
6565

6666
# CLI extensions - minimal set for Supabase CLI with migration support
6767
cliExtensions = [

0 commit comments

Comments
 (0)