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