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, 2017, 2018 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, 2018 Nils Gillmann <ng0@n0.is>
10 ;;; Copyright © 2017, 2018 Leo Famulari <leo@famulari.name>
11 ;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
13 ;;; This file is part of GNU Guix.
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28 (define-module (gnu packages shells)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages algebra)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages bison)
34 #:use-module (gnu packages documentation)
35 #:use-module (gnu packages groff)
36 #:use-module (gnu packages libbsd)
37 #:use-module (gnu packages libedit)
38 #:use-module (gnu packages ncurses)
39 #:use-module (gnu packages pcre)
40 #:use-module (gnu packages perl)
41 #:use-module (gnu packages pkg-config)
42 #:use-module (gnu packages python)
43 #:use-module (gnu packages readline)
44 #:use-module (gnu packages scheme)
45 #:use-module (guix build-system gnu)
46 #:use-module (guix build-system python)
47 #:use-module (guix download)
48 #:use-module (guix git-download)
49 #:use-module (guix licenses)
50 #:use-module (guix packages))
59 (uri (string-append "http://gondor.apana.org.au/~herbert/dash/files/"
60 "dash-" version ".tar.gz"))
63 "0ng695mq5ngg43h7ljhxvbjm46ym3nayj6ssn47d2gm9fbm5pkay"))
64 (modules '((guix build utils)))
67 ;; The man page hails from BSD, where (d)ash is the default shell.
68 ;; This isn't the case on Guix or indeed most other GNU systems.
69 (substitute* "src/dash.1"
70 (("the standard command interpreter for the system")
71 "a command interpreter based on the original Bourne shell"))
73 (build-system gnu-build-system)
75 `(("libedit" ,libedit)))
77 '(#:configure-flags '("--with-libedit")))
78 (home-page "http://gondor.apana.org.au/~herbert/dash")
79 (synopsis "POSIX-compliant shell optimised for size")
81 "dash is a POSIX-compliant @command{/bin/sh} implementation that aims to be
82 as small as possible, often without sacrificing speed. It is faster than the
83 GNU Bourne-Again Shell (@command{bash}) at most scripted tasks. dash is a
84 direct descendant of NetBSD's Almquist Shell (@command{ash}).")
86 gpl2+)))) ; mksignames.c
96 (string-append "https://fishshell.com/files/"
97 version "/fish-" version ".tar.gz")
98 (string-append "https://github.com/fish-shell/fish-shell/"
99 "releases/download/" version "/"
100 name "-" version ".tar.gz")))
103 "0nhc3yc5lnnan7zmxqqxm07rdpwjww5ijy45ll2njdc6fnfb2az4"))
104 (modules '((guix build utils)))
105 ;; Don't try to install /etc/fish/config.fish.
107 '(substitute* "Makefile.in"
108 ((".*INSTALL.*sysconfdir.*fish.*") "")))))
109 (build-system gnu-build-system)
111 `(("doxygen" ,doxygen)))
115 ("groff" ,groff) ;for 'fish --help'
116 ("pcre2" ,pcre2) ;don't use the bundled PCRE2
117 ("python" ,python-wrapper))) ;for fish_config and manpage completions
119 '(#:tests? #f ; no check target
120 #:configure-flags '("--sysconfdir=/etc")
122 (modify-phases %standard-phases
123 ;; Embed absolute paths to store items.
124 (add-after 'unpack 'embed-store-paths
125 (lambda* (#:key inputs outputs #:allow-other-keys)
126 (substitute* '("share/functions/math.fish"
127 "share/functions/seq.fish")
129 (string-append "| " (assoc-ref %build-inputs "bc")
131 (substitute* "share/functions/fish_update_completions.fish"
132 (("python") (which "python")))
133 (substitute* "share/functions/__fish_print_help.fish"
134 (("nroff") (which "nroff")))
136 (synopsis "The friendly interactive shell")
138 "Fish (friendly interactive shell) is a shell focused on interactive use,
139 discoverability, and friendliness. Fish has very user-friendly and powerful
140 tab-completion, including descriptions of every completion, completion of
141 strings with wildcards, and many completions for specific commands. It also
142 has extensive and discoverable help. A special @command{help} command gives
143 access to all the fish documentation in your web browser. Other features
144 include smart terminal handling based on terminfo, an easy to search history,
145 and syntax highlighting.")
146 (home-page "https://fishshell.com/")
156 (url "https://github.com/rakitzis/rc.git")
157 ;; commit name 'release: rc-1.7.4'
158 (commit "c884da53a7c885d46ace2b92de78946855b18e92")))
161 "00mgzvrrh9w96xa85g4gjbsvq02f08k4jwjcdnxq7kyh5xgiw95l"))
162 (file-name (string-append name "-" version "-checkout"))))
163 (build-system gnu-build-system)
168 (modify-phases %standard-phases
171 (lambda _ (zero? (system* "autoreconf" "-vfi"))))
173 'autoreconf 'patch-trip.rc
175 (substitute* "trip.rc"
176 (("/bin/pwd") (which "pwd"))
177 (("/bin/sh") (which "sh"))
178 (("/bin/rm") (which "rm"))
179 (("/bin\\)") (string-append (dirname (which "rm")) ")")))
181 (inputs `(("readline" ,readline)
183 (native-inputs `(("autoconf" ,autoconf)
184 ("automake" ,automake)
186 ("pkg-config" ,pkg-config)))
187 (synopsis "Alternative implementation of the rc shell by Byron Rakitzis")
189 "This is a reimplementation by Byron Rakitzis of the Plan 9 shell. It
190 has a small feature set similar to a traditional Bourne shell.")
191 (home-page "https://github.com/rakitzis/rc")
201 (uri (string-append "https://github.com/wryun/es-shell/releases/"
202 "download/v" version "/es-" version ".tar.gz"))
205 "1fplzxc6lncz2lv2fyr2ig23rgg5j96rm2bbl1rs28mik771zd5h"))
206 (file-name (string-append name "-" version ".tar.gz"))))
207 (build-system gnu-build-system)
209 `(#:test-target "test"
211 (modify-phases %standard-phases
212 (add-before 'configure 're-enter-rootdir
213 ;; The tarball has no folder.
217 `(("readline" ,readline)))
220 (synopsis "Extensible shell with higher-order functions")
222 "Es is an extensible shell. The language was derived from the Plan 9
223 shell, rc, and was influenced by functional programming languages, such as
224 Scheme, and the Tcl embeddable programming language. This implementation is
225 derived from Byron Rakitzis's public domain implementation of rc, and was
226 written by Paul Haahr and Byron Rakitzis.")
227 (home-page "https://wryun.github.io/es-shell/")
228 (license public-domain)))
236 ;; Old tarballs are moved to old/.
237 (uri (list (string-append "ftp://ftp.astron.com/pub/tcsh/"
238 "tcsh-" version ".tar.gz")
239 (string-append "ftp://ftp.astron.com/pub/tcsh/"
240 "old/tcsh-" version ".tar.gz")))
243 "17ggxkkn5skl0v1x0j6hbv5l0sgnidfzwv16992sqkdm983fg7dq"))
244 (patches (search-patches "tcsh-fix-autotest.patch"
245 "tcsh-fix-out-of-bounds-read.patch"))
246 (patch-flags '("-p0"))))
247 (build-system gnu-build-system)
249 `(("autoconf" ,autoconf)
252 `(("ncurses" ,ncurses)))
255 (modify-phases %standard-phases
256 (add-before 'check 'patch-test-scripts
259 (substitute* '("tests/commands.at" "tests/variables.at")
260 (("/bin/pwd") (which "pwd")))
261 ;; The .at files create shell scripts without shebangs. Erk.
262 (substitute* "tests/commands.at"
263 (("./output.sh") "/bin/sh output.sh"))
264 (substitute* "tests/syntax.at"
265 (("; other_script.csh") "; /bin/sh other_script.csh"))
266 ;; Now, let's generate the test suite and patch it
267 (system* "make" "tests/testsuite")
269 ;; This file is ISO-8859-1 encoded.
270 (with-fluids ((%default-port-encoding #f))
271 (substitute* "tests/testsuite"
272 (("/bin/sh") (which "sh"))))
274 (add-after 'install 'post-install
275 (lambda* (#:key inputs outputs #:allow-other-keys)
276 (let* ((out (assoc-ref %outputs "out"))
277 (bin (string-append out "/bin")))
278 (with-directory-excursion bin
279 (symlink "tcsh" "csh"))
281 (home-page "http://www.tcsh.org/")
282 (synopsis "Unix shell based on csh")
284 "Tcsh is an enhanced, but completely compatible version of the Berkeley
285 UNIX C shell (csh). It is a command language interpreter usable both as an
286 interactive login shell and a shell script command processor. It includes a
287 command-line editor, programmable word completion, spelling correction, a
288 history mechanism, job control and a C-like syntax.")
297 (uri (list (string-append
298 "http://www.zsh.org/pub/zsh-" version
301 "http://www.zsh.org/pub/old/zsh-" version
303 (patches (search-patches "zsh-CVE-2018-7548.patch"
304 "zsh-CVE-2018-7549.patch"))
307 "1jdcfinzmki2w963msvsanv29vqqfmdfm4rncwpw0r3zqnrcsywm"))))
308 (build-system gnu-build-system)
309 (arguments `(#:configure-flags '("--with-tcsetpgrp" "--enable-pcre")
311 (modify-phases %standard-phases
312 (add-before 'configure 'fix-sh
314 ;; Some of the files are ISO-8859-1 encoded.
315 (with-fluids ((%default-port-encoding #f))
321 "Config/installfns.sh"
323 "Test/E01options.ztst"
324 "Test/A05execution.ztst"
325 "Test/A01grammar.ztst"
326 "Test/A06assign.ztst"
327 "Test/B02typeset.ztst"
328 "Completion/Unix/Command/_init_d"
330 (("/bin/sh") (which "sh"))))))
331 (add-before 'check 'patch-test
333 ;; In Zsh, `command -p` searches a predefined set of
334 ;; paths that don't exist in the build environment. See
335 ;; the assignment of 'path' in Src/init.c'
336 (substitute* "Test/A01grammar.ztst"
337 (("command -pv") "command -v")
338 (("command -p") "command ")
339 (("'command' -p") "'command' "))
341 (native-inputs `(("autoconf" ,autoconf)))
342 (inputs `(("ncurses" ,ncurses)
345 (synopsis "Powerful shell for interactive use and scripting")
346 (description "The Z shell (zsh) is a Unix shell that can be used
347 as an interactive login shell and as a powerful command interpreter
348 for shell scripting. Zsh can be thought of as an extended Bourne shell
349 with a large number of improvements, including some features of bash,
351 (home-page "http://www.zsh.org/")
353 ;; The whole thing is under an MIT/X11-style license, but there's one
354 ;; command, 'Completion/Unix/Command/_darcs', which is under GPLv2+.
364 (uri (pypi-uri "xonsh" version))
367 "1ikd1xg4iyjqp51y8g8n6c4y39bgx85xnb4bdd3zibkqac3lrahr"))
368 (modules '((guix build utils)))
371 ;; Delete bundled ply.
372 (delete-file-recursively "xonsh/ply")
373 (substitute* '("setup.py")
374 (("'xonsh\\.ply\\.ply',") ""))
376 (build-system python-build-system)
378 '(;; TODO Try running run the test suite.
379 ;; See 'requirements-tests.txt' in the source distribution for more
383 `(("python-ply" ,python-ply)))
384 (home-page "http://xon.sh/")
385 (synopsis "Python-ish shell")
387 "Xonsh is a Python-ish, BASHwards-looking shell language and command
388 prompt. The language is a superset of Python 3.4+ with additional shell
389 primitives that you are used to from Bash and IPython. It works on all major
390 systems including Linux, Mac OSX, and Windows. Xonsh is meant for the daily
391 use of experts and novices alike.")
395 (let ((commit "114432435e4eadd54334df6b37fcae505079b49f")
399 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
404 (url "https://github.com/scheme/scsh")
406 (file-name (string-append name "-" version "-checkout"))
409 "1ghk08akiz7hff1pndi8rmgamgcrn2mv9asbss9l79d3c2iaav3q"))))
410 (build-system gnu-build-system)
412 `(#:test-target "test"
414 (modify-phases %standard-phases
415 (add-before 'configure 'replace-rx
416 (lambda* (#:key inputs #:allow-other-keys)
417 (let* ((rx (assoc-ref inputs "scheme48-rx"))
418 (rxpath (string-append rx "/share/scheme48-"
419 ,(package-version scheme48)
421 (delete-file-recursively "rx")
422 (symlink rxpath "rx"))
424 (add-after 'unpack 'autoreconf
426 (zero? (system* "autoreconf")))))))
428 `(("scheme48" ,scheme48)
429 ("scheme48-rx" ,scheme48-rx)))
431 `(("autoconf" ,autoconf)
432 ("automake" ,automake)))
433 (home-page "https://github.com/scheme/scsh")
434 (synopsis "Unix shell embedded in Scheme")
436 "Scsh is a Unix shell embedded in Scheme. Scsh has two main
437 components: a process notation for running programs and setting up pipelines
438 and redirections, and a complete syscall library for low-level access to the
442 (define-public linenoise
443 (let ((commit "2105ce445821381cf1bca87b6d386d4ea88ee20d")
447 (version (string-append "1.0-" revision "." (string-take commit 7)))
452 (url "https://github.com/antirez/linenoise")
454 (file-name (string-append name "-" version "-checkout"))
457 "1z16qwix8z6a40fskdgxsibkqgdrp4q6ncp4n6hnv4r9iihy2d8r"))))
458 (build-system gnu-build-system)
460 `(#:tests? #f ;No tests are included
461 #:make-flags (list "CC=gcc")
463 (modify-phases %standard-phases
466 (lambda* (#:key outputs #:allow-other-keys)
467 ;; At the moment there is no 'make install' in upstream.
468 (let* ((out (assoc-ref outputs "out")))
469 (install-file "linenoise.h"
470 (string-append out "/include/linenoise"))
471 (install-file "linenoise.c"
472 (string-append out "/include/linenoise"))
474 (home-page "https://github.com/antirez/linenoise")
475 (synopsis "Minimal zero-config readline replacement")
477 "Linenoise is a minimal, zero-config, readline replacement.
478 Its features include:
481 @item Single and multi line editing mode with the usual key bindings
482 @item History handling
484 @item Hints (suggestions at the right of the prompt as you type)
485 @item A subset of VT100 escapes, ANSI.SYS compatible
489 (define-public s-shell
490 (let ((commit "da2e5c20c0c5f477ec3426dc2584889a789b1659")
494 (version (git-version "0.0.0" revision commit))
499 (url "https://github.com/rain-1/s")
501 (file-name (string-append name "-" version "-checkout"))
504 "0qiny71ww5nhzy4mnc8652hn0mlxyb67h333gbdxp4j4qxsi13q4"))))
505 (build-system gnu-build-system)
507 `(("linenoise" ,linenoise)))
510 #:make-flags (list "CC=gcc"
511 (string-append "PREFIX="
512 (assoc-ref %outputs "out")))
514 (modify-phases %standard-phases
515 (add-after 'unpack 'install-directory-fix
516 (lambda* (#:key outputs #:allow-other-keys)
517 (let* ((out (assoc-ref outputs "out"))
518 (bin (string-append out "/bin")))
519 (substitute* "Makefile"
522 (add-after 'install 'manpage
523 (lambda* (#:key outputs #:allow-other-keys)
524 (install-file "s.1" (string-append (assoc-ref outputs "out")
525 "/share/man/man1"))))
527 (lambda* (#:key inputs outputs #:allow-other-keys)
528 ;; At this point linenoise is meant to be included,
529 ;; so we have to really copy it into the working directory
531 (let* ((linenoise (assoc-ref inputs "linenoise"))
532 (noisepath (string-append linenoise "/include/linenoise"))
533 (out (assoc-ref outputs "out")))
534 (copy-recursively noisepath "linenoise")
536 (("/bin/s") (string-append out "/bin/s")))
538 (home-page "https://github.com/rain-1/s")
539 (synopsis "Extremely minimal shell with the simplest syntax possible")
541 "S is a new shell that aims to be extremely simple.
542 S does not implemnt the POSIX shell standard.
543 There are no globs or \"splatting\" where a variable $FOO turns into multiple
544 command line arguments. One token stays one token forever.
545 This is a \"no surprises\" straightforward approach.
547 There are no redirection operators > in the shell language, they are added as
548 extra programs. > is just another unix command, < is essentially cat(1).
549 A @code{andglob} program is also provided along with s.")
559 (uri (string-append "https://connochaetos.org/oksh/oksh-"
563 "0ln9yf6pxngsviqszv8klnnvn8vcpplvj1njdn8xr2y8frkbw8r3"))))
564 (build-system gnu-build-system)
566 `(; The test files are not part of the distributed tarball.
568 (home-page "https://connochaetos.org/oksh")
569 (synopsis "Port of OpenBSD Korn Shell")
571 "Oksh is a port of the OpenBSD Korn Shell.
572 The OpenBSD Korn Shell is a cleaned up and enhanced ksh.")
582 (uri (string-append "https://github.com/dimkr/loksh/archive/"
584 (file-name (string-append name "-" version ".tar.gz"))
587 "16mgxby77wgjg1ybp4fb9cvi7a4a387xmfivdxnhphg0vhyr8qd3"))))
588 (build-system gnu-build-system)
590 `(("libbsd" ,libbsd)))
592 `(("pkg-config" ,pkg-config)))
594 `(#:tests? #f ;No tests included
595 #:make-flags (list "CC=gcc" "HAVE_LIBBSD=1"
596 (string-append "DESTDIR="
597 (assoc-ref %outputs "out"))
600 (modify-phases %standard-phases
601 (delete 'configure)))) ;No configure script
602 (home-page "https://github.com/dimkr/loksh")
603 (synopsis "Korn Shell from OpenBSD")
605 "loksh is a Linux port of OpenBSD's @command{ksh}. It is a small,
606 interactive POSIX shell targeted at resource-constrained systems.")
607 ;; The file 'LEGAL' says it is the public domain, and the 2
608 ;; exceptions which are listed are not included in this port.
609 (license public-domain)))
618 (uri (string-append "https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R"
622 "1x4zjj9259ijpf8jw0nyh1fnr1pbm5fwvylclpvcrlb45xrglf5d"))))
623 (build-system gnu-build-system)
625 `(#:tests? #f ; tests require access to /dev/tty
627 (modify-phases %standard-phases
632 (zero? (system* (which "sh") "Build.sh"))))
634 (lambda* (#:key outputs #:allow-other-keys)
635 (let* ((out (assoc-ref outputs "out"))
636 (bin (string-append out "/bin"))
637 (man (string-append out "/share/man/man1")))
638 (install-file "mksh" bin)
639 (with-directory-excursion bin
640 (symlink "mksh" "ksh"))
641 (install-file "mksh.1" man)))))))
642 (home-page "https://www.mirbsd.org/mksh.htm")
643 (synopsis "Korn Shell from MirBSD")
644 (description "mksh is an actively developed free implementation of the
645 Korn Shell programming language and a successor to the Public Domain Korn
650 (define-public oil-shell
656 (uri (string-append "https://www.oilshell.org/download/oil-"
660 "0ca68n46mhibarpfinqfkim6p3xmbz5rrpl4qr3sj9y0q6wm7sa2"))))
661 (build-system gnu-build-system)
663 '(#:tests? #f ; the tests are not distributed in the tarballs
664 #:strip-binaries? #f ; the binaries cannot be stripped
666 (modify-phases %standard-phases
667 (add-after 'unpack 'patch-compiler-invocation
669 (substitute* "configure"
673 (lambda* (#:key outputs #:allow-other-keys)
674 (let ((out (assoc-ref outputs "out")))
676 ;; The configure script doesn't recognize CONFIG_SHELL.
677 (setenv "CONFIG_SHELL" (which "sh"))
678 (invoke "./configure" (string-append "--prefix=" out)
679 "--with-readline"))))
680 (add-before 'install 'make-destination
682 ;; The build scripts don't create the destination directory.
683 (mkdir-p (string-append (assoc-ref %outputs "out") "/bin")))))))
685 `(("readline" ,readline)))
686 (synopsis "Bash-compatible Unix shell")
687 (description "Oil is a Unix / POSIX shell, compatible with Bash. It
688 implements the Oil language, which is a new shell language to which Bash can be
689 automatically translated. The Oil language is a superset of Bash. It also
690 implements the OSH language, a statically-parseable language based on Bash as it
691 is commonly written.")
692 (home-page "https://www.oilshell.org/")
693 (license (list psfl ; The Oil sources include a patched Python 2 source tree