about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/text/difftastic/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/text/difftastic/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/text/difftastic/default.nix34
1 files changed, 34 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/text/difftastic/default.nix b/nixpkgs/pkgs/tools/text/difftastic/default.nix
new file mode 100644
index 000000000000..06bd7d0376b2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/difftastic/default.nix
@@ -0,0 +1,34 @@
+{ lib, fetchFromGitHub, rustPlatform, tree-sitter }:
+
+rustPlatform.buildRustPackage rec {
+  pname = "difftastic";
+  version = "0.9";
+
+  src = fetchFromGitHub {
+    owner = "wilfred";
+    repo = pname;
+    rev = version;
+    sha256 = "sha256-spncRJjROytGnIig6ujqHu0e/XBTN4dsJ3og4aIu+l8=";
+  };
+
+  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 figsoda ];
+  };
+}