Merge pull request #130835 from bbigras/diffsitter

diffsitter: init at 0.7.1

authored by figsoda and committed by GitHub 967bcc5c d3c2379d

+78
+76
pkgs/tools/text/diffsitter/default.nix
··· 1 + { lib 2 + , fetchFromGitHub 3 + , linkFarm 4 + , makeWrapper 5 + , rustPlatform 6 + , tree-sitter 7 + }: 8 + 9 + let 10 + # based on https://github.com/NixOS/nixpkgs/blob/aa07b78b9606daf1145a37f6299c6066939df075/pkgs/development/tools/parsing/tree-sitter/default.nix#L85-L104 11 + withPlugins = grammarFn: 12 + let 13 + grammars = grammarFn tree-sitter.builtGrammars; 14 + in 15 + linkFarm "grammars" 16 + (map 17 + (drv: 18 + let 19 + name = lib.strings.getName drv; 20 + in 21 + { 22 + name = 23 + "lib" + 24 + (lib.strings.removeSuffix "-grammar" name) 25 + + ".so"; 26 + path = "${drv}/parser"; 27 + } 28 + ) 29 + grammars); 30 + 31 + libPath = withPlugins (_: tree-sitter.allGrammars); 32 + in 33 + rustPlatform.buildRustPackage rec { 34 + pname = "diffsitter"; 35 + version = "0.7.1"; 36 + 37 + src = fetchFromGitHub { 38 + owner = "afnanenayet"; 39 + repo = pname; 40 + rev = "v${version}"; 41 + sha256 = "sha256-fDuJMpMseGVKfgg/ERb7dHUZ9n5McYVJLBvuroLZDqE="; 42 + fetchSubmodules = false; 43 + }; 44 + 45 + cargoSha256 = "sha256-HmL7Xopj0gSokjyQY4Umy+5HKUKdRdBE7glMbrsk00c="; 46 + 47 + buildNoDefaultFeatures = true; 48 + buildFeatures = [ 49 + "dynamic-grammar-libs" 50 + ]; 51 + 52 + nativeBuildInputs = [ 53 + makeWrapper 54 + ]; 55 + 56 + postInstall = '' 57 + wrapProgram "$out/bin/diffsitter" \ 58 + --prefix LD_LIBRARY_PATH : "${libPath}" 59 + ''; 60 + 61 + doCheck = false; 62 + # failures: 63 + # tests::diff_hunks_snapshot::_medium_cpp_cpp_false_expects 64 + # tests::diff_hunks_snapshot::_medium_cpp_cpp_true_expects 65 + # tests::diff_hunks_snapshot::_medium_rust_rs_false_expects 66 + # tests::diff_hunks_snapshot::_medium_rust_rs_true_expects 67 + # tests::diff_hunks_snapshot::_short_python_py_true_expects 68 + # tests::diff_hunks_snapshot::_short_rust_rs_true_expects 69 + 70 + meta = with lib; { 71 + homepage = "https://github.com/afnanenayet/diffsitter"; 72 + description = "A tree-sitter based AST difftool to get meaningful semantic diffs"; 73 + license = licenses.mit; 74 + maintainers = with maintainers; [ bbigras ]; 75 + }; 76 + }
+2
pkgs/top-level/all-packages.nix
··· 5818 5818 inherit (darwin.apple_sdk.frameworks) Security; 5819 5819 }; 5820 5820 5821 + diffsitter = callPackage ../tools/text/diffsitter { }; 5822 + 5821 5823 diffstat = callPackage ../tools/text/diffstat { }; 5822 5824 5823 5825 difftastic = callPackage ../tools/text/difftastic { };