nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 69 lines 1.9 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 substituteInPlace lantern_hnsw/CMakeLists.txt \ 25 --replace-fail "cmake_minimum_required(VERSION 3.3)" "cmake_minimum_required(VERSION 3.10)" 26 27 patchShebangs --build lantern_hnsw/scripts/link_llvm_objects.sh 28 ''; 29 30 nativeBuildInputs = [ 31 cmake 32 ]; 33 34 buildInputs = [ 35 openssl 36 ]; 37 38 cmakeFlags = [ 39 "-DBUILD_FOR_DISTRIBUTING=ON" 40 "-S ../lantern_hnsw" 41 ]; 42 43 passthru.tests.extension = postgresqlTestExtension { 44 inherit (finalAttrs) finalPackage; 45 sql = '' 46 CREATE EXTENSION lantern; 47 48 CREATE TABLE small_world (id integer, vector real[3]); 49 INSERT INTO small_world (id, vector) VALUES (0, '{0,0,0}'), (1, '{0,0,1}'); 50 51 CREATE INDEX ON small_world USING lantern_hnsw (vector dist_l2sq_ops) 52 WITH (M=2, ef_construction=10, ef=4, dim=3); 53 ''; 54 }; 55 56 meta = { 57 # PostgreSQL 18 support issue upstream: https://github.com/lanterndata/lantern/issues/375 58 # Check after next package update. 59 broken = lib.warnIf ( 60 finalAttrs.version != "0.5.0" 61 ) "Is postgresql18Packages.lantern still broken?" (lib.versionAtLeast postgresql.version "18"); 62 description = "PostgreSQL vector database extension for building AI applications"; 63 homepage = "https://lantern.dev/"; 64 changelog = "https://github.com/lanterndata/lantern/blob/${finalAttrs.src.rev}/CHANGELOG.md"; 65 license = lib.licenses.agpl3Only; 66 maintainers = [ ]; 67 platforms = postgresql.meta.platforms; 68 }; 69})