at master 1.7 kB view raw
1{ 2 cmake, 3 fetchFromGitHub, 4 lib, 5 openssl, 6 postgresql, 7 postgresqlBuildExtension, 8 postgresqlTestExtension, 9}: 10 11postgresqlBuildExtension (finalAttrs: { 12 pname = "postgresql-lantern"; 13 version = "0.5.0"; 14 15 src = fetchFromGitHub { 16 owner = "lanterndata"; 17 repo = "lantern"; 18 tag = "v${finalAttrs.version}"; 19 hash = "sha256-IsDD/um5pVvbzin8onf45DQVszl+Id/pJSQ2iijgHmg="; 20 fetchSubmodules = true; 21 }; 22 23 postPatch = '' 24 patchShebangs --build lantern_hnsw/scripts/link_llvm_objects.sh 25 ''; 26 27 nativeBuildInputs = [ 28 cmake 29 ]; 30 31 buildInputs = [ 32 openssl 33 ]; 34 35 cmakeFlags = [ 36 "-DBUILD_FOR_DISTRIBUTING=ON" 37 "-S ../lantern_hnsw" 38 ]; 39 40 passthru.tests.extension = postgresqlTestExtension { 41 inherit (finalAttrs) finalPackage; 42 sql = '' 43 CREATE EXTENSION lantern; 44 45 CREATE TABLE small_world (id integer, vector real[3]); 46 INSERT INTO small_world (id, vector) VALUES (0, '{0,0,0}'), (1, '{0,0,1}'); 47 48 CREATE INDEX ON small_world USING lantern_hnsw (vector dist_l2sq_ops) 49 WITH (M=2, ef_construction=10, ef=4, dim=3); 50 ''; 51 }; 52 53 meta = { 54 # PostgreSQL 18 support issue upstream: https://github.com/lanterndata/lantern/issues/375 55 # Check after next package update. 56 broken = lib.warnIf ( 57 finalAttrs.version != "0.5.0" 58 ) "Is postgresql18Packages.lantern still broken?" (lib.versionAtLeast postgresql.version "18"); 59 description = "PostgreSQL vector database extension for building AI applications"; 60 homepage = "https://lantern.dev/"; 61 changelog = "https://github.com/lanterndata/lantern/blob/${finalAttrs.src.rev}/CHANGELOG.md"; 62 license = lib.licenses.agpl3Only; 63 maintainers = [ ]; 64 platforms = postgresql.meta.platforms; 65 }; 66})