mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-28 01:43:15 +00:00
hnswlib: init at 0.7.0
This commit is contained in:
parent
074e1daf50
commit
96850c1aaf
66
pkgs/development/libraries/hnswlib/default.nix
Normal file
66
pkgs/development/libraries/hnswlib/default.nix
Normal file
@ -0,0 +1,66 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, cmake
|
||||
, python3
|
||||
}:
|
||||
let
|
||||
python = python3.withPackages(ps: with ps; [
|
||||
numpy
|
||||
]);
|
||||
in
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "hnswlib";
|
||||
version = "0.7.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "nmslib";
|
||||
repo = "hnswlib";
|
||||
rev = "refs/tags/v${finalAttrs.version}";
|
||||
hash = "sha256-XXz0NIQ5dCGwcX2HtbK5NFTalP0TjLO6ll6TmH3oflI=";
|
||||
};
|
||||
|
||||
# this is a header-only library, so we don't need to build it
|
||||
# we need `cmake` only to run tests
|
||||
nativeBuildInputs = lib.optionals finalAttrs.doCheck [
|
||||
cmake
|
||||
python
|
||||
];
|
||||
|
||||
# we only want to run buildPhase when we run tests
|
||||
dontBuild = !finalAttrs.doCheck;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -Dm644 $src/hnswlib/*.h -t $out/include/hnswlib
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
doCheck = true;
|
||||
|
||||
preCheck = ''
|
||||
pushd ../tests/cpp
|
||||
${python.interpreter} update_gen_data.py
|
||||
popd
|
||||
'';
|
||||
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
|
||||
./test_updates
|
||||
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Header-only C++/python library for fast approximate nearest neighbors";
|
||||
homepage = "https://github.com/nmslib/hnswlib";
|
||||
changelog = "https://github.com/nmslib/hnswlib/releases/tag/${finalAttrs.src.rev}";
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ natsukium ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
})
|
@ -21273,6 +21273,8 @@ with pkgs;
|
||||
|
||||
graphinder = callPackage ../tools/security/graphinder { };
|
||||
|
||||
hnswlib = callPackage ../development/libraries/hnswlib { };
|
||||
|
||||
httplib = callPackage ../development/libraries/httplib { };
|
||||
|
||||
icon-lang = callPackage ../development/interpreters/icon-lang { };
|
||||
|
Loading…
Reference in New Issue
Block a user