summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/rocksdict/default.nix
blob: 01152c1c85ec94a051e0a208d7e64daf85f7af24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  rustPlatform,
  pkgs,

  # tests
  pytestCheckHook,
}:

buildPythonPackage (finalAttrs: {
  pname = "rocksdict";
  version = "0.3.29";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "rocksdict";
    repo = "RocksDict";
    tag = "v${finalAttrs.version}";
    fetchSubmodules = true;
    hash = "sha256-yP+OAVioKOGPvcYM8s1TTNHzzaFxw1sUQDrWxmptuJo=";
  };

  cargoDeps = rustPlatform.fetchCargoVendor {
    inherit (finalAttrs) src pname version;
    hash = "sha256-E7DrHMla7af7IjPxS5EV2bWorXjHCsclnONVkkLAUrk=";
  };

  nativeBuildInputs = [
    rustPlatform.cargoSetupHook
    rustPlatform.maturinBuildHook
  ];

  env = {
    # libclang.so
    LIBCLANG_PATH = "${lib.getLib pkgs.libclang}/lib";
  };

  maturinBuildFlags = [
    # We disable LTO because it is incompatible with gcc
    # LTO is only supported with clang. Either disable the `lto` feature or set
    # `CC=/usr/bin/clang CXX=/usr/bin/clang++` environment variables.

    # Disable all default features to get rid of "lto"
    "--no-default-features"
    # Manually re-enable bindgen-runtime
    "--features bindgen-runtime"
  ];

  pythonImportsCheck = [ "rocksdict" ];

  nativeCheckInputs = [
    pytestCheckHook
  ];
  enabledTestPaths = [
    "test"
  ];

  meta = {
    description = "Python fast on-disk dictionary / RocksDB & SpeeDB Python binding";
    homepage = "https://github.com/rocksdict/RocksDict";
    changelog = "https://github.com/rocksdict/RocksDict/releases/tag/${finalAttrs.src.tag}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ GaetanLepage ];
  };
})