about summary refs log tree commit diff
path: root/pkgs/tools/text/difftastic
diff options
context:
space:
mode:
authorfigsoda <figsoda@pm.me>2021-09-16 10:25:36 -0400
committerfigsoda <figsoda@pm.me>2021-09-16 12:20:56 -0400
commit6c5476df41ea69ee5a8572cd1004a36a9e1d0024 (patch)
tree7d83d38e57660be535f0eeb8235b7906a38f5ee1 /pkgs/tools/text/difftastic
parent5e36da0a28b75b692df0609563cbdbeee2c266ef (diff)
difftastic: use existing tree-sitter grammars when possible
Diffstat (limited to 'pkgs/tools/text/difftastic')
-rw-r--r--pkgs/tools/text/difftastic/default.nix15
1 files changed, 13 insertions, 2 deletions
diff --git a/pkgs/tools/text/difftastic/default.nix b/pkgs/tools/text/difftastic/default.nix
index adacd39a99a6e..06bd7d0376b27 100644
--- a/pkgs/tools/text/difftastic/default.nix
+++ b/pkgs/tools/text/difftastic/default.nix
@@ -1,4 +1,4 @@
-{ lib, fetchFromGitHub, rustPlatform }:
+{ lib, fetchFromGitHub, rustPlatform, tree-sitter }:
 
 rustPlatform.buildRustPackage rec {
   pname = "difftastic";
@@ -13,11 +13,22 @@ rustPlatform.buildRustPackage rec {
 
   cargoSha256 = "sha256-2xGwS4wjLQ7zmfZ2gMdlUAkjPDF6SmUaiX2j1KYy0vo=";
 
+  postPatch = ''
+    pushd vendor
+    for grammar in */; do
+      if [ -d "${tree-sitter.grammars}/$grammar" ]; then
+        rm -r "$grammar"
+        ln -s "${tree-sitter.grammars}/$grammar"
+      fi
+    done
+    popd
+  '';
+
   meta = with lib; {
     description = "A syntax-aware diff";
     homepage = "https://github.com/Wilfred/difftastic";
     changelog = "https://github.com/Wilfred/difftastic/raw/${version}/CHANGELOG.md";
     license = licenses.mit;
-    maintainers = with maintainers; [ ethancedwards8 ];
+    maintainers = with maintainers; [ ethancedwards8 figsoda ];
   };
 }