Subject: [PATCH 3/3] gnu: Add sd.

From: Andrew Wong <[email-masked]>
Date: Thu, 20 Feb 2025 01:43:22 -0500

* gnu/packages/rust-apps.scm (sd): New variable.

Change-Id: Ie62904c26d29bfe9fc4e09b6abf39cb8b59861c7
---
 gnu/packages/rust-apps.scm | 56 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm
index 69be633c5a..57f039924c 100644
--- a/gnu/packages/rust-apps.scm
+++ b/gnu/packages/rust-apps.scm
@@ -3726,6 +3726,62 @@ (define-public rtss
 consecutive lines and since program start.")
     (license license:expat)))
 
+(define-public sd
+  (package
+    (name "sd")
+    (version "1.0.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "sd" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "1a16p1s0j28n3vj006qm7b03k5s9mkr11cbbksvfb88wi10kqqbh"))))
+    (build-system cargo-build-system)
+    (arguments
+     (list
+      #:cargo-inputs
+      `(("rust-ansi-term" ,rust-ansi-term-0.12)
+        ("rust-clap" ,rust-clap-4)
+        ("rust-is-terminal" ,rust-is-terminal-0.4)
+        ("rust-memmap2" ,rust-memmap2-0.9)
+        ("rust-rayon" ,rust-rayon-1)
+        ("rust-regex" ,rust-regex-1)
+        ("rust-tempfile" ,rust-tempfile-3)
+        ("rust-thiserror" ,rust-thiserror-1)
+        ("rust-unescape" ,rust-unescape-0.1))
+      #:cargo-development-inputs
+      `(("rust-ansi-to-html" ,rust-ansi-to-html-0.1)
+        ("rust-anyhow" ,rust-anyhow-1)
+        ("rust-assert-cmd" ,rust-assert-cmd-2)
+        ("rust-clap-mangen" ,rust-clap-mangen-0.2)
+        ("rust-console" ,rust-console-0.15)
+        ("rust-insta" ,rust-insta-1)
+        ("rust-proptest" ,rust-proptest-1)
+        ("rust-regex-automata" ,rust-regex-automata-0.4))
+      #:install-source? #f
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'install 'install-extras
+            (lambda _
+              (install-file "gen/sd.1"
+                            (string-append #$output "/share/man/man1"))
+              (with-directory-excursion "gen/completions"
+                (for-each
+                 (lambda (pair)
+                   (install-file (car pair)
+                                 (string-append #$output (cdr pair))))
+                 '(("_sd" . "/share/zsh/site-functions")
+                   ("sd.bash" . "/etc/bash_completion.d")
+                   ("sd.elv" . "/share/elvish/lib")
+                   ("sd.fish" . "/share/fish/vendor_completions.d")))))))))
+    (home-page "https://github.com/chmln/sd")
+    (synopsis "Intuitive find & replace CLI")
+    (description "@code{sd} is an intuitive find & replace CLI with
+JavaScript/Python-style regular expressions, a string-literal mode,
+and smart, common-sense defaults.")
+    (license license:expat)))
+
 (define-public skim
   (package
     (name "skim")
-- 
2.48.1