1{ lib
2, rustPlatform
3, fetchFromGitHub
4, protobuf
5, stdenv
6, pkg-config
7, openssl
8, nix-update-script
9, Security
10}:
11
12rustPlatform.buildRustPackage rec {
13 pname = "qdrant";
14 version = "1.2.2";
15
16 src = fetchFromGitHub {
17 owner = "qdrant";
18 repo = "qdrant";
19 rev = "refs/tags/v${version}";
20 sha256 = "sha256-1UJZibj7twM/4z9w+ebOI0AVjPZGz7B1BWw0M0pMQ+k=";
21 };
22
23 cargoLock = {
24 lockFile = ./Cargo.lock;
25 outputHashes = {
26 "quantization-0.1.0" = "sha256-mhiVicQXj8639bX2mGp9XnjTNVFdd6mnk+B1B1f3ywA=";
27 "wal-0.1.2" = "sha256-oZ6xij59eIpCGcFL2Ds6E180l1SGIRMOq7OcLc1TpxY=";
28 };
29 };
30
31 prePatch = lib.optionalString stdenv.isAarch64 ''
32 substituteInPlace .cargo/config.toml \
33 --replace "[target.aarch64-unknown-linux-gnu]" "" \
34 --replace "linker = \"aarch64-linux-gnu-gcc\"" ""
35 '';
36
37 # Needed to get openssl-sys to use pkg-config.
38 OPENSSL_NO_VENDOR = 1;
39
40 buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ Security ];
41
42 nativeBuildInputs = [ protobuf rustPlatform.bindgenHook pkg-config ];
43
44 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-faligned-allocation";
45
46 passthru = {
47 updateScript = nix-update-script { };
48 };
49
50 meta = with lib; {
51 description = "Vector Search Engine for the next generation of AI applications";
52 longDescription = ''
53 Expects a config file at config/config.yaml with content similar to
54 https://github.com/qdrant/qdrant/blob/master/config/config.yaml
55 '';
56 homepage = "https://github.com/qdrant/qdrant";
57 license = licenses.asl20;
58 maintainers = with maintainers; [ dit7ya ];
59 };
60}