1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
3 ;;; Copyright © 2014, 2015 David Thompson <davet@gnu.org>
4 ;;; Copyright © 2014 Kevin Lemonnier <lemonnierk@ulrar.net>
5 ;;; Copyright © 2015 Jeff Mickey <j@codemac.net>
6 ;;; Copyright © 2016 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2016 Stefan Reichör <stefan@xsteve.at>
8 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
9 ;;; Copyright © 2017 ng0 <ng0@no-reply.pragmatique.xyz>
10 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
12 ;;; This file is part of GNU Guix.
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27 (define-module (gnu packages shells)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages algebra)
30 #:use-module (gnu packages autotools)
31 #:use-module (gnu packages base)
32 #:use-module (gnu packages bison)
33 #:use-module (gnu packages documentation)
34 #:use-module (gnu packages groff)
35 #:use-module (gnu packages libbsd)
36 #:use-module (gnu packages libedit)
37 #:use-module (gnu packages ncurses)
38 #:use-module (gnu packages pcre)
39 #:use-module (gnu packages perl)
40 #:use-module (gnu packages pkg-config)
41 #:use-module (gnu packages python)
42 #:use-module (gnu packages readline)
43 #:use-module (gnu packages scheme)
44 #:use-module (guix build-system gnu)
45 #:use-module (guix build-system python)
46 #:use-module (guix download)
47 #:use-module (guix git-download)
48 #:use-module (guix licenses)
49 #:use-module (guix packages))
57 ;; The canonical source is offline, so we fetch the source code
58 ;; from the Git repository. See:
59 ;; https://www.mail-archive.com/dash@vger.kernel.org/msg01323.html
62 (url "https://git.kernel.org/pub/scm/utils/dash/dash.git/")
63 (commit (string-append "v" version))))
64 (file-name (string-append name "-" version "-checkout"))
67 "0p01vx7rbyf5hyyaff7h8cbhq81bm5fmq1m933484lncl9rafcai"))
68 (modules '((guix build utils)))
71 ;; The man page hails from BSD, where (d)ash is the default shell.
72 ;; This isn't the case on Guix or indeed most other GNU systems.
73 (substitute* "src/dash.1"
74 (("the standard command interpreter for the system")
75 "a command interpreter based on the original Bourne shell"))
77 (build-system gnu-build-system)
79 `(("autoconf" ,autoconf)
80 ("automake" ,automake)))
82 `(("libedit" ,libedit)))
85 (modify-phases %standard-phases
86 (add-before 'configure 'bootstrap
87 (lambda _ (zero? (system* "autoreconf" "-vfi")))))
88 #:configure-flags '("--with-libedit")))
89 (home-page "http://gondor.apana.org.au/~herbert/dash")
90 (synopsis "POSIX-compliant shell optimised for size")
92 "dash is a POSIX-compliant @command{/bin/sh} implementation that aims to be
93 as small as possible, often without sacrificing speed. It is faster than the
94 GNU Bourne-Again Shell (@command{bash}) at most scripted tasks. dash is a
95 direct descendant of NetBSD's Almquist Shell (@command{ash}).")
97 gpl2+)))) ; mksignames.c
105 (uri (string-append "https://fishshell.com/files/"
106 version "/fish-" version ".tar.gz"))
109 "19djav128nkhjxgfhwhc32i5y9d9c3karbh5yg67kqrdranyvh7q"))
110 (modules '((guix build utils)))
111 ;; Don't try to install /etc/fish/config.fish.
113 '(substitute* "Makefile.in"
114 ((".*INSTALL.*sysconfdir.*fish.*") "")))))
115 (build-system gnu-build-system)
117 `(("doxygen" ,doxygen)))
121 ("groff" ,groff) ;for 'fish --help'
122 ("pcre2" ,pcre2) ;don't use the bundled PCRE2
123 ("python" ,python-wrapper))) ;for fish_config and manpage completions
125 '(#:tests? #f ; no check target
126 #:configure-flags '("--sysconfdir=/etc")
128 (modify-phases %standard-phases
129 ;; Embed absolute paths to store items.
130 (add-after 'unpack 'embed-store-paths
131 (lambda* (#:key inputs outputs #:allow-other-keys)
132 (substitute* '("share/functions/math.fish"
133 "share/functions/seq.fish")
135 (string-append "| " (assoc-ref %build-inputs "bc")
137 (substitute* "share/functions/fish_update_completions.fish"
138 (("python") (which "python")))
139 (substitute* "share/functions/__fish_print_help.fish"
140 (("nroff") (which "nroff")))
142 (synopsis "The friendly interactive shell")
144 "Fish (friendly interactive shell) is a shell focused on interactive use,
145 discoverability, and friendliness. Fish has very user-friendly and powerful
146 tab-completion, including descriptions of every completion, completion of
147 strings with wildcards, and many completions for specific commands. It also
148 has extensive and discoverable help. A special help command gives access to
149 all the fish documentation in your web browser. Other features include smart
150 terminal handling based on terminfo, an easy to search history, and syntax
152 (home-page "https://fishshell.com/")
155 (define-public fish-guix
162 (uri (string-append "https://dist.pragmatique.xyz/fish-guix/"
163 name "-" version ".tar.xz"))
166 "0xi0j9lvzh43lrj82gz52n2cjln0i0pgayngrg4hy5w4449biy0z"))))
167 (build-system gnu-build-system)
169 `(#:tests? #f ; No checks.
171 (string-append "PREFIX=" %output))
173 (modify-phases %standard-phases
174 (delete 'configure)))) ; No configure script.
175 (home-page "https://pragmatique.xyz/software/fish-guix.html")
176 (synopsis "Fish completions for Guix")
178 "Fish-guix provides completions for Guix for users of the fish shell.")
179 (license public-domain)))
188 (url "git://github.com/rakitzis/rc.git")
189 ;; commit name 'release: rc-1.7.4'
190 (commit "c884da53a7c885d46ace2b92de78946855b18e92")))
193 "00mgzvrrh9w96xa85g4gjbsvq02f08k4jwjcdnxq7kyh5xgiw95l"))
194 (file-name (string-append name "-" version "-checkout"))))
195 (build-system gnu-build-system)
200 (modify-phases %standard-phases
203 (lambda _ (zero? (system* "autoreconf" "-vfi"))))
205 'autoreconf 'patch-trip.rc
207 (substitute* "trip.rc"
208 (("/bin/pwd") (which "pwd"))
209 (("/bin/sh") (which "sh"))
210 (("/bin/rm") (which "rm"))
211 (("/bin\\)") (string-append (dirname (which "rm")) ")")))
213 (inputs `(("readline" ,readline)
215 (native-inputs `(("autoconf" ,autoconf)
216 ("automake" ,automake)
218 ("pkg-config" ,pkg-config)))
219 (synopsis "Alternative implementation of the rc shell by Byron Rakitzis")
221 "This is a reimplementation by Byron Rakitzis of the Plan 9 shell. It
222 has a small feature set similar to a traditional Bourne shell.")
223 (home-page "https://github.com/rakitzis/rc")
233 (uri (string-append "https://github.com/wryun/es-shell/releases/"
234 "download/v" version "/es-" version ".tar.gz"))
237 "1fplzxc6lncz2lv2fyr2ig23rgg5j96rm2bbl1rs28mik771zd5h"))
238 (file-name (string-append name "-" version ".tar.gz"))))
239 (build-system gnu-build-system)
241 `(#:test-target "test"
243 (modify-phases %standard-phases
244 (add-before 'configure 're-enter-rootdir
245 ;; The tarball has no folder.
249 `(("readline" ,readline)))
252 (synopsis "Extensible shell with higher-order functions")
254 "Es is an extensible shell. The language was derived from the Plan 9
255 shell, rc, and was influenced by functional programming languages, such as
256 Scheme, and the Tcl embeddable programming language. This implementation is
257 derived from Byron Rakitzis's public domain implementation of rc, and was
258 written by Paul Haahr and Byron Rakitzis.")
259 (home-page "https://wryun.github.io/es-shell/")
260 (license public-domain)))
268 ;; Old tarballs are moved to old/.
269 (uri (list (string-append "ftp://ftp.astron.com/pub/tcsh/"
270 "tcsh-" version ".tar.gz")
271 (string-append "ftp://ftp.astron.com/pub/tcsh/"
272 "old/tcsh-" version ".tar.gz")))
275 "17ggxkkn5skl0v1x0j6hbv5l0sgnidfzwv16992sqkdm983fg7dq"))
276 (patches (search-patches "tcsh-fix-autotest.patch"
277 "tcsh-fix-out-of-bounds-read.patch"))
278 (patch-flags '("-p0"))))
279 (build-system gnu-build-system)
281 `(("autoconf" ,autoconf)
284 `(("ncurses" ,ncurses)))
287 (modify-phases %standard-phases
288 (add-before 'check 'patch-test-scripts
291 (substitute* '("tests/commands.at" "tests/variables.at")
292 (("/bin/pwd") (which "pwd")))
293 ;; The .at files create shell scripts without shebangs. Erk.
294 (substitute* "tests/commands.at"
295 (("./output.sh") "/bin/sh output.sh"))
296 (substitute* "tests/syntax.at"
297 (("; other_script.csh") "; /bin/sh other_script.csh"))
298 ;; Now, let's generate the test suite and patch it
299 (system* "make" "tests/testsuite")
301 ;; This file is ISO-8859-1 encoded.
302 (with-fluids ((%default-port-encoding #f))
303 (substitute* "tests/testsuite"
304 (("/bin/sh") (which "sh"))))
306 (add-after 'install 'post-install
307 (lambda* (#:key inputs outputs #:allow-other-keys)
308 (let* ((out (assoc-ref %outputs "out"))
309 (bin (string-append out "/bin")))
310 (with-directory-excursion bin
311 (symlink "tcsh" "csh"))
313 (home-page "http://www.tcsh.org/")
314 (synopsis "Unix shell based on csh")
316 "Tcsh is an enhanced, but completely compatible version of the Berkeley
317 UNIX C shell (csh). It is a command language interpreter usable both as an
318 interactive login shell and a shell script command processor. It includes a
319 command-line editor, programmable word completion, spelling correction, a
320 history mechanism, job control and a C-like syntax.")
329 (uri (list (string-append
330 "http://www.zsh.org/pub/zsh-" version
333 "http://www.zsh.org/pub/old/zsh-" version
337 "0dsr450v8nydvpk8ry276fvbznlrjgddgp7zvhcw4cv69i9lr4ps"))))
338 (build-system gnu-build-system)
339 (arguments `(#:configure-flags '("--with-tcsetpgrp" "--enable-pcre")
341 (modify-phases %standard-phases
342 (add-before 'configure 'fix-sh
344 ;; Some of the files are ISO-8859-1 encoded.
345 (with-fluids ((%default-port-encoding #f))
351 "Config/installfns.sh"
353 "Test/E01options.ztst"
354 "Test/A05execution.ztst"
355 "Test/A01grammar.ztst"
356 "Test/A06assign.ztst"
357 "Test/B02typeset.ztst"
358 "Completion/Unix/Command/_init_d"
360 (("/bin/sh") (which "sh")))))))))
361 (native-inputs `(("autoconf" ,autoconf)))
362 (inputs `(("ncurses" ,ncurses)
365 (synopsis "Powerful shell for interactive use and scripting")
366 (description "The Z shell (zsh) is a Unix shell that can be used
367 as an interactive login shell and as a powerful command interpreter
368 for shell scripting. Zsh can be thought of as an extended Bourne shell
369 with a large number of improvements, including some features of bash,
371 (home-page "http://www.zsh.org/")
373 ;; The whole thing is under an MIT/X11-style license, but there's one
374 ;; command, 'Completion/Unix/Command/_darcs', which is under GPLv2+.
384 (uri (pypi-uri "xonsh" version))
387 "09s5k7fh4p0vkq0fha4ikwqlqsyv84vmlbqn8ggn0ymd47ajv38z"))
388 (modules '((guix build utils)))
391 ;; Delete bundled ply.
392 (delete-file-recursively "xonsh/ply")
393 (substitute* '("setup.py")
394 (("'xonsh\\.ply\\.ply',") ""))
396 (build-system python-build-system)
398 '(;; TODO Try running run the test suite.
399 ;; See 'requirements-tests.txt' in the source distribution for more
403 `(("python-ply" ,python-ply)))
404 (home-page "http://xon.sh/")
405 (synopsis "Python-ish shell")
407 "Xonsh is a Python-ish, BASHwards-looking shell language and command
408 prompt. The language is a superset of Python 3.4+ with additional shell
409 primitives that you are used to from Bash and IPython. It works on all major
410 systems including Linux, Mac OSX, and Windows. Xonsh is meant for the daily
411 use of experts and novices alike.")
415 (let ((commit "114432435e4eadd54334df6b37fcae505079b49f")
419 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
424 (url "https://github.com/scheme/scsh")
426 (file-name (string-append name "-" version "-checkout"))
429 "1ghk08akiz7hff1pndi8rmgamgcrn2mv9asbss9l79d3c2iaav3q"))))
430 (build-system gnu-build-system)
432 `(#:test-target "test"
434 (modify-phases %standard-phases
435 (add-before 'configure 'replace-rx
436 (lambda* (#:key inputs #:allow-other-keys)
437 (let* ((rx (assoc-ref inputs "scheme48-rx"))
438 (rxpath (string-append rx "/share/scheme48-"
439 ,(package-version scheme48)
441 (delete-file-recursively "rx")
442 (symlink rxpath "rx"))
444 (add-before 'configure 'autoreconf
446 (zero? (system* "autoreconf")))))))
448 `(("scheme48" ,scheme48)
449 ("scheme48-rx" ,scheme48-rx)))
451 `(("autoconf" ,autoconf)
452 ("automake" ,automake)))
453 (home-page "https://github.com/scheme/scsh")
454 (synopsis "Unix shell embedded in Scheme")
456 "Scsh is a Unix shell embedded in Scheme. Scsh has two main
457 components: a process notation for running programs and setting up pipelines
458 and redirections, and a complete syscall library for low-level access to the
462 (define-public linenoise
469 (uri (string-append "https://github.com/antirez/linenoise/"
470 "archive/" version ".tar.gz"))
471 (file-name (string-append name "-" version ".tar.gz"))
474 "05006hd56xcvxjdpll4x720bpfan7vwqmxbw8a2kvm10w57ll1gm"))))
475 (build-system gnu-build-system)
477 `(#:tests? #f ;No tests are included
478 #:make-flags (list "CC=gcc")
480 (modify-phases %standard-phases
483 (lambda* (#:key outputs #:allow-other-keys)
484 ;; At the moment there is no 'make install' in upstream.
485 (let* ((out (assoc-ref outputs "out")))
486 (install-file "linenoise.h"
487 (string-append out "/include/linenoise"))
488 (install-file "linenoise.c"
489 (string-append out "/include/linenoise"))
491 (home-page "https://github.com/antirez/linenoise")
492 (synopsis "Minimal zero-config readline replacement")
494 "Linenoise is a minimal, zero-config, readline replacement.
495 Its features include:
498 @item Single and multi line editing mode with the usual key bindings
499 @item History handling
501 @item Hints (suggestions at the right of the prompt as you type)
502 @item A subset of VT100 escapes, ANSI.SYS compatible
507 (let ((commit "6604341edb3a775ff94415762af3ee9bd86bfb3c")
511 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
516 (url "https://github.com/rain-1/s")
518 (file-name (string-append name "-" version "-checkout"))
521 "1075cml6dl15d770j3m12yz90cjacsdslbv3gank1nxd76vmpdcr"))))
522 (build-system gnu-build-system)
524 `(("linenoise" ,linenoise)))
527 #:make-flags (list "CC=gcc")
529 (modify-phases %standard-phases
530 (add-after 'unpack 'install-directory-fix
531 (lambda* (#:key outputs #:allow-other-keys)
532 (let* ((out (assoc-ref outputs "out"))
533 (bin (string-append out "/bin")))
534 (substitute* "Makefile"
537 (add-after 'install 'manpage
538 (lambda* (#:key outputs #:allow-other-keys)
539 (install-file "s.1" (string-append (assoc-ref outputs "out")
540 "/share/man/man1"))))
542 (lambda* (#:key inputs outputs #:allow-other-keys)
543 ;; At this point linenoise is meant to be included,
544 ;; so we have to really copy it into the working directory
546 (let* ((linenoise (assoc-ref inputs "linenoise"))
547 (noisepath (string-append linenoise "/include/linenoise"))
548 (out (assoc-ref outputs "out")))
549 (copy-recursively noisepath "linenoise")
551 (("/bin/s") (string-append out "/bin/s")))
553 (home-page "https://github.com/rain-1/s")
554 (synopsis "Extremely minimal shell with the simplest syntax possible")
556 "S is a new shell that aims to be extremely simple.
557 S does not implemnt the POSIX shell standard.
558 There are no globs or \"splatting\" where a variable $FOO turns into multiple
559 command line arguments. One token stays one token forever.
560 This is a \"no surprises\" straightforward approach.
562 There are no redirection operators > in the shell language, they are added as
563 extra programs. > is just another unix command, < is essentially cat(1).
564 A @code{andglob} program is also provided along with s.")
574 (uri (string-append "https://github.com/dimkr/loksh/archive/"
576 (file-name (string-append name "-" version ".tar.gz"))
579 "1wg7ds56yr8fgg1m149bi53bvrwccwiashmwknggza1sqgj9m2lq"))))
580 (build-system gnu-build-system)
582 `(("libbsd" ,libbsd)))
584 `(("pkg-config" ,pkg-config)))
586 `(#:tests? #f ;No tests included
587 #:make-flags (list "CC=gcc" "HAVE_LIBBSD=1"
588 (string-append "DESTDIR="
589 (assoc-ref %outputs "out"))
592 (modify-phases %standard-phases
593 (delete 'configure)))) ;No configure script
594 (home-page "https://github.com/dimkr/loksh")
595 (synopsis "Korn Shell from OpenBSD")
597 "loksh is a Linux port of OpenBSD's @command{ksh}. It is a small,
598 interactive POSIX shell targeted at resource-constrained systems.")
599 ;; The file 'LEGAL' says it is the public domain, and the 2
600 ;; exceptions which are listed are not included in this port.
601 (license public-domain)))