Files
nixpkgs/pkgs/by-name/hn/hnswlib/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

70 lines
1.3 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
cmake,
python3,
}:
let
python = python3.withPackages (
ps: with ps; [
numpy
]
);
in
stdenv.mkDerivation (finalAttrs: {
pname = "hnswlib";
version = "0.8.0";
src = fetchFromGitHub {
owner = "nmslib";
repo = "hnswlib";
tag = "v${finalAttrs.version}";
hash = "sha256-1KkAX42j/I06KO4wCnDsDifN1JiENqYKR5NNHBjyuVA=";
};
# this is a header-only library, so we don't need to build it
# we need `cmake` only to run tests
nativeCheckInputs = [
cmake
python
];
# we only want to run buildPhase when we run tests
dontBuild = !finalAttrs.finalPackage.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/v${finalAttrs.version}";
license = licenses.asl20;
maintainers = with maintainers; [ natsukium ];
platforms = platforms.unix;
};
})