From 3847f9766cca4dbb58e34eba886630106bd91bb1 Mon Sep 17 00:00:00 2001 From: SqrtMinusOne Date: Fri, 29 Dec 2023 01:53:30 +0300 Subject: [PATCH] difftastic: add --- README.org | 1 + difftastic-bin.scm | 60 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 difftastic-bin.scm diff --git a/README.org b/README.org index 8011be5..deda800 100644 --- a/README.org +++ b/README.org @@ -18,6 +18,7 @@ I'll probably push what I can upstream when I figure Guix out. | [[https://github.com/fdw/rofimoji/][rofimoji]] | OK | But I had to create setup.py myself | | [[https://github.com/deajan/osync][osync]] | Works | Requires shell commands as propagated-inputs | | [[https://github.com/jdepoix/youtube-transcript-api][youtube-transcript-api]] | Works | Tests fail | +| [[https://difftastic.wilfred.me.uk/][difftastic]] | Works | Installation from binaries | | [[https://github.com/PaulJuliusMartinez/jless][jless]] | Works | Installation from binaries | | [[https://github.com/latex-lsp/texlab/][texlab]] | Works | Installation from binaries | | [[https://gohugo.io/][hugo]] | Works | Installation from binaries | diff --git a/difftastic-bin.scm b/difftastic-bin.scm new file mode 100644 index 0000000..b230fec --- /dev/null +++ b/difftastic-bin.scm @@ -0,0 +1,60 @@ +(define-module (difftastic-bin) + #:use-module (ice-9 string-fun) + #:use-module (gnu packages base) + #:use-module (gnu packages curl) + #:use-module (gnu packages version-control) + #:use-module (gnu packages xorg) + #:use-module (gnu packages tls) + #:use-module (gnu packages compression) + #:use-module (gnu packages gcc) + #:use-module (guix download) + #:use-module (guix packages) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (nonguix build-system binary)) + +(define libstdc++ + ;; Libstdc++ matching the default GCC. + (make-libstdc++ gcc)) + +(define-public difftastic-bin + (package + (name "difftastic-bin") + (version "0.53.1") + (source + (origin + (method url-fetch) + (uri (string-append + "https://github.com/Wilfred/difftastic/releases/download/" version "/" + "difft-x86_64-unknown-linux-gnu.tar.gz")) + (sha256 + (base32 + "08hx8ljm67zjmnz3mrhisgzqiz5fnd856jqgsppl2i7x4vgzw9by")))) + (build-system binary-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (replace 'unpack + (lambda* (#:key inputs #:allow-other-keys) + (mkdir-p "difft") + (invoke "tar" "xvzf" (assoc-ref inputs "source") "-C" "difft")))) + #:install-plan + `(("difft" "/bin/")) + #:patchelf-plan + `(("difft/difft" ("glibc" "libgccjit" "libstdc++"))))) + (inputs + `(("curl" ,curl) + ("libgccjit" ,libgccjit) + ("libstdc++" ,libstdc++) + ("glibc" ,glibc) + ("zlib" ,zlib))) + (synopsis "Difftastic is a structural diff tool that compares files based on their syntax.") + (description "Difftastic is a CLI diff tool that compares files based on their syntax, not line-by-line. Difftastic produces accurate diffs that are easier for humans to read. + +@itemize +@item Understand what actually changed. Difftastic parses your code with tree-sitter. Unlike a line-oriented text diff, difftastic understands that the inner expression hasn't changed here. +@item Ignore formatting changes. Has your code formatter decided to split something over multiple lines? Difftastic can show what has actually changed. +@item Visualise wrapping changes. Have you added a wrapper? Difftastic can match the delimiters exactly. +@item Real line numbers. Do you know how to read @@ -5,6 +5,7 @@ syntax? Difftastic shows the actual line numbers from your files, both before and after. +@end itemize") + (home-page "https://difftastic.wilfred.me.uk/") + (license license:expat)))