mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-05 13:23:17 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
56 lines
1.5 KiB
Nix
56 lines
1.5 KiB
Nix
{ lib
|
|
, cmake
|
|
, faiss
|
|
, fetchFromGitHub
|
|
, gomp
|
|
, llvmPackages
|
|
, nlohmann_json
|
|
, sqlite
|
|
, stdenv
|
|
}:
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "sqlite-vss";
|
|
version = "0.1.2";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "asg017";
|
|
repo = "sqlite-vss";
|
|
rev = "v${finalAttrs.version}";
|
|
hash = "sha256-cb9UlSUAZp8B5NpNDBvJ2+ung98gjVKLxrM2Ek9fOcs=";
|
|
};
|
|
|
|
patches = [ ./use-nixpkgs-libs.patch ];
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
buildInputs = [ nlohmann_json faiss sqlite ]
|
|
++ lib.optional stdenv.hostPlatform.isLinux gomp
|
|
++ lib.optional stdenv.hostPlatform.isDarwin llvmPackages.openmp;
|
|
|
|
SQLITE_VSS_CMAKE_VERSION = finalAttrs.version;
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
install -Dm444 -t "$out/lib" \
|
|
"libsqlite_vector0${stdenv.hostPlatform.extensions.staticLibrary}" \
|
|
"libsqlite_vss0${stdenv.hostPlatform.extensions.staticLibrary}" \
|
|
"vector0${stdenv.hostPlatform.extensions.sharedLibrary}" \
|
|
"vss0${stdenv.hostPlatform.extensions.sharedLibrary}"
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
meta = with lib;{
|
|
# Low maintenance mode, doesn't support up-to-date faiss
|
|
# https://github.com/NixOS/nixpkgs/pull/330191#issuecomment-2252965866
|
|
broken = lib.versionAtLeast faiss.version "1.8.0";
|
|
description = "SQLite extension for efficient vector search based on Faiss";
|
|
homepage = "https://github.com/asg017/sqlite-vss";
|
|
changelog = "https://github.com/asg017/sqlite-vss/releases/tag/v${finalAttrs.version}";
|
|
license = licenses.mit;
|
|
platforms = platforms.unix;
|
|
};
|
|
})
|