Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 cmake, 4 faiss, 5 fetchFromGitHub, 6 gomp, 7 llvmPackages, 8 nlohmann_json, 9 sqlite, 10 stdenv, 11}: 12 13stdenv.mkDerivation (finalAttrs: { 14 pname = "sqlite-vss"; 15 version = "0.1.2"; 16 17 src = fetchFromGitHub { 18 owner = "asg017"; 19 repo = "sqlite-vss"; 20 rev = "v${finalAttrs.version}"; 21 hash = "sha256-cb9UlSUAZp8B5NpNDBvJ2+ung98gjVKLxrM2Ek9fOcs="; 22 }; 23 24 patches = [ ./use-nixpkgs-libs.patch ]; 25 26 nativeBuildInputs = [ cmake ]; 27 28 buildInputs = [ 29 nlohmann_json 30 faiss 31 sqlite 32 ] 33 ++ lib.optional stdenv.hostPlatform.isLinux gomp 34 ++ lib.optional stdenv.hostPlatform.isDarwin llvmPackages.openmp; 35 36 SQLITE_VSS_CMAKE_VERSION = finalAttrs.version; 37 38 installPhase = '' 39 runHook preInstall 40 41 install -Dm444 -t "$out/lib" \ 42 "libsqlite_vector0${stdenv.hostPlatform.extensions.staticLibrary}" \ 43 "libsqlite_vss0${stdenv.hostPlatform.extensions.staticLibrary}" \ 44 "vector0${stdenv.hostPlatform.extensions.sharedLibrary}" \ 45 "vss0${stdenv.hostPlatform.extensions.sharedLibrary}" 46 47 runHook postInstall 48 ''; 49 50 meta = with lib; { 51 # Low maintenance mode, doesn't support up-to-date faiss 52 # https://github.com/NixOS/nixpkgs/pull/330191#issuecomment-2252965866 53 broken = lib.versionAtLeast faiss.version "1.8.0"; 54 description = "SQLite extension for efficient vector search based on Faiss"; 55 homepage = "https://github.com/asg017/sqlite-vss"; 56 changelog = "https://github.com/asg017/sqlite-vss/releases/tag/v${finalAttrs.version}"; 57 license = licenses.mit; 58 platforms = platforms.unix; 59 }; 60})