use upstream pgvecto-rs

This commit is contained in:
Jeffrey C. Ollie 2024-04-21 16:35:28 -05:00
parent 7ad47056eb
commit d0109b5f58
Signed by: jeff
GPG key ID: 6F86035A6D97044E

View file

@ -3,8 +3,11 @@
inputs = { inputs = {
nixpkgs = { nixpkgs = {
url = "nixpkgs/nixos-unstable"; url = "nixpkgs/nixos-23-11";
}; };
# nixpkgs-pgvectors = {
# url = "github:diogotcorreia/nixpkgs/pgvecto.rs";
# };
flake-utils = { flake-utils = {
url = "github:numtide/flake-utils"; url = "github:numtide/flake-utils";
}; };
@ -12,6 +15,7 @@
outputs = { outputs = {
self, self,
nixpkgs, nixpkgs,
# nixpkgs-pgvectors,
flake-utils, flake-utils,
... ...
} @ inputs: } @ inputs:
@ -47,44 +51,44 @@
license = licenses.mit; license = licenses.mit;
}; };
}; };
pgvecto-rs = let # pgvecto-rs = let
pname = "pgvecto.rs"; # pname = "pgvecto.rs";
version = "0.1.11"; # version = "0.1.11";
hashes = { # hashes = {
"15" = "sha256-IVx/LgRnGyvBRYvrrJatd7yboWEoSYSJogLaH5N/wPA="; # "15" = "sha256-IVx/LgRnGyvBRYvrrJatd7yboWEoSYSJogLaH5N/wPA=";
}; # };
major = pkgs.lib.versions.major pkgs.postgresql_15.version; # major = pkgs.lib.versions.major pkgs.postgresql_15.version;
in # in
pkgs.stdenv.mkDerivation { # pkgs.stdenv.mkDerivation {
inherit pname version; # inherit pname version;
buildInputs = [pkgs.dpkg]; # buildInputs = [pkgs.dpkg];
src = pkgs.fetchurl { # src = pkgs.fetchurl {
url = "https://github.com/tensorchord/pgvecto.rs/releases/download/v${version}/vectors-pg${major}-v${version}-x86_64-unknown-linux-gnu.deb"; # url = "https://github.com/tensorchord/pgvecto.rs/releases/download/v${version}/vectors-pg${major}-v${version}-x86_64-unknown-linux-gnu.deb";
hash = hashes."${major}"; # hash = hashes."${major}";
}; # };
dontUnpack = true; # dontUnpack = true;
dontBuild = true; # dontBuild = true;
dontStrip = true; # dontStrip = true;
installPhase = '' # installPhase = ''
mkdir -p $out # mkdir -p $out
dpkg -x $src $out # dpkg -x $src $out
install -D -t $out/lib $out/usr/lib/postgresql/${major}/lib/*.so # install -D -t $out/lib $out/usr/lib/postgresql/${major}/lib/*.so
install -D -t $out/share/postgresql/extension $out/usr/share/postgresql/${major}/extension/*.sql # install -D -t $out/share/postgresql/extension $out/usr/share/postgresql/${major}/extension/*.sql
install -D -t $out/share/postgresql/extension $out/usr/share/postgresql/${major}/extension/*.control # install -D -t $out/share/postgresql/extension $out/usr/share/postgresql/${major}/extension/*.control
rm -rf $out/usr # rm -rf $out/usr
''; # '';
meta = { # meta = {
description = "Scalable Vector database plugin for Postgres, written in Rust, specifically designed for LLM"; # description = "Scalable Vector database plugin for Postgres, written in Rust, specifically designed for LLM";
homepage = "https://github.com/tensorchord/pgvecto.rs"; # homepage = "https://github.com/tensorchord/pgvecto.rs";
license = pkgs.lib.licenses.asl20; # license = pkgs.lib.licenses.asl20;
platforms = pkgs.postgresql.meta.platforms; # platforms = pkgs.postgresql.meta.platforms;
}; # };
}; # };
}; };
} }
) )
@ -95,6 +99,7 @@
config, config,
lib, lib,
pkgs, pkgs,
pkgs-unstable,
... ...
}: let }: let
cfg = config.jcollie.postgresql; cfg = config.jcollie.postgresql;
@ -399,7 +404,7 @@
escapeShell = value: lib.replaceStrings ["$"] ["\\$"] value; escapeShell = value: lib.replaceStrings ["$"] ["\\$"] value;
postgresql = pkgs.postgresql_15.withPackages ( postgresql = pkgs-unstable.postgresql_15.withPackages (
plugins: plugins:
( (
lib.optionals cfg.plugins.postgis.enable [ lib.optionals cfg.plugins.postgis.enable [
@ -408,7 +413,9 @@
) )
++ ( ++ (
lib.optionals cfg.plugins.pgvecto-rs.enable [ lib.optionals cfg.plugins.pgvecto-rs.enable [
self.packages.${pkgs.system}.pgvecto-rs plugins.pgvecto-rs
# nixpkgs-pgvectors.legacyPackages.${pkgs.system}.postgresqlPackages.pgvecto-rs
# self.packages.${pkgs.system}.pgvecto-rs
] ]
) )
); );