From 2d69565fa8c13ef5e72abbe4f551c054d3fcf1dd Mon Sep 17 00:00:00 2001 From: Ivan Kozik Date: Thu, 13 Jul 2023 06:10:23 +0000 Subject: [PATCH] postgresqlPackages.pg_embedding: init at 0.3.1 No minimum PostgreSQL version is documented, but it fails to build with PostgreSQL 13: ``` embedding.c:543:18: error: 'IndexAmRoutine' has no member named 'amadjustmembers' 543 | amroutine->amadjustmembers = NULL; ``` --- .../sql/postgresql/ext/pg_embedding.nix | 30 +++++++++++++++++++ pkgs/servers/sql/postgresql/packages.nix | 2 ++ 2 files changed, 32 insertions(+) create mode 100644 pkgs/servers/sql/postgresql/ext/pg_embedding.nix diff --git a/pkgs/servers/sql/postgresql/ext/pg_embedding.nix b/pkgs/servers/sql/postgresql/ext/pg_embedding.nix new file mode 100644 index 0000000000000..fc19fe3370205 --- /dev/null +++ b/pkgs/servers/sql/postgresql/ext/pg_embedding.nix @@ -0,0 +1,30 @@ +{ lib, stdenv, fetchFromGitHub, postgresql }: + +stdenv.mkDerivation rec { + pname = "pg_embedding"; + version = "0.3.1"; + + src = fetchFromGitHub { + owner = "neondatabase"; + repo = pname; + rev = version; + hash = "sha256-dpwBwomUPzxnBVnnK4IWYlP+c8Z/EKerXhgrLcQj8Gk="; + }; + + buildInputs = [ postgresql ]; + + installPhase = '' + install -D -t $out/lib *.so + install -D -t $out/share/postgresql/extension *.sql + install -D -t $out/share/postgresql/extension *.control + ''; + + meta = with lib; { + description = "PostgreSQL extension implementing the HNSW algorithm for vector similarity search"; + homepage = "https://github.com/neondatabase/pg_embedding"; + maintainers = with maintainers; [ ivan ]; + platforms = postgresql.meta.platforms; + license = licenses.postgresql; + broken = versionOlder postgresql.version "14"; + }; +} diff --git a/pkgs/servers/sql/postgresql/packages.nix b/pkgs/servers/sql/postgresql/packages.nix index 8a8fd8cca5635..ed856b80b681d 100644 --- a/pkgs/servers/sql/postgresql/packages.nix +++ b/pkgs/servers/sql/postgresql/packages.nix @@ -16,6 +16,8 @@ self: super: { pg_ed25519 = super.callPackage ./ext/pg_ed25519.nix { }; + pg_embedding = super.callPackage ./ext/pg_embedding.nix { }; + pg_hint_plan = super.callPackage ./ext/pg_hint_plan.nix { }; pg_ivm = super.callPackage ./ext/pg_ivm.nix { };