projects/guix·blob perlssl · refs

1217 lines · 49.6 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016 Matthew Jordan <[email protected]>
3;;; Copyright © 2016, 2017 Alex Griffin <[email protected]>
4;;; Copyright © 2016 Christopher Baines <[email protected]>
5;;; Copyright © 2017 Stefan Reichör <[email protected]>
6;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <[email protected]>
7;;; Copyright © 2018 Benjamin Slade <[email protected]>
8;;; Copyright © 2019 Collin J. Doering <[email protected]>
9;;; Copyright © 2020, 2022 Michael Rohleder <[email protected]>
10;;; Copyright © 2020 aecepoglu <[email protected]>
11;;; Copyright © 2020 Dion Mendel <[email protected]>
12;;; Copyright © 2021 Brice Waegeneire <[email protected]>
13;;; Copyright © 2021 Alexandr Vityazev <[email protected]>
14;;; Copyright © 2021 Xinglu Chen <[email protected]>
15;;; Copyright © 2021 Foo Chuan Wei <[email protected]>
16;;; Copyright © 2021 Wiktor Żelazny <[email protected]>
17;;; Copyright © 2022 Jose G Perez Taveras <[email protected]>
18;;; Copyright © 2023 Timo Wilken <[email protected]>
19;;; Copyright © 2023, 2025 Camilo Q.S. (Distopico) <[email protected]>
20;;; Copyright © 2023 Zheng Junjie <[email protected]>
21;;; Copyright © 2024 Artyom V. Poptsov <[email protected]>
22;;; Copyright © 2024 Brian Kubisiak <[email protected]>
23;;; Copyright © 2024 Jordan Moore <[email protected]>
24;;; Copyright © 2025 Gabriel Santos <[email protected]>
25;;; Copyright © 2025 Skylar Hill <[email protected]>
26;;;
27;;; This file is part of GNU Guix.
28;;;
29;;; GNU Guix is free software; you can redistribute it and/or modify it
30;;; under the terms of the GNU General Public License as published by
31;;; the Free Software Foundation; either version 3 of the License, or (at
32;;; your option) any later version.
33;;;
34;;; GNU Guix is distributed in the hope that it will be useful, but
35;;; WITHOUT ANY WARRANTY; without even the implied warranty of
36;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37;;; GNU General Public License for more details.
38;;;
39;;; You should have received a copy of the GNU General Public License
40;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
41
42(define-module (gnu packages shellutils)
43 #:use-module ((guix licenses) #:prefix license:)
44 #:use-module (guix gexp)
45 #:use-module (guix utils)
46 #:use-module (guix packages)
47 #:use-module (guix download)
48 #:use-module (guix git-download)
49 #:use-module (guix build-system cargo)
50 #:use-module (guix build-system copy)
51 #:use-module (guix build-system gnu)
52 #:use-module (guix build-system go)
53 #:use-module (guix build-system pyproject)
54 #:use-module (gnu packages admin)
55 #:use-module (gnu packages autotools)
56 #:use-module (gnu packages base)
57 #:use-module (gnu packages bison)
58 #:use-module (gnu packages check)
59 #:use-module (gnu packages cmake)
60 #:use-module (gnu packages compiler-tools)
61 #:use-module (gnu packages golang-build)
62 #:use-module (gnu packages golang-check)
63 #:use-module (gnu packages golang-xyz)
64 #:use-module (gnu packages libunistring)
65 #:use-module (gnu packages ncurses)
66 #:use-module (gnu packages perl)
67 #:use-module (gnu packages pcre)
68 #:use-module (gnu packages pkg-config)
69 #:use-module (gnu packages python)
70 #:use-module (gnu packages python-build)
71 #:use-module (gnu packages python-check)
72 #:use-module (gnu packages python-xyz)
73 #:use-module (gnu packages readline)
74 #:use-module (gnu packages ruby)
75 #:use-module (gnu packages ruby-check)
76 #:use-module (gnu packages ruby-xyz)
77 #:use-module (gnu packages shells)
78 #:use-module (gnu packages textutils)
79 #:use-module (gnu packages tmux)
80 #:use-module (gnu packages version-control)
81 #:use-module (gnu packages vim))
82
83(define-public ascii
84 (package
85 (name "ascii")
86 (version "3.31")
87 (source (origin
88 (method url-fetch)
89 (uri (string-append "http://www.catb.org/~esr/ascii/"
90 "ascii-" version ".tar.gz"))
91 (sha256
92 (base32
93 "0g0159sbw9a6arclhnza56ah8hz3wr16famvq4x1p4j6rigsg6ih"))))
94 (build-system gnu-build-system)
95 (arguments
96 (list #:make-flags
97 #~(list (string-append "CC=" #$(cc-for-target))
98 (string-append "PREFIX=" #$output))
99 #:phases
100 #~(modify-phases %standard-phases
101 (delete 'configure)
102 (add-before 'install 'create-directories
103 (lambda* (#:key outputs #:allow-other-keys)
104 (let* ((out (assoc-ref outputs "out"))
105 (bin (string-append out "/bin"))
106 (man1 (string-append out "/share/man/man1")))
107 (mkdir-p bin)
108 (mkdir-p man1)))))
109 #:tests? #f))
110 (home-page "http://www.catb.org/~esr/ascii/")
111 (synopsis "ASCII name and synonym chart")
112 (description
113 "The @code{ascii} utility provides easy conversion between various byte
114representations and the American Standard Code for Information Interchange
115(ASCII) character table. It knows about a wide variety of hex, binary, octal,
116Teletype mnemonic, ISO/ECMA code point, slang names, XML entity names, and
117other representations. Given any one on the command line, it will try to
118display all others. Called with no arguments it displays a handy small ASCII
119chart.")
120 (license license:bsd-2)))
121
122(define-public boxes
123 (package
124 (name "boxes")
125 (version "2.3.1")
126 (source (origin
127 (method git-fetch)
128 (uri (git-reference
129 (url "https://github.com/ascii-boxes/boxes")
130 (commit (string-append "v" version))))
131 (file-name (git-file-name name version))
132 (sha256
133 (base32
134 "028vg9h3vxz3icy7hmxgyqhn62953h1ls6bxwbhdwhl1lpj5py3n"))))
135 (build-system gnu-build-system)
136 (arguments
137 `(#:test-target "utest"
138 #:make-flags (list (string-append "GLOBALCONF="
139 (assoc-ref %outputs "out")
140 "/etc/boxes-config"))
141 #:modules
142 ((ice-9 match)
143 ,@%default-gnu-modules)
144 #:phases
145 (modify-phases %standard-phases
146 (delete 'configure)
147 (replace 'install
148 (lambda* (#:key outputs #:allow-other-keys)
149 (let ((out (assoc-ref outputs "out")))
150 (for-each (match-lambda
151 ((source target)
152 (install-file source
153 (string-append out "/" target))))
154 '(("out/boxes" "bin/")
155 ("doc/boxes.1" "share/man/man1/")
156 ("boxes-config" "etc/")))))))))
157 (native-inputs
158 (list bison flex cmocka
159 ;; For the tests.
160 xxd))
161 (inputs
162 (list ncurses libunistring pcre2))
163 (home-page "https://boxes.thomasjensen.com")
164 (synopsis "Command line ASCII boxes")
165 (description
166 "This command-line filter program draws ASCII-art boxes around your input
167text.")
168 (license license:gpl2)))
169
170(define-public zsh-autopair
171 (package
172 (name "zsh-autopair")
173 (version "1.0")
174 (home-page "https://github.com/hlissner/zsh-autopair")
175 (source (origin
176 (method git-fetch)
177 (uri (git-reference
178 (url "https://github.com/hlissner/zsh-autopair.git")
179 (commit (string-append "v" version))))
180 (file-name (git-file-name name version))
181 (sha256
182 (base32
183 "1h0vm2dgrmb8i2pvsgis3lshc5b0ad846836m62y8h3rdb3zmpy1"))))
184 (build-system copy-build-system)
185 (arguments
186 '(#:install-plan '(("autopair.zsh"
187 "/share/zsh/plugins/zsh-autopair/zsh-autopair.zsh"))))
188 (synopsis "Auto-close and delete matching delimiters in Zsh")
189 (description
190 "This Zsh plugin auto-closes, deletes, and skips over matching delimiters
191in Zsh intelligently.")
192 (license license:expat)))
193
194(define-public zsh-autosuggestions
195 (package
196 (name "zsh-autosuggestions")
197 (version "0.7.1")
198 (source (origin
199 (method git-fetch)
200 (uri (git-reference
201 (url "https://github.com/zsh-users/zsh-autosuggestions")
202 (commit (string-append "v" version))))
203 (file-name (git-file-name name version))
204 (sha256
205 (base32
206 "02p5wq93i12w41cw6b00hcgmkc8k80aqzcy51qfzi0armxig555y"))))
207 (build-system gnu-build-system)
208 (native-inputs
209 (list ruby
210 ruby-pry
211 ruby-rspec
212 ruby-rspec-wait
213 tmux
214 zsh))
215 (arguments
216 (list
217 #:phases
218 #~(modify-phases %standard-phases
219 (add-after 'unpack 'patch-tests
220 (lambda _
221 ;; Failing tests since tmux-3.2a
222 (delete-file "spec/options/buffer_max_size_spec.rb")))
223 (delete 'configure)
224 (replace 'check ; Tests use ruby's bundler; instead execute rspec directly.
225 (lambda _
226 (setenv "TMUX_TMPDIR" (getenv "TMPDIR"))
227 (setenv "SHELL" (which "zsh"))
228 (invoke "rspec")))
229 (replace 'install
230 (lambda* (#:key outputs #:allow-other-keys)
231 (let* ((out (assoc-ref outputs "out"))
232 (zsh-plugins
233 (string-append out "/share/zsh/plugins/zsh-autosuggestions")))
234 (invoke "make" "all")
235 (install-file "zsh-autosuggestions.zsh" zsh-plugins)))))))
236 (home-page "https://github.com/zsh-users/zsh-autosuggestions")
237 (synopsis "Fish-like autosuggestions for zsh")
238 (description
239 "Fish-like fast/unobtrusive autosuggestions for zsh. It suggests commands
240as you type.")
241 (license license:expat)))
242
243(define-public zsh-completions
244 (package
245 (name "zsh-completions")
246 (version "0.34.0")
247 (home-page "https://github.com/zsh-users/zsh-completions")
248 (source (origin
249 (method git-fetch)
250 (uri (git-reference
251 (url home-page)
252 (commit version)))
253 (file-name (git-file-name name version))
254 (sha256
255 (base32
256 "0jjgvzj3v31yibjmq50s80s3sqi4d91yin45pvn3fpnihcrinam9"))))
257 (build-system copy-build-system)
258 (arguments
259 '(#:install-plan '(("src/" "share/zsh/site-functions/")
260 ("README.md" "share/doc/zsh-completions/"))))
261 (synopsis "Additional completion definitions for Zsh")
262 (description
263 "This projects aims at gathering/developing new completion scripts that
264are not available in Zsh yet. The scripts may be contributed to the Zsh
265project when stable enough.")
266 (license (license:non-copyleft "file://LICENSE"
267 "Custom BSD-like, permissive, non-copyleft license."))))
268
269(define-public zsh-history-substring-search
270 (package
271 (name "zsh-history-substring-search")
272 (version "1.0.2")
273 (home-page "https://github.com/zsh-users/zsh-history-substring-search")
274 (source (origin
275 (method git-fetch)
276 (uri (git-reference
277 (url home-page)
278 (commit (string-append "v" version))))
279 (file-name (git-file-name name version))
280 (sha256
281 (base32
282 "0y8va5kc2ram38hbk2cibkk64ffrabfv1sh4xm7pjspsba9n5p1y"))))
283 (build-system copy-build-system)
284 (arguments
285 '(#:install-plan '(("zsh-history-substring-search.plugin.zsh"
286 "share/zsh/plugins/zsh-history-substring-search/")
287 ("zsh-history-substring-search.zsh"
288 "share/zsh/plugins/zsh-history-substring-search/")
289 ("README.md" "share/doc/zsh-history-substring-search/"))))
290 (synopsis "ZSH port of Fish history search (up arrow)")
291 (description
292 "This is a clean-room implementation of the Fish shell's history search
293feature, where you can type in any part of any command from history and then
294press chosen keys, such as the UP and DOWN arrows, to cycle through matches.")
295 (license license:bsd-3)))
296
297(define-public zsh-syntax-highlighting
298 (package
299 (name "zsh-syntax-highlighting")
300 (version "0.8.0")
301 (source (origin
302 (method git-fetch)
303 (uri (git-reference
304 (url "https://github.com/zsh-users/zsh-syntax-highlighting")
305 (commit version)))
306 (file-name (git-file-name name version))
307 (sha256
308 (base32
309 "0f482llznpkdg3kv92mjq53djpi4023bdmq06lk1qh05gnp2qg46"))))
310 (build-system gnu-build-system)
311 (native-inputs
312 (list zsh coreutils grep))
313 (arguments
314 ;; FIXME: Tests have expected failures (easy way to skip just those tests?)
315 (list
316 #:tests? #f
317 #:phases
318 #~(modify-phases %standard-phases
319 (delete 'configure)
320 (add-after 'unpack 'patch-paths
321 (lambda _
322 (substitute* "Makefile"
323 (("/usr/local") #$output)
324 (("share/\\$\\(NAME\\)") "share/zsh/plugins/$(NAME)")
325 (("env -i") "env -i PATH=$$PATH"))))
326 (add-after 'patch-paths 'make-writable
327 (lambda _
328 (for-each make-file-writable
329 '("docs/highlighters.md"
330 "README.md"))))
331 (add-before 'build 'add-all-md
332 (lambda _
333 (invoke "make" "all")))
334 (replace 'check
335 (lambda* (#:key tests? #:allow-other-keys)
336 (when tests?
337 (invoke "make" "test" (string-append "ZSH=" #$zsh "/bin/zsh"))
338 (invoke "make" "perf" (string-append "ZSH=" #$zsh "/bin/zsh"))))))))
339 (home-page "https://github.com/zsh-users/zsh-syntax-highlighting")
340 (synopsis "Fish shell-like syntax highlighting for Zsh")
341 (description
342 "This package provides syntax highlighting for Zsh. It enables
343highlighting of commands whilst they are typed at a Zsh prompt into an
344interactive terminal. This helps in reviewing commands before running them,
345particularly in catching syntax errors.")
346 (license license:bsd-3)))
347
348(define-public zsh-vi-mode
349 (package
350 (name "zsh-vi-mode")
351 (version "0.11.0")
352 (home-page "https://github.com/jeffreytse/zsh-vi-mode")
353 (source
354 (origin
355 (method git-fetch)
356 (uri (git-reference
357 (url "https://github.com/jeffreytse/zsh-vi-mode")
358 (commit (string-append "v" version))))
359 (file-name (git-file-name name version))
360 (sha256
361 "0bs5p6p5846hcgf3rb234yzq87rfjs18gfha9w0y0nf5jif23dy5")))
362 (build-system copy-build-system)
363 (arguments
364 (list
365 #:install-plan
366 #~'(("zsh-vi-mode.zsh" "share/zsh/plugins/zsh-vi-mode/")
367 ("zsh-vi-mode.plugin.zsh" "share/zsh/plugins/zsh-vi-mode/"))))
368 (synopsis "Plugin to improve vi keybindings in zsh")
369 (description "This package provides a zsh vimkey plugin with more features,
370which more closely matches the standard behavior of vim.")
371 (license license:expat)))
372
373(define-public grml-zsh-config
374 (package
375 (name "grml-zsh-config")
376 (version "0.19.6")
377 (source (origin
378 (method url-fetch)
379 (uri (string-append
380 "https://deb.grml.org/pool/main/g/grml-etc-core/grml-etc-core_"
381 version ".tar.gz"))
382 (sha256
383 (base32
384 "1k1m2fbmvw73qy9mc6k2ygjg6zz8h7nn3d9pvj6jbjadnx4pz770"))))
385 (build-system copy-build-system)
386 (arguments
387 (list
388 #:phases
389 #~(modify-phases
390 %standard-phases
391 (add-before 'install 'make-doc
392 (lambda _ (with-directory-excursion "doc" (invoke "make")))))
393 #:install-plan
394 #~'(("etc/skel/.zshrc" "etc/skel/.zshrc")
395 ("etc/zsh/keephack" "etc/zsh/keephack")
396 ("etc/zsh/zshrc" "etc/zsh/zshrc")
397 ("doc/grmlzshrc.5" "share/man/man5/grmlzshrc.5"))))
398 (native-inputs (list txt2tags))
399 (home-page "https://grml.org/zsh/")
400 (synopsis "Grml's zsh configuration")
401 (description "This package provides an interactive setup for zsh
402preconfigured by the Grml project.")
403 (license license:gpl2)))
404
405(define-public sh-z
406 (package
407 (name "sh-z")
408 (version "1.11")
409 (source (origin
410 (method git-fetch)
411 (uri (git-reference
412 (url "https://github.com/rupa/z")
413 (commit (string-append "v" version))))
414 (file-name (git-file-name name version))
415 (sha256
416 (base32
417 "13zbgkj6y0qhvn5jpkrqbd4jjxjr789k228iwma5hjfh1nx7ghyb"))))
418 (build-system gnu-build-system)
419 (arguments
420 `(#:tests? #f ; No tests provided
421 #:phases
422 (modify-phases %standard-phases
423 (delete 'configure)
424 (delete 'build)
425 (replace 'install
426 (lambda* (#:key outputs #:allow-other-keys)
427 (let* ((out (assoc-ref outputs "out"))
428 (man (string-append out "/share/man/man1"))
429 (bin (string-append out "/bin")))
430 (install-file "z.sh" bin)
431 (chmod (string-append bin "/z.sh") #o755)
432 (install-file "z.1" man)
433 #t))))))
434 (synopsis "Jump about directories")
435 (description
436 "Tracks your most used directories, based on ``frecency''. After a short
437learning phase, z will take you to the most ``frecent'' directory that matches
438all of the regexes given on the command line in order.")
439 (home-page "https://github.com/rupa/z")
440 (license license:expat)))
441
442(define-public shfmt
443 (package
444 (name "shfmt")
445 (version "3.12.0")
446 (source
447 (origin
448 (method git-fetch)
449 (uri (git-reference
450 (url "https://github.com/mvdan/sh")
451 (commit (string-append "v" version))))
452 (file-name (git-file-name name version))
453 (sha256
454 (base32 "11rlx3l37aspd9674xdisw394bdly0yb38asqxaz4riadgj0vbfx"))
455 (modules '((guix build utils)))
456 (snippet
457 #~(begin
458 ;; It fails during check phase, looks like a MVP: gosh is a proof
459 ;; of concept shell built on top of [interp].
460 (delete-file-recursively "cmd/gosh")))))
461 (build-system go-build-system)
462 (arguments
463 (list
464 #:install-source? #f
465 #:import-path "mvdan.cc/sh/v3/cmd/shfmt"
466 #:unpack-path "mvdan.cc/sh/v3"
467 #:test-flags
468 ;; Tests fail for these groups unable to set locale.
469 #~(list "-skip" (string-join
470 (list "FuzzQuote"
471 "TestKillTimeout"
472 "TestParseBashConfirm"
473 "TestParseErrBashConfirm"
474 "TestRunnerRun"
475 "TestRunnerRunConfirm")
476 "|"))
477 #:test-subdirs #~(list "../../...") ;test the whole library
478 #:phases
479 #~(modify-phases %standard-phases
480 (add-after 'unpack 'set-version
481 (lambda* (#:key unpack-path #:allow-other-keys)
482 (with-directory-excursion (string-append "src/" unpack-path)
483 (let ((fixed-version (string-append #$version " (GNU Guix)")))
484 ;; shfmt uses modules to look up the version at runtime;
485 ;; since our build system does not yet support modules,
486 ;; inject the version string here instead
487 (substitute* "cmd/shfmt/main.go"
488 (("version = \"\\(devel\\)\"")
489 (format #f "version = \"~a\"" fixed-version)))
490 (substitute* "cmd/shfmt/testdata/script/flags.txtar"
491 (("devel\\|v3") #$version)))))))))
492 (native-inputs
493 (list go-github-com-creack-pty
494 go-github-com-go-quicktest-qt
495 go-github-com-google-go-cmp
496 go-github-com-google-renameio-v2
497 go-github-com-rogpeppe-go-internal-1.14
498 go-golang-org-x-sys
499 go-golang-org-x-term
500 go-mvdan-cc-editorconfig))
501 (home-page "https://github.com/mvdan/sh")
502 (synopsis "Shell formatter with bash support")
503 (description
504 "This package provides a shell formatter. Supports
505@url{https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html,
506POSIX Shell}, @url{https://www.gnu.org/software/bash/, Bash}, and
507@url{http://www.mirbsd.org/mksh.htm, mksh}.")
508 (license license:bsd-3)))
509
510(define-public starship
511 (package
512 (name "starship")
513 (version "1.25.1")
514 (source
515 (origin
516 (method url-fetch)
517 (uri (crate-uri "starship" version))
518 (file-name (string-append name "-" version ".tar.gz"))
519 (sha256
520 (base32 "022bnq9lq0kq0zxs34li0j653rhlh4y2garc3mvcr90pddjhp4wg"))))
521 (build-system cargo-build-system)
522 (arguments
523 (list
524 #:install-source? #f
525 #:modules
526 '((guix build cargo-build-system)
527 (guix build utils)
528 (ice-9 match))
529 #:phases
530 #~(modify-phases %standard-phases
531 (add-after 'install 'install-completions
532 (lambda* (#:key native-inputs #:allow-other-keys)
533 (for-each
534 (match-lambda
535 ((shell . path)
536 (mkdir-p (in-vicinity #$output (dirname path)))
537 (let ((binary
538 (if #$(%current-target-system)
539 (search-input-file native-inputs "bin/starship")
540 (in-vicinity #$output "bin/starship"))))
541 (with-output-to-file (in-vicinity #$output path)
542 (lambda _
543 (invoke binary "completions" shell))))))
544 '(("bash" . "share/bash-completion/completions/starship")
545 ("elvish" . "share/elvish/lib/starship")
546 ("fish" . "share/fish/vendor_completions.d/starship.fish")
547 ("nushell" . "share/nushell/vendor/autoload/starship")
548 ("zsh" . "share/zsh/site-functions/_starship")))))
549 (add-after 'unpack 'patch-test-shell
550 (lambda* (#:key tests? inputs #:allow-other-keys)
551 ;; Search through the rust files and then replace `/bin/sh'
552 ;; with the full path for the tests.
553 (let ((rust-files (find-files "." "\\.rs$")))
554 (when tests?
555 (for-each (lambda (file)
556 (substitute* file
557 (("/bin/sh")
558 (search-input-file inputs "/bin/sh"))))
559 rust-files)))))
560 ;; Some tests require a writable home directory
561 ;; Set "HOME" to be located inside the cwd so it is writable
562 ;; for tests checking for user-configs
563 (add-before 'check 'set-test-env-vars
564 (lambda _
565 (setenv "HOME"
566 (string-append (getcwd) "/.test-home")))))))
567 (inputs (cargo-inputs 'starship))
568 (native-inputs
569 (append
570 (if (%current-target-system)
571 (list this-package)
572 '())
573 (list git-minimal/pinned)))
574 (home-page "https://starship.rs")
575 (synopsis "Fast and customizable shell prompt")
576 (description
577 "Starship is a shell prompt that is fast and configurable, and works on
578most common shells. It shows information from various sources in a way easy to
579grasp at a glance, including but not limited to: the hostname/username/cwd trio,
580git, project language and runtime.
581
582Note: Users must have a nerd font installed and enabled in their terminal.")
583 (license license:isc)))
584
585(define-public envstore
586 (package
587 (name "envstore")
588 (version "2.1")
589 (source
590 (origin
591 (method url-fetch)
592 (uri (string-append "https://finalrewind.org/projects/"
593 name "/" name "-" version ".tar.bz2"))
594 (sha256
595 (base32 "1x97lxad80m5blhdfanl5v2qzjwcgbij2i23701bn8mpyxsrqszi"))))
596 (build-system gnu-build-system)
597 (arguments
598 `(#:test-target "test"
599 #:make-flags (list "CC=gcc"
600 (string-append "PREFIX=" (assoc-ref %outputs "out")))
601 #:phases
602 (modify-phases %standard-phases
603 (delete 'configure))))
604 (home-page "https://finalrewind.org/projects/envstore/")
605 (synopsis "Save and restore environment variables")
606 (description "Envstore is a program for sharing environment variables
607between various shells or commands.")
608 (license license:wtfpl2)))
609
610(define-public trash-cli
611 (package
612 (name "trash-cli")
613 (version "0.24.5.26")
614 (source
615 (origin
616 (method git-fetch)
617 (uri (git-reference
618 (url "https://github.com/andreafrancia/trash-cli")
619 (commit version)))
620 (file-name (git-file-name name version))
621 (sha256
622 (base32 "1mqs3y9vbph33jsaa5hc0fhk80pklmsn8ylp979k9qj63fgqrnwn"))))
623 (build-system pyproject-build-system)
624 (arguments
625 (list
626 #:modules `((guix build pyproject-build-system)
627 (guix build utils)
628 (ice-9 match))
629 #:phases #~(modify-phases %standard-phases
630 (add-before 'build 'fix-setup.py
631 (lambda* (#:key outputs #:allow-other-keys)
632 (let ((bin (string-append #$output "/bin")))
633 (mkdir-p bin)
634 (substitute* "setup.py"
635 (("add_script\\('")
636 (string-append "add_script('" bin "/"))))))
637 (add-before 'wrap 'install-completions
638 (lambda _
639 (for-each
640 (lambda (binary)
641 (for-each
642 (match-lambda
643 ((shell . path)
644 (mkdir-p (dirname path))
645 (with-output-to-file path
646 (lambda _
647 (invoke
648 (string-append #$output "/bin/" binary)
649 "--print-completion" shell)))))
650 `(("bash" .
651 ,(format ;format string must be literal
652 #f "~a/share/bash-completion/completions/~a"
653 #$output binary))
654 ("zsh" .
655 ,(format #f "~a/share/zsh/site-functions/_~a"
656 #$output binary))
657 ("tcsh" .
658 ,(format #f "~a/etc/profile.d/~a.completion.csh"
659 #$output binary)))))
660 (list "trash"
661 "trash-empty"
662 "trash-list"
663 "trash-put"
664 "trash-restore"
665 "trash-rm")))))))
666 (native-inputs (list python-flexmock
667 python-mock
668 python-parameterized
669 python-pytest
670 python-setuptools
671 python-shtab
672 python-six
673 python-wheel))
674 (inputs (list coreutils))
675 (propagated-inputs (list python-psutil))
676 (home-page "https://github.com/andreafrancia/trash-cli")
677 (synopsis "Trash can management tool")
678 (description
679 "trash-cli is a command line utility for interacting with the
680FreeDesktop.org trash can used by GNOME, KDE, XFCE, and other common desktop
681environments. It can move files to the trash, and remove or list files that
682are already there.")
683 (license license:gpl2+)))
684
685(define-public tran
686 ;; There is no new release yet, but there are some changes in master brunch,
687 ;; see <https://github.com/kilobyte/tran/issues/4>.
688 (let ((commit "039df9529d5dfb8283edfb3c8b3cc16c01f0bfce")
689 (revision "0"))
690 (package
691 (name "tran")
692 ;; The latest upstream version seems to be "v5".
693 (version (git-version "5.0.0" revision commit))
694 (source
695 (origin
696 (method git-fetch)
697 (uri (git-reference
698 (url "https://github.com/kilobyte/tran")
699 (commit commit)))
700 (file-name (string-append name "-" version "-checkout"))
701 (sha256
702 (base32 "1kzr3lfhi5f8wpwjzrzlwkxjv9rasdr9ndjdns9kd16vsh0gl2rd"))))
703 (build-system gnu-build-system)
704 (arguments
705 (list
706 #:tests? #f ;no tests
707 #:phases
708 #~(modify-phases %standard-phases
709 (delete 'configure) ;no configure provided
710 (add-after 'unpack 'patch
711 (lambda _
712 (substitute* "tran"
713 (("my \\$DATA=\"data\"")
714 (format #f "my $DATA=\"~a/share/tran/data\"" #$output)))))
715 (replace 'build
716 (lambda _
717 (invoke "make")))
718 (delete 'strip)
719 (replace 'install
720 (lambda _
721 (install-file "tran" (string-append #$output "/bin/"))
722 (install-file "tran.1" (string-append
723 #$output "/share/man/man1/"))
724 (copy-recursively "data" (string-append
725 #$output "/share/tran/data/")))))))
726 (inputs (list perl))
727 (home-page "https://github.com/kilobyte/tran")
728 (synopsis "Transcription between character scripts")
729 (description
730 "This tool can transliterate/transcribe text both ways between the
731Latin script and other languages.")
732 (license license:expat))))
733
734(define-public direnv
735 (package
736 (name "direnv")
737 (version "2.37.1")
738 (source
739 (origin (method git-fetch)
740 (uri (git-reference
741 (url "https://github.com/direnv/direnv")
742 (commit (string-append "v" version))))
743 (file-name (git-file-name name version))
744 (sha256
745 (base32
746 "08wywbj5niqhpy6m4y8xw065w3rgpi8khfy5qzqfxr6752h66v7p"))))
747 (build-system go-build-system)
748 (arguments
749 (list #:install-source? #f
750 #:import-path "github.com/direnv/direnv"
751 #:phases
752 #~(modify-phases %standard-phases
753 (add-after 'install 'install-manpages
754 (lambda _
755 (let* ((man (string-append #$output "/share/man/man1")))
756 (mkdir-p man)
757 (with-directory-excursion "src/github.com/direnv/direnv"
758 (install-file "man/direnv.1" man)
759 (install-file "man/direnv-stdlib.1" man)
760 (install-file "man/direnv.toml.1" man)))))
761 (replace 'check
762 (lambda* (#:key tests? #:allow-other-keys)
763 (when tests?
764 (setenv "HOME" "/tmp")
765 (with-directory-excursion "src/github.com/direnv/direnv"
766 ;; The following file needs to be writable so it can be
767 ;; modified by the testsuite.
768 (make-file-writable "test/scenarios/base/.envrc")
769 ;; We need to manually run test because make test
770 ;; tries to use go modules
771 (invoke "go" "test" "./...")
772 ;; Clean up from the tests, especially so that the extra
773 ;; direnv executable that's generated is removed.
774 (invoke "make" "clean"))))))))
775 (native-inputs
776 (list go-github-com-burntsushi-toml
777 go-github-com-mattn-go-isatty
778 go-golang-org-x-mod
779 which))
780 (home-page "https://direnv.net/")
781 (synopsis "Environment switcher for the shell")
782 (description
783 "direnv can hook into the bash, zsh, tcsh, and fish shells to load
784or unload environment variables depending on the current directory. This
785allows project-specific environment variables without using @file{~/.profile}.
786
787Before each prompt, direnv checks for the existence of a @file{.envrc} file in
788the current and parent directories. This file is then used to alter the
789environment variables of the current shell.")
790 (license license:expat)))
791
792(define-public fzy
793 (package
794 (name "fzy")
795 (version "1.0")
796 (source
797 (origin
798 (method git-fetch)
799 (uri (git-reference
800 (url "https://github.com/jhawthorn/fzy")
801 (commit version)))
802 (file-name (git-file-name name version))
803 (sha256
804 (base32
805 "1gkzdvj73f71388jvym47075l9zw61v6l8wdv2lnc0mns6dxig0k"))))
806 (build-system gnu-build-system)
807 (arguments
808 (list #:make-flags
809 #~(list (string-append "CC=" #$(cc-for-target))
810 (string-append "PREFIX=" #$output))
811 #:phases
812 #~(modify-phases %standard-phases
813 (delete 'configure))))
814 (home-page "https://github.com/jhawthorn/fzy")
815 (synopsis "Fast fuzzy text selector for the terminal with an advanced
816scoring algorithm")
817 (description
818 "Most other fuzzy matchers sort based on the length of a match. fzy tries
819to find the result the user intended. It does this by favouring matches on
820consecutive letters and starts of words. This allows matching using acronyms
821or different parts of the path.
822
823fzy is designed to be used both as an editor plugin and on the command
824line. Rather than clearing the screen, fzy displays its interface directly
825below the current cursor position, scrolling the screen if necessary.")
826 (license license:expat)))
827
828(define-public hstr
829 (package
830 (name "hstr")
831 (version "3.1")
832 (source (origin
833 (method git-fetch)
834 (uri (git-reference
835 (url "https://github.com/dvorka/hstr")
836 (commit version)))
837 (file-name (git-file-name name version))
838 (sha256
839 (base32
840 "1w1xr0ddf34i46b8wwz2snf7ap6m0mv53zid3d1l5hc4m3az5qis"))))
841 (build-system gnu-build-system)
842 (arguments
843 `(#:phases
844 (modify-phases %standard-phases
845 (add-before 'build 'adjust-ncurses-includes
846 (lambda* (#:key make-flags outputs #:allow-other-keys)
847 (let ((out (assoc-ref outputs "out")))
848 (substitute* "src/include/hstr_curses.h"
849 (("ncursesw\\/curses.h") "ncurses.h"))
850 (substitute* "src/include/hstr.h"
851 (("ncursesw\\/curses.h") "ncurses.h")))
852 #t)))))
853 (native-inputs
854 (list autoconf automake pkg-config))
855 (inputs
856 (list ncurses readline))
857 (synopsis "Navigate and search command history with shell history suggest box")
858 (description "HSTR (HiSToRy) is a command-line utility that brings
859improved Bash and Zsh command completion from the history. It aims to make
860completion easier and more efficient than with @kbd{Ctrl-R}. It allows you to
861easily view, navigate, and search your command history with suggestion boxes.
862HSTR can also manage your command history (for instance you can remove
863commands that are obsolete or contain a piece of sensitive information) or
864bookmark your favourite commands.")
865 (home-page "https://me.mindforger.com/projects/hh.html")
866 (license license:asl2.0)))
867
868(define-public shell-functools
869 ;; v0.3.0 was released in 2018, there are changes providing fixes to the
870 ;; test suite, use the latest commit.
871 (let ((commit "530e3b6f098c41869f9dc47d1a3005e12ce300c0")
872 (revision "0"))
873 (package
874 (name "shell-functools")
875 (version (git-version "0.3.0" revision commit))
876 (source (origin
877 (method git-fetch)
878 (uri (git-reference
879 (url "https://github.com/sharkdp/shell-functools")
880 (commit commit)))
881 (file-name (git-file-name name version))
882 (sha256
883 (base32
884 "0l23n5anppxds4678qnh84mykbdb7qxyjrxxjzm7kin7izfzczpa"))))
885 (build-system pyproject-build-system)
886 (native-inputs
887 (list python-pytest
888 python-hatchling))
889 (home-page "https://github.com/sharkdp/shell-functools/")
890 (synopsis "Functional programming tools for the shell")
891 (description
892 "This package provides higher order functions like map,filter, foldl,
893sort_by and take_while as simple command-line tools. Following the UNIX
894philosophy, these commands are designed to be composed via pipes. A large
895collection of functions such as basename, replace, contains or is_dir are
896provided as arguments to these commands.")
897 (license license:expat))))
898
899(define-public rig
900 (package
901 (name "rig")
902 (version "1.11")
903 (source (origin
904 (method url-fetch)
905 (uri (string-append "mirror://sourceforge/rig/rig/"
906 version "/rig-"
907 version ".tar.gz"))
908 (sha256
909 (base32
910 "1f3snysjqqlpk2kgvm5p2icrj4lsdymccmn3igkc2f60smqckgq0"))))
911 (build-system gnu-build-system)
912 (arguments `(#:make-flags
913 (list (string-append "CXX=" ,(cxx-for-target))
914 (string-append "PREFIX=" %output))
915 #:phases
916 (modify-phases %standard-phases
917 (delete 'configure)
918 (add-after 'unpack 'fix-build
919 (lambda _
920 (substitute* "rig.cc"
921 (("^#include <string>")
922 "#include <cstring>"))
923 (substitute* "Makefile"
924 (("g\\+\\+")
925 "${CXX} -O2")
926 (("install -g 0 -m 755 -o 0 -s rig \\$\\(BINDIR\\)")
927 "install -m 755 -d $(DESTDIR)$(BINDIR)\n\t\
928install -m 755 rig $(DESTDIR)$(BINDIR)/rig")
929 (("install -g 0 -m 644 -o 0 rig.6 \\$\\(MANDIR\\)/man6/rig.6")
930 "install -m 755 -d $(DESTDIR)$(MANDIR)/man6/\n\t\
931install -m 644 rig.6 $(DESTDIR)$(MANDIR)/man6/rig.6")
932 (("install -g 0 -m 755 -o 0 -d \\$\\(DATADIR\\)")
933 "install -m 755 -d $(DESTDIR)$(DATADIR)")
934 (("install -g 0 -m 644 -o 0 data/\\*.idx \\$\\(DATADIR\\)")
935 "install -m 644 data/*.idx $(DESTDIR)$(DATADIR)")))))
936 #:tests? #f))
937 (home-page "https://rig.sourceforge.net")
938 (synopsis "Random identity generator")
939 (description
940 "RIG (Random Identity Generator) generates random, yet real-looking,
941personal data. It is useful if you need to feed a name to a Web site, BBS, or
942real person, and are too lazy to think of one yourself. Also, if the Web
943site/BBS/person you are giving the information to tries to cross-check the
944city, state, zip, or area code, it will check out.")
945 (license license:gpl2+)))
946
947(define-public conflict
948 (package
949 (name "conflict")
950 (version "20221002")
951 (source (origin
952 (method url-fetch)
953 (uri (string-append
954 "https://invisible-mirror.net/archives/conflict/conflict-"
955 version ".tgz"))
956 (sha256
957 (base32
958 "1z6z61yiss9m45m3agqs92l569r55w9nsqaap56kh568mcy3y64c"))))
959 (build-system gnu-build-system)
960 (arguments
961 `(#:phases
962 (modify-phases %standard-phases
963 (add-after 'unpack 'fix-paths
964 (lambda _
965 (substitute* "run_test.sh"
966 (("PATH=\".:\\$BIN:/bin\"")
967 "PATH=\".:$BIN:$PATH\"")))))))
968 (home-page "https://invisible-island.net/conflict/conflict.html")
969 (synopsis "Displays conflicting filenames in your execution path")
970 (description
971 "@code{conflict} examines the user-specifiable list of programs, looking
972for instances in the user's path which conflict (i.e., the name appears in
973more than one point in the path).")
974 (license (license:x11-style "file://COPYING"))))
975
976(define-public renameutils
977 (package
978 (name "renameutils")
979 (version "0.12.0")
980 (source
981 (origin
982 (method url-fetch)
983 (uri (string-append "mirror://savannah/renameutils/"
984 "renameutils-" version ".tar.gz"))
985 (sha256
986 (base32
987 "18xlkr56jdyajjihcmfqlyyanzyiqqlzbhrm6695mkvw081g1lnb"))
988 (modules '((guix build utils)))
989 (snippet '(begin
990 (substitute* "src/Makefile.in"
991 (("\\(\\$bindir\\)") "$(bindir)"))
992 #t))))
993 (build-system gnu-build-system)
994 (inputs
995 (list readline))
996 (home-page "https://www.nongnu.org/renameutils/")
997 (synopsis "File renaming utilities")
998 (description "The file renaming utilities (renameutils for short) are a
999set of programs designed to make renaming of files faster and less cumbersome.
1000The file renaming utilities consists of five programs: @command{qmv},
1001@command{qcp}, @command{imv}, @command{icp}, and @command{deurlname}.")
1002 (license license:gpl3+)))
1003
1004(define-public grc
1005 (package
1006 (name "grc")
1007 (version "1.13")
1008 (source
1009 (origin
1010 (method git-fetch)
1011 (uri (git-reference
1012 (url "https://github.com/garabik/grc")
1013 (commit (string-append "v" version))))
1014 (file-name (git-file-name name version))
1015 (sha256
1016 (base32 "1h0h88h484a9796hai0wasi1xmjxxhpyxgixn6fgdyc5h69gv8nl"))))
1017 (build-system gnu-build-system)
1018 (inputs
1019 (list python))
1020 (arguments
1021 (list
1022 #:phases
1023 #~(modify-phases %standard-phases
1024 (delete 'configure)
1025 (replace 'build
1026 (lambda _
1027 (substitute* "grc"
1028 (("conffilenames = \\[.*\\]")
1029 (string-append
1030 "conffilenames = ["
1031 "os.environ.get('GUIX_ENVIRONMENT', '" #$output "') "
1032 "+ '/etc/grc.conf']")))
1033 (substitute* "grcat"
1034 (("conffilepath \\+= \\['/usr/.*\\]")
1035 (string-append
1036 "conffilepath += ["
1037 "os.environ.get('GUIX_ENVIRONMENT', '" #$output "') "
1038 "+ '/share/grc/']"))))) ;; trailing slash!
1039 (delete 'check)
1040 (replace 'install
1041 (lambda _
1042 (invoke "sh" "install.sh" #$output #$output))))))
1043 (home-page "http://kassiopeia.juls.savba.sk/~garabik/software/grc.html")
1044 (synopsis "Generic colouriser for everything")
1045 (description "@code{grc} can be used to colourise logfiles, output of
1046shell commands, arbitrary text, etc. Many shell commands are supported out of
1047the box.
1048
1049You might want to add these lines you your @code{~/.bashrc}:
1050@example
1051GRC_ALIASES=true
1052source ${GUIX_ENVIRONMENT:-$HOME/.guix-profile}/etc/profile.d/grc.sh
1053@end example
1054")
1055 (license license:gpl2)))
1056
1057(define-public liquidprompt
1058 (package
1059 (name "liquidprompt")
1060 (version "2.2.1")
1061 (home-page "https://github.com/liquidprompt/liquidprompt")
1062 (source
1063 (origin
1064 (method git-fetch)
1065 (uri (git-reference
1066 (url "https://github.com/liquidprompt/liquidprompt")
1067 (commit (string-append "v" version))))
1068 (file-name (git-file-name name version))
1069 (sha256
1070 (base32 "1xm3cb2dinn0zqqqya4qz2v8mp8hb6f1mckqvc6npdf8xlcwap35"))))
1071 (build-system copy-build-system)
1072 (arguments
1073 (list
1074 #:install-plan #~'(("example.bashrc" "share/liquidprompt/examples/")
1075 ("liquidprompt" "share/liquidprompt/")
1076 ("contrib" "share/liquidprompt/")
1077 ("templates" "share/liquidprompt/")
1078 ("themes" "share/liquidprompt/")
1079 ("liquidprompt.plugin.zsh"
1080 "share/zsh/plugins/liquidprompt/")
1081 ("docs" #$(string-append "share/doc/" name "-"
1082 version "/")))
1083 #:phases #~(modify-phases %standard-phases
1084 (add-after 'unpack 'fix-plugin
1085 (lambda _
1086 (substitute* "liquidprompt.plugin.zsh"
1087 (("source(.*)$")
1088 (string-append "source "
1089 #$output
1090 "/share/liquidprompt/liquidprompt")))))
1091 (add-after 'fix-plugin 'fix-utils-path
1092 (lambda* (#:key inputs #:allow-other-keys)
1093 (substitute* "liquidprompt"
1094 (("([ (])\\\\?(tput|hostname|cksum|uname|tty|grep)([) ])"
1095 all beginning command ending)
1096 (string-append beginning
1097 (search-input-file
1098 inputs
1099 (string-append "bin/" command))
1100 ending)))))
1101 (add-after 'install 'install-generated-config
1102 (lambda* (#:key outputs #:allow-other-keys)
1103 (let* ((out (assoc-ref outputs "out"))
1104 (etc (string-append out "/etc"))
1105 (config (string-append etc "/liquidpromptrc")))
1106 (mkdir etc)
1107 (with-output-to-file config
1108 (lambda _
1109 (invoke "./tools/config-from-doc.sh")))))))))
1110 (inputs (list ncurses
1111 coreutils
1112 inetutils))
1113 (synopsis "Full-featured prompt for Bash & Zsh")
1114 (description
1115 "Liquidprompt is an adaptive prompt for Bash and Zsh that gives
1116you a nicely displayed prompt with useful information when you need it. It
1117does this with a powerful theming engine and a large array of data sources.
1118
1119In order to use liquidprompt with Zsh, you should use the following snippet
1120with Guix Home:
1121
1122@example
1123(service home-zsh-service-type
1124 (home-zsh-configuration
1125 (zshrc (list ;;...
1126 ;; This loads liquidprompt
1127 (mixed-text-file \"liquidprompt\"
1128 \"[[ $- = *i* ]] && source \" liquidprompt \"/share/liquidprompt/liquidprompt\")
1129 ;; This loads the powerline theme available in liquidprompt
1130 (mixed-text-file \"powerline-theme\"
1131 \"source \" liquidprompt \"/share/liquidprompt/themes/powerline/powerline.theme\"))))))
1132@end example\n")
1133 (license license:agpl3+)))
1134
1135(define-public fzf-tab
1136 (package
1137 (name "fzf-tab")
1138 (version "1.1.2")
1139 (home-page "https://github.com/Aloxaf/fzf-tab")
1140 (source (origin
1141 (method git-fetch)
1142 (uri (git-reference
1143 (url "https://github.com/Aloxaf/fzf-tab")
1144 (commit (string-append "v" version))))
1145 (file-name (git-file-name name version))
1146 (sha256
1147 (base32
1148 "061jjpgghn8d5q2m2cd2qdjwbz38qrcarldj16xvxbid4c137zs2"))))
1149 (build-system copy-build-system)
1150 (arguments
1151 '(#:install-plan '(("lib" "/share/zsh/plugins/fzf-tab/")
1152 ("modules" "/share/zsh/plugins/fzf-tab/")
1153 ("fzf-tab.plugin.zsh" "/share/zsh/plugins/fzf-tab/")
1154 ("fzf-tab.zsh" "/share/zsh/plugins/fzf-tab/")
1155 ("README.md" "/share/doc/fzf-tab/"))))
1156 (synopsis "Replace the zsh default completion menu with fzf")
1157 (description
1158 "The fzf-tab package replaces the default completion menu of the zsh
1159shell with fzf, enabling fuzzy finding and multi-selection.")
1160 (license license:expat)))
1161
1162(define-public pay-respects
1163 (package
1164 (name "pay-respects")
1165 (version "0.7.12")
1166 (source
1167 (origin
1168 (method url-fetch)
1169 (uri (crate-uri "pay-respects" version))
1170 (file-name (string-append name "-" version ".tar.gz"))
1171 (sha256
1172 (base32 "0nmh5kkjhsrmhwlb09wvg6chzpl7w7xq1qr1yy9gc202yrv6cnmk"))))
1173 (build-system cargo-build-system)
1174 (arguments
1175 (list
1176 #:install-source? #f
1177 #:modules
1178 '((guix build cargo-build-system)
1179 (guix build utils)
1180 (ice-9 match))
1181 #:phases
1182 #~(modify-phases %standard-phases
1183 (add-after 'install 'install-completions
1184 (lambda* (#:key native-inputs #:allow-other-keys)
1185 (for-each
1186 (match-lambda
1187 ((shell . path)
1188 (mkdir-p (in-vicinity #$output (dirname path)))
1189 (let ((binary
1190 (if #$(%current-target-system)
1191 (search-input-file native-inputs "bin/pay-respects")
1192 (in-vicinity #$output "bin/pay-respects"))))
1193 (with-output-to-file (in-vicinity #$output path)
1194 (lambda _
1195 (invoke binary shell)))
1196 ;; The shell completions call the binary so we make sure
1197 ;; that we call the correct binary.
1198 (when #$(%current-target-system)
1199 (substitute* (in-vicinity #$output path)
1200 (((search-input-file native-inputs "bin/pay-respects"))
1201 (in-vicinity #$output "bin/pay-respects")))))))
1202 '(("bash" . "share/bash-completion/completions/pay-respects")
1203 ("fish" . "share/fish/vendor_completions.d/pay-respects.fish")
1204 ("nushell" . "share/nushell/vendor/autoload/pay-respects")
1205 ("zsh" . "share/zsh/site-functions/_pay-respects"))))))))
1206 (native-inputs
1207 (if (%current-target-system)
1208 (list this-package)
1209 '()))
1210 (inputs (cargo-inputs 'pay-respects))
1211 (home-page "https://codeberg.org/iff/pay-respects")
1212 (synopsis "Suggest correction for mistyped console commands")
1213 (description
1214 "@command{pay-respects} provides a shell helper to suggest correction for
1215mistyped commands, with @command{guix locate} integration and an alias (default
1216to @command{f}) to correct the previous command.")
1217 (license license:agpl3+)))