about summary refs log tree commit diff
path: root/pkgs/development/python-modules/tree-sitter-json/default.nix
blob: acf574bef1d98f2b8624f97a1509efaf11e40b81 (plain) (blame)
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
{ lib
, buildPythonPackage
, fetchFromGitHub
, cargo
, rustPlatform
, rustc
, setuptools
, wheel
, tree-sitter
}:

buildPythonPackage rec {
  pname = "tree-sitter-json";
  version = "0.21.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "tree-sitter";
    repo = "tree-sitter-json";
    rev = "v${version}";
    hash = "sha256-waejAbS7MjrE7w03MPqvBRpEpqTcKc6RgKCVSYaDV1Y=";
  };

  cargoDeps = rustPlatform.importCargoLock {
    # Upstream doesn't track a Cargo.lock file unfortunatly, but they barely
    # have rust dependencies so it doesn't cost us too much.
    lockFile = ./Cargo.lock;
  };

  postPatch = ''
    ln -s ${./Cargo.lock} Cargo.lock
  '';

  build-system = [
    cargo
    rustPlatform.cargoSetupHook
    rustc
    setuptools
    wheel
  ];

  passthru.optional-dependencies = {
    core = [
      tree-sitter
    ];
  };

  # There are no tests
  doCheck = false;
  pythonImportsCheck = [ "tree_sitter_json" ];

  meta = with lib; {
    description = "JSON grammar for tree-sitter";
    homepage = "https://github.com/tree-sitter/tree-sitter-json";
    license = licenses.mit;
    maintainers = with maintainers; [ doronbehar ];
  };
}