12 # based on https://github.com/NixOS/nixpkgs/blob/aa07b78b9606daf1145a37f6299c6066939df075/pkgs/development/tools/parsing/tree-sitter/default.nix#L85-L104
13 withPlugins = grammarFn:
15 grammars = grammarFn tree-sitter.builtGrammars;
21 name = lib.strings.getName drv;
26 (lib.strings.removeSuffix "-grammar" name)
28 path = "${drv}/parser";
33 libPath = withPlugins (_: tree-sitter.allGrammars);
35 rustPlatform.buildRustPackage rec {
39 src = fetchFromGitHub {
40 owner = "afnanenayet";
43 hash = "sha256-ta7JcSPEgpJwieYvtZnNMFvsYvz4FuxthhmKMYe2XUE=";
44 fetchSubmodules = false;
47 cargoHash = "sha256-VbdV4dftCxxKLJr9TEuCe9tvSGbc62AUwlDZdaNRNhw=";
49 buildNoDefaultFeatures = true;
51 "dynamic-grammar-libs"
58 nativeInstallCheckInputs = [
61 doInstallCheck = true;
64 # completions are not yet implemented
65 # so we can safely remove this without installing the completions
66 rm $out/bin/diffsitter_completions
68 wrapProgram "$out/bin/diffsitter" \
69 --prefix LD_LIBRARY_PATH : "${libPath}"
74 # tests::diff_hunks_snapshot::_medium_cpp_cpp_false_expects
75 # tests::diff_hunks_snapshot::_medium_cpp_cpp_true_expects
76 # tests::diff_hunks_snapshot::_medium_rust_rs_false_expects
77 # tests::diff_hunks_snapshot::_medium_rust_rs_true_expects
78 # tests::diff_hunks_snapshot::_short_python_py_true_expects
79 # tests::diff_hunks_snapshot::_short_rust_rs_true_expects
81 passthru.updateScript = gitUpdater { rev-prefix = "v"; };
84 homepage = "https://github.com/afnanenayet/diffsitter";
85 description = "Tree-sitter based AST difftool to get meaningful semantic diffs";
86 license = licenses.mit;
87 maintainers = with maintainers; [ bbigras ];