1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 Matthew Jordan <matthewjordandevops@yandex.com>
3 ;;; Copyright © 2016, 2017 Alex Griffin <a@ajgrf.com>
4 ;;; Copyright © 2016 Christopher Baines <mail@cbaines.net>
5 ;;; Copyright © 2017 Stefan Reichör <stefan@xsteve.at>
6 ;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2018 Benjamin Slade <slade@jnanam.net>
8 ;;; Copyright © 2019 Collin J. Doering <collin@rekahsoft.ca>
9 ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
10 ;;; Copyright © 2020 aecepoglu <aecepoglu@fastmail.fm>
11 ;;; Copyright © 2020 Dion Mendel <guix@dm9.info>
12 ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
13 ;;; Copyright © 2021 Alexandr Vityazev <avityazev@posteo.org>
14 ;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
15 ;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>
16 ;;; Copyright © 2021 Wiktor Żelazny <wzelazny@vurv.cz>
17 ;;; Copyright © 2022 Jose G Perez Taveras <josegpt27@gmail.com>
19 ;;; This file is part of GNU Guix.
21 ;;; GNU Guix is free software; you can redistribute it and/or modify it
22 ;;; under the terms of the GNU General Public License as published by
23 ;;; the Free Software Foundation; either version 3 of the License, or (at
24 ;;; your option) any later version.
26 ;;; GNU Guix is distributed in the hope that it will be useful, but
27 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
28 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 ;;; GNU General Public License for more details.
31 ;;; You should have received a copy of the GNU General Public License
32 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
34 (define-module (gnu packages shellutils)
35 #:use-module ((guix licenses) #:prefix license:)
36 #:use-module (guix gexp)
37 #:use-module (guix utils)
38 #:use-module (guix packages)
39 #:use-module (guix download)
40 #:use-module (guix git-download)
41 #:use-module (guix build-system copy)
42 #:use-module (guix build-system gnu)
43 #:use-module (guix build-system go)
44 #:use-module (guix build-system python)
45 #:use-module (gnu packages autotools)
46 #:use-module (gnu packages base)
47 #:use-module (gnu packages bison)
48 #:use-module (gnu packages check)
49 #:use-module (gnu packages flex)
50 #:use-module (gnu packages golang)
51 #:use-module (gnu packages libunistring)
52 #:use-module (gnu packages ncurses)
53 #:use-module (gnu packages pcre)
54 #:use-module (gnu packages pkg-config)
55 #:use-module (gnu packages python)
56 #:use-module (gnu packages python-xyz)
57 #:use-module (gnu packages readline)
58 #:use-module (gnu packages ruby)
59 #:use-module (gnu packages shells)
60 #:use-module (gnu packages textutils)
61 #:use-module (gnu packages tmux)
62 #:use-module (gnu packages vim))
70 (uri (string-append "http://www.catb.org/~esr/ascii/"
71 "ascii-" version ".tar.gz"))
74 "0b87vy06s8s3a8q70pqavsbk4m4ff034sdml2xxa6qfsykaj513j"))))
75 (build-system gnu-build-system)
76 (arguments `(#:make-flags
77 (list (string-append "CC=" ,(cc-for-target))
78 (string-append "PREFIX=" %output))
80 (modify-phases %standard-phases
82 (add-before 'install 'create-directories
83 (lambda* (#:key outputs #:allow-other-keys)
84 (let* ((out (assoc-ref outputs "out"))
85 (bin (string-append out "/bin"))
86 (man1 (string-append out "/share/man/man1")))
90 (home-page "http://www.catb.org/~esr/ascii/")
91 (synopsis "ASCII name and synonym chart")
93 "The @code{ascii} utility provides easy conversion between various byte
94 representations and the American Standard Code for Information Interchange
95 (ASCII) character table. It knows about a wide variety of hex, binary, octal,
96 Teletype mnemonic, ISO/ECMA code point, slang names, XML entity names, and
97 other representations. Given any one on the command line, it will try to
98 display all others. Called with no arguments it displays a handy small ASCII
100 (license license:bsd-2)))
109 (url "https://github.com/ascii-boxes/boxes")
110 (commit (string-append "v" version))))
111 (file-name (git-file-name name version))
114 "1bf5rnfiw04ffs1l17zhbg4wvq2vfn2qbz1xmd250xqj15lysw88"))))
115 (build-system gnu-build-system)
117 `(#:test-target "test"
118 #:make-flags (list (string-append "GLOBALCONF="
119 (assoc-ref %outputs "out")
120 "/etc/boxes-config"))
123 ,@%gnu-build-system-modules)
125 (modify-phases %standard-phases
128 (lambda* (#:key outputs #:allow-other-keys)
129 (let ((out (assoc-ref outputs "out")))
130 (for-each (match-lambda
133 (string-append out "/" target))))
134 '(("out/boxes" "bin/")
135 ("doc/boxes.1" "share/man/man1/")
136 ("boxes-config" "etc/")))))))))
142 (list libunistring pcre2))
143 (home-page "https://boxes.thomasjensen.com")
144 (synopsis "Command line ASCII boxes")
146 "This command-line filter program draws ASCII-art boxes around your input
148 (license license:gpl2)))
150 (define-public zsh-autopair
152 (name "zsh-autopair")
154 (home-page "https://github.com/hlissner/zsh-autopair")
158 (url "https://github.com/hlissner/zsh-autopair.git")
159 (commit (string-append "v" version))))
160 (file-name (git-file-name name version))
163 "1h0vm2dgrmb8i2pvsgis3lshc5b0ad846836m62y8h3rdb3zmpy1"))))
164 (build-system copy-build-system)
166 '(#:install-plan '(("autopair.zsh"
167 "/share/zsh/plugins/zsh-autopair/zsh-autopair.zsh"))))
168 (synopsis "Auto-close and delete matching delimiters in Zsh")
170 "This Zsh plugin auto-closes, deletes, and skips over matching delimiters
171 in Zsh intelligently.")
172 (license license:expat)))
174 (define-public zsh-autosuggestions
176 (name "zsh-autosuggestions")
181 (url "https://github.com/zsh-users/zsh-autosuggestions")
182 (commit (string-append "v" version))))
183 (file-name (git-file-name name version))
186 "1g3pij5qn2j7v7jjac2a63lxd97mcsgw6xq6k5p7835q9fjiid98"))))
187 (build-system gnu-build-system)
198 (modify-phases %standard-phases
199 (add-after 'unpack 'patch-tests
201 ;; Failing tests since tmux-3.2a
202 (delete-file "spec/options/buffer_max_size_spec.rb")))
204 (replace 'check ; Tests use ruby's bundler; instead execute rspec directly.
206 (setenv "TMUX_TMPDIR" (getenv "TMPDIR"))
207 (setenv "SHELL" (which "zsh"))
210 (lambda* (#:key outputs #:allow-other-keys)
211 (let* ((out (assoc-ref outputs "out"))
213 (string-append out "/share/zsh/plugins/zsh-autosuggestions")))
214 (invoke "make" "all")
215 (install-file "zsh-autosuggestions.zsh" zsh-plugins)
217 (home-page "https://github.com/zsh-users/zsh-autosuggestions")
218 (synopsis "Fish-like autosuggestions for zsh")
220 "Fish-like fast/unobtrusive autosuggestions for zsh. It suggests commands
222 (license license:expat)))
224 (define-public zsh-syntax-highlighting
226 (name "zsh-syntax-highlighting")
231 (url "https://github.com/zsh-users/zsh-syntax-highlighting")
233 (file-name (git-file-name name version))
236 "039g3n59drk818ylcyvkciv8k9mf739cv6v4vis1h9fv9whbcmwl"))))
237 (build-system gnu-build-system)
241 ;; FIXME: Tests fail when running test regexp
242 ;; there is no pcre module in the Guix zsh package
245 (modify-phases %standard-phases
247 (add-after 'unpack 'patch-paths
248 (lambda* (#:key outputs #:allow-other-keys)
249 (let ((out (assoc-ref outputs "out")))
250 (substitute* "Makefile"
252 (("share/\\$\\(NAME\\)") "share/zsh/plugins/$(NAME)")))))
253 (add-after 'patch-paths 'make-writable
255 (for-each make-file-writable
256 '("docs/highlighters.md"
258 (add-before 'build 'add-all-md
260 (invoke "make" "all")))
262 (lambda* (#:key tests? #:allow-other-keys)
264 (invoke "make" "test")
265 (invoke "make" "perf")))))))
266 (home-page "https://github.com/zsh-users/zsh-syntax-highlighting")
267 (synopsis "Fish shell-like syntax highlighting for Zsh")
269 "This package provides syntax highlighting for Zsh. It enables
270 highlighting of commands whilst they are typed at a Zsh prompt into an
271 interactive terminal. This helps in reviewing commands before running them,
272 particularly in catching syntax errors.")
273 (license license:bsd-3)))
275 (define-public grml-zsh-config
277 (name "grml-zsh-config")
282 "https://deb.grml.org/pool/main/g/grml-etc-core/grml-etc-core_"
286 "05fri77028znjnvmh8mz3424rn8ilysj7hn8br2hk1qwkp4zzwp9"))))
287 (build-system copy-build-system)
293 (add-before 'install 'make-doc
294 (lambda _ (with-directory-excursion "doc" (invoke "make")))))
296 #~'(("etc/skel/.zshrc" "etc/skel/.zshrc")
297 ("etc/zsh/keephack" "etc/zsh/keephack")
298 ("etc/zsh/zshrc" "etc/zsh/zshrc")
299 ("doc/grmlzshrc.5" "share/man/man5/grmlzshrc.5"))))
300 (native-inputs (list txt2tags))
301 (home-page "https://grml.org/zsh/")
302 (synopsis "Grml's zsh configuration")
303 (description "This package provides an interactive setup for zsh
304 preconfigured by the Grml project.")
305 (license license:gpl2)))
314 (url "https://github.com/rupa/z")
315 (commit (string-append "v" version))))
316 (file-name (git-file-name name version))
319 "13zbgkj6y0qhvn5jpkrqbd4jjxjr789k228iwma5hjfh1nx7ghyb"))))
320 (build-system gnu-build-system)
322 `(#:tests? #f ; No tests provided
324 (modify-phases %standard-phases
328 (lambda* (#:key outputs #:allow-other-keys)
329 (let* ((out (assoc-ref outputs "out"))
330 (man (string-append out "/share/man/man1"))
331 (bin (string-append out "/bin")))
332 (install-file "z.sh" bin)
333 (chmod (string-append bin "/z.sh") #o755)
334 (install-file "z.1" man)
336 (synopsis "Jump about directories")
338 "Tracks your most used directories, based on ``frecency''. After a short
339 learning phase, z will take you to the most ``frecent'' directory that matches
340 all of the regexes given on the command line in order.")
341 (home-page "https://github.com/rupa/z")
342 (license license:expat)))
344 (define-public envstore
351 (uri (string-append "https://finalrewind.org/projects/"
352 name "/" name "-" version ".tar.bz2"))
354 (base32 "1x97lxad80m5blhdfanl5v2qzjwcgbij2i23701bn8mpyxsrqszi"))))
355 (build-system gnu-build-system)
357 `(#:test-target "test"
358 #:make-flags (list "CC=gcc"
359 (string-append "PREFIX=" (assoc-ref %outputs "out")))
361 (modify-phases %standard-phases
362 (delete 'configure))))
363 (home-page "https://finalrewind.org/projects/envstore/")
364 (synopsis "Save and restore environment variables")
365 (description "Envstore is a program for sharing environment variables
366 between various shells or commands.")
367 (license license:wtfpl2)))
369 (define-public trash-cli
372 (version "0.21.10.24")
377 (url "https://github.com/andreafrancia/trash-cli")
379 (file-name (git-file-name name version))
382 "01is32lk6prwhajvlmgn3xs4fcpmiqivizcqkj9k80jx6mqjifzs"))))
383 (build-system python-build-system)
386 (modify-phases %standard-phases
387 (add-before 'build 'patch-path-constants
388 (lambda* (#:key inputs #:allow-other-keys)
389 (let ((libc (assoc-ref inputs "libc"))
390 (coreutils (assoc-ref inputs "coreutils")))
391 (substitute* "trashcli/list_mount_points.py"
392 (("\"/lib/libc.so.6\".*")
393 (string-append "\"" libc "/lib/libc.so.6\"\n"))
395 (string-append "\"" coreutils "/bin/df\""))))))
396 (add-before 'build 'fix-setup.py
397 (lambda* (#:key outputs #:allow-other-keys)
398 (let* ((out (assoc-ref outputs "out"))
399 (bin (string-append out "/bin")))
401 (substitute* "setup.py"
403 (string-append "add_script('" bin "/" ))))))
404 ;; Whenever setup.py is invoked, scripts in out/bin/ are
405 ;; replaced. Thus we cannot invoke setup.py for testing.
406 ;; Upstream also uses pytest.
408 (lambda* (#:key tests? #:allow-other-keys)
410 (invoke "pytest")))))))
415 (inputs (list coreutils))
417 (list python-psutil))
418 (home-page "https://github.com/andreafrancia/trash-cli")
419 (synopsis "Trash can management tool")
421 "trash-cli is a command line utility for interacting with the
422 FreeDesktop.org trash can used by GNOME, KDE, XFCE, and other common desktop
423 environments. It can move files to the trash, and remove or list files that
425 (license license:gpl2+)))
427 (define-public direnv
432 (origin (method git-fetch)
434 (url "https://github.com/direnv/direnv")
435 (commit (string-append "v" version))))
436 (file-name (git-file-name name version))
439 "1i473j7j4sx8p83zqlnakskqk0jyd3byajp7jmv2gym9s4k841y7"))))
440 (build-system go-build-system)
442 '(#:import-path "github.com/direnv/direnv"
444 (modify-phases %standard-phases
445 (add-after 'install 'install-manpages
446 (lambda* (#:key outputs #:allow-other-keys)
447 (let* ((out (assoc-ref outputs "out"))
448 (man (string-append out "/share/man/man1")))
450 (with-directory-excursion "src/github.com/direnv/direnv"
451 (install-file "man/direnv.1" man)
452 (install-file "man/direnv-stdlib.1" man)
453 (install-file "man/direnv.toml.1" man)))))
455 (lambda* (#:key tests? #:allow-other-keys)
457 (setenv "HOME" "/tmp")
458 (with-directory-excursion "src/github.com/direnv/direnv"
459 ;; The following file needs to be writable so it can be
460 ;; modified by the testsuite.
461 (make-file-writable "test/scenarios/base/.envrc")
462 ;; We need to manually run test because make test
463 ;; tries to use go modules
464 (invoke "go" "test" "./...")
465 ;; Clean up from the tests, especially so that the extra
466 ;; direnv executable that's generated is removed.
467 (invoke "make" "clean"))))))))
469 (list go-github-com-burntsushi-toml go-github-com-direnv-go-dotenv
470 go-github-com-mattn-go-isatty go-golang-org-x-mod which))
471 (home-page "https://direnv.net/")
472 (synopsis "Environment switcher for the shell")
474 "direnv can hook into the bash, zsh, tcsh, and fish shells to load
475 or unload environment variables depending on the current directory. This
476 allows project-specific environment variables without using @file{~/.profile}.
478 Before each prompt, direnv checks for the existence of a @file{.envrc} file in
479 the current and parent directories. This file is then used to alter the
480 environment variables of the current shell.")
481 (license license:expat)))
491 (url "https://github.com/jhawthorn/fzy")
493 (file-name (git-file-name name version))
496 "1gkzdvj73f71388jvym47075l9zw61v6l8wdv2lnc0mns6dxig0k"))))
497 (build-system gnu-build-system)
499 '(#:make-flags (list "CC=gcc"
500 (string-append "PREFIX=" (assoc-ref %outputs "out")))
502 (modify-phases %standard-phases
503 (delete 'configure))))
504 (home-page "https://github.com/jhawthorn/fzy")
505 (synopsis "Fast fuzzy text selector for the terminal with an advanced
508 "Most other fuzzy matchers sort based on the length of a match. fzy tries
509 to find the result the user intended. It does this by favouring matches on
510 consecutive letters and starts of words. This allows matching using acronyms
511 or different parts of the path.
513 fzy is designed to be used both as an editor plugin and on the command
514 line. Rather than clearing the screen, fzy displays its interface directly
515 below the current cursor position, scrolling the screen if necessary.")
516 (license license:expat)))
525 (url "https://github.com/dvorka/hstr")
527 (file-name (git-file-name name version))
530 "0xg10jyiq12bcygi6aa9qq9pki7bipdsvsza037p2iqix19jg0x8"))))
531 (build-system gnu-build-system)
534 (modify-phases %standard-phases
535 (add-before 'build 'adjust-ncurses-includes
536 (lambda* (#:key make-flags outputs #:allow-other-keys)
537 (let ((out (assoc-ref outputs "out")))
538 (substitute* "src/include/hstr_curses.h"
539 (("ncursesw\\/curses.h") "ncurses.h"))
540 (substitute* "src/include/hstr.h"
541 (("ncursesw\\/curses.h") "ncurses.h")))
544 (list autoconf automake pkg-config))
546 (list ncurses readline))
547 (synopsis "Navigate and search command history with shell history suggest box")
548 (description "HSTR (HiSToRy) is a command-line utility that brings
549 improved Bash and Zsh command completion from the history. It aims to make
550 completion easier and more efficient than with @kbd{Ctrl-R}. It allows you to
551 easily view, navigate, and search your command history with suggestion boxes.
552 HSTR can also manage your command history (for instance you can remove
553 commands that are obsolete or contain a piece of sensitive information) or
554 bookmark your favourite commands.")
555 (home-page "http://me.mindforger.com/projects/hh.html")
556 (license license:asl2.0)))
558 (define-public shell-functools
560 (name "shell-functools")
565 (url "https://github.com/sharkdp/shell-functools")
566 (commit (string-append "v" version))))
567 (file-name (git-file-name name version))
570 "0d6zzg7cxfrzwzh1wmpj7q85kz33sak6ac59ncsm6dlbin12h0hi"))))
571 (build-system python-build-system)
572 (home-page "https://github.com/sharkdp/shell-functools/")
573 (synopsis "Functional programming tools for the shell")
574 (description "This package provides higher order functions like map,
575 filter, foldl, sort_by and take_while as simple command-line tools. Following
576 the UNIX philosophy, these commands are designed to be composed via pipes. A
577 large collection of functions such as basename, replace, contains or is_dir
578 are provided as arguments to these commands.")
579 (license license:expat)))
587 (uri (string-append "mirror://sourceforge/rig/rig/"
592 "1f3snysjqqlpk2kgvm5p2icrj4lsdymccmn3igkc2f60smqckgq0"))))
593 (build-system gnu-build-system)
594 (arguments `(#:make-flags
595 (list (string-append "CXX=" ,(cxx-for-target))
596 (string-append "PREFIX=" %output))
598 (modify-phases %standard-phases
600 (add-after 'unpack 'fix-build
602 (substitute* "rig.cc"
603 (("^#include <string>")
604 "#include <cstring>"))
605 (substitute* "Makefile"
608 (("install -g 0 -m 755 -o 0 -s rig \\$\\(BINDIR\\)")
609 "install -m 755 -d $(DESTDIR)$(BINDIR)\n\t\
610 install -m 755 rig $(DESTDIR)$(BINDIR)/rig")
611 (("install -g 0 -m 644 -o 0 rig.6 \\$\\(MANDIR\\)/man6/rig.6")
612 "install -m 755 -d $(DESTDIR)$(MANDIR)/man6/\n\t\
613 install -m 644 rig.6 $(DESTDIR)$(MANDIR)/man6/rig.6")
614 (("install -g 0 -m 755 -o 0 -d \\$\\(DATADIR\\)")
615 "install -m 755 -d $(DESTDIR)$(DATADIR)")
616 (("install -g 0 -m 644 -o 0 data/\\*.idx \\$\\(DATADIR\\)")
617 "install -m 644 data/*.idx $(DESTDIR)$(DATADIR)")))))
619 (home-page "http://rig.sourceforge.net")
620 (synopsis "Random identity generator")
622 "RIG (Random Identity Generator) generates random, yet real-looking,
623 personal data. It is useful if you need to feed a name to a Web site, BBS, or
624 real person, and are too lazy to think of one yourself. Also, if the Web
625 site/BBS/person you are giving the information to tries to cross-check the
626 city, state, zip, or area code, it will check out.")
627 (license license:gpl2+)))
629 (define-public conflict
636 "https://invisible-mirror.net/archives/conflict/conflict-"
640 "0mls4climvp7v9hnc3zh01mh270kqcj797ng0xslwb027lipis4h"))))
641 (build-system gnu-build-system)
644 (modify-phases %standard-phases
645 (add-after 'unpack 'fix-paths
647 (substitute* "run_test.sh"
648 (("PATH=\".:\\$BIN:/bin\"")
649 "PATH=\".:$BIN:$PATH\"")))))))
650 (home-page "https://invisible-island.net/conflict/conflict.html")
651 (synopsis "Displays conflicting filenames in your execution path")
653 "@code{conflict} examines the user-specifiable list of programs, looking
654 for instances in the user's path which conflict (i.e., the name appears in
655 more than one point in the path).")
656 (license (license:x11-style "file://COPYING"))))
658 (define-public renameutils
665 (uri (string-append "mirror://savannah/renameutils/"
666 "renameutils-" version ".tar.gz"))
669 "18xlkr56jdyajjihcmfqlyyanzyiqqlzbhrm6695mkvw081g1lnb"))
670 (modules '((guix build utils)))
672 (substitute* "src/Makefile.in"
673 (("\\(\\$bindir\\)") "$(bindir)"))
675 (build-system gnu-build-system)
678 (home-page "https://www.nongnu.org/renameutils/")
679 (synopsis "File renaming utilities")
680 (description "The file renaming utilities (renameutils for short) are a
681 set of programs designed to make renaming of files faster and less cumbersome.
682 The file renaming utilities consists of five programs: @command{qmv},
683 @command{qcp}, @command{imv}, @command{icp}, and @command{deurlname}.")
684 (license license:gpl3+)))
694 (url "https://github.com/garabik/grc")
695 (commit (string-append "v" version))))
696 (file-name (git-file-name name version))
698 (base32 "1h0h88h484a9796hai0wasi1xmjxxhpyxgixn6fgdyc5h69gv8nl"))))
699 (build-system gnu-build-system)
705 #~(modify-phases %standard-phases
710 (("conffilenames = \\[.*\\]")
713 "os.environ.get('GUIX_ENVIRONMENT', '" #$output "') "
714 "+ '/etc/grc.conf']")))
716 (("conffilepath \\+= \\['/usr/.*\\]")
719 "os.environ.get('GUIX_ENVIRONMENT', '" #$output "') "
720 "+ '/share/grc/']"))))) ;; trailing slash!
724 (invoke "sh" "install.sh" #$output #$output))))))
725 (home-page "http://kassiopeia.juls.savba.sk/~garabik/software/grc.html")
726 (synopsis "Generic colouriser for everything")
727 (description "@code{grc} can be used to colourise logfiles, output of
728 shell commands, arbitrary text, etc. Many shell commands are supported out of
731 You might want to add these lines you your @code{~/.bashrc}:
734 source ${GUIX_ENVIRONMENT:-$HOME/.guix-profile}/etc/profile.d/grc.sh
737 (license license:gpl2)))