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.*") ""))
110 (build-system gnu-build-system)
112 `(("doxygen" ,doxygen)))
116 ("groff" ,groff) ;for 'fish --help'
117 ("pcre2" ,pcre2) ;don't use the bundled PCRE2
118 ("python" ,python-wrapper))) ;for fish_config and manpage completions
120 '(#:tests? #f ; no check target
121 #:configure-flags '("--sysconfdir=/etc")
123 (modify-phases %standard-phases
124 ;; Embed absolute paths to store items.
125 (add-after 'unpack 'embed-store-paths
126 (lambda* (#:key inputs outputs #:allow-other-keys)
127 (substitute* '("share/functions/math.fish"
128 "share/functions/seq.fish")
130 (string-append "| " (assoc-ref %build-inputs "bc")
132 (substitute* "share/functions/fish_update_completions.fish"
133 (("python") (which "python")))
134 (substitute* "share/functions/__fish_print_help.fish"
135 (("nroff") (which "nroff")))
137 (synopsis "The friendly interactive shell")
139 "Fish (friendly interactive shell) is a shell focused on interactive use,
140 discoverability, and friendliness. Fish has very user-friendly and powerful
141 tab-completion, including descriptions of every completion, completion of
142 strings with wildcards, and many completions for specific commands. It also
143 has extensive and discoverable help. A special @command{help} command gives
144 access to all the fish documentation in your web browser. Other features
145 include smart terminal handling based on terminfo, an easy to search history,
146 and syntax highlighting.")
147 (home-page "https://fishshell.com/")
157 (url "https://github.com/rakitzis/rc.git")
158 ;; commit name 'release: rc-1.7.4'
159 (commit "c884da53a7c885d46ace2b92de78946855b18e92")))
162 "00mgzvrrh9w96xa85g4gjbsvq02f08k4jwjcdnxq7kyh5xgiw95l"))
163 (file-name (string-append name "-" version "-checkout"))))
164 (build-system gnu-build-system)
169 (modify-phases %standard-phases
172 (lambda _ (zero? (system* "autoreconf" "-vfi"))))
174 'autoreconf 'patch-trip.rc
176 (substitute* "trip.rc"
177 (("/bin/pwd") (which "pwd"))
178 (("/bin/sh") (which "sh"))
179 (("/bin/rm") (which "rm"))
180 (("/bin\\)") (string-append (dirname (which "rm")) ")")))
182 (inputs `(("readline" ,readline)
184 (native-inputs `(("autoconf" ,autoconf)
185 ("automake" ,automake)
187 ("pkg-config" ,pkg-config)))
188 (synopsis "Alternative implementation of the rc shell by Byron Rakitzis")
190 "This is a reimplementation by Byron Rakitzis of the Plan 9 shell. It
191 has a small feature set similar to a traditional Bourne shell.")
192 (home-page "https://github.com/rakitzis/rc")
202 (uri (string-append "https://github.com/wryun/es-shell/releases/"
203 "download/v" version "/es-" version ".tar.gz"))
206 "1fplzxc6lncz2lv2fyr2ig23rgg5j96rm2bbl1rs28mik771zd5h"))
207 (file-name (string-append name "-" version ".tar.gz"))))
208 (build-system gnu-build-system)
210 `(#:test-target "test"
212 (modify-phases %standard-phases
213 (add-before 'configure 're-enter-rootdir
214 ;; The tarball has no folder.
218 `(("readline" ,readline)))
221 (synopsis "Extensible shell with higher-order functions")
223 "Es is an extensible shell. The language was derived from the Plan 9
224 shell, rc, and was influenced by functional programming languages, such as
225 Scheme, and the Tcl embeddable programming language. This implementation is
226 derived from Byron Rakitzis's public domain implementation of rc, and was
227 written by Paul Haahr and Byron Rakitzis.")
228 (home-page "https://wryun.github.io/es-shell/")
229 (license public-domain)))
237 ;; Old tarballs are moved to old/.
238 (uri (list (string-append "ftp://ftp.astron.com/pub/tcsh/"
239 "tcsh-" version ".tar.gz")
240 (string-append "ftp://ftp.astron.com/pub/tcsh/"
241 "old/tcsh-" version ".tar.gz")))
244 "17ggxkkn5skl0v1x0j6hbv5l0sgnidfzwv16992sqkdm983fg7dq"))
245 (patches (search-patches "tcsh-fix-autotest.patch"
246 "tcsh-fix-out-of-bounds-read.patch"))
247 (patch-flags '("-p0"))))
248 (build-system gnu-build-system)
250 `(("autoconf" ,autoconf)
253 `(("ncurses" ,ncurses)))
256 (modify-phases %standard-phases
257 (add-before 'check 'patch-test-scripts
260 (substitute* '("tests/commands.at" "tests/variables.at")
261 (("/bin/pwd") (which "pwd")))
262 ;; The .at files create shell scripts without shebangs. Erk.
263 (substitute* "tests/commands.at"
264 (("./output.sh") "/bin/sh output.sh"))
265 (substitute* "tests/syntax.at"
266 (("; other_script.csh") "; /bin/sh other_script.csh"))
267 ;; Now, let's generate the test suite and patch it
268 (invoke "make" "tests/testsuite")
270 ;; This file is ISO-8859-1 encoded.
271 (with-fluids ((%default-port-encoding #f))
272 (substitute* "tests/testsuite"
273 (("/bin/sh") (which "sh"))))
275 (add-after 'install 'post-install
276 (lambda* (#:key inputs outputs #:allow-other-keys)
277 (let* ((out (assoc-ref %outputs "out"))
278 (bin (string-append out "/bin")))
279 (with-directory-excursion bin
280 (symlink "tcsh" "csh"))
282 (home-page "http://www.tcsh.org/")
283 (synopsis "Unix shell based on csh")
285 "Tcsh is an enhanced, but completely compatible version of the Berkeley
286 UNIX C shell (csh). It is a command language interpreter usable both as an
287 interactive login shell and a shell script command processor. It includes a
288 command-line editor, programmable word completion, spelling correction, a
289 history mechanism, job control and a C-like syntax.")
298 (uri (list (string-append
299 "http://www.zsh.org/pub/zsh-" version
302 "http://www.zsh.org/pub/old/zsh-" version
306 "105aqkdfsdxc4531anrj2zis2ywz6icagjam9lsc235yzh48ihz1"))))
307 (build-system gnu-build-system)
308 (arguments `(#:configure-flags '("--with-tcsetpgrp" "--enable-pcre")
310 (modify-phases %standard-phases
311 (add-before 'configure 'fix-sh
313 ;; Some of the files are ISO-8859-1 encoded.
314 (with-fluids ((%default-port-encoding #f))
320 "Config/installfns.sh"
322 "Test/E01options.ztst"
323 "Test/A05execution.ztst"
324 "Test/A01grammar.ztst"
325 "Test/A06assign.ztst"
326 "Test/B02typeset.ztst"
327 "Completion/Unix/Command/_init_d"
329 (("/bin/sh") (which "sh"))))))
330 (add-before 'check 'patch-test
332 ;; In Zsh, `command -p` searches a predefined set of
333 ;; paths that don't exist in the build environment. See
334 ;; the assignment of 'path' in Src/init.c'
335 (substitute* "Test/A01grammar.ztst"
336 (("command -pv") "command -v")
337 (("command -p") "command ")
338 (("'command' -p") "'command' "))
340 (native-inputs `(("autoconf" ,autoconf)))
341 (inputs `(("ncurses" ,ncurses)
344 (synopsis "Powerful shell for interactive use and scripting")
345 (description "The Z shell (zsh) is a Unix shell that can be used
346 as an interactive login shell and as a powerful command interpreter
347 for shell scripting. Zsh can be thought of as an extended Bourne shell
348 with a large number of improvements, including some features of bash,
350 (home-page "http://www.zsh.org/")
352 ;; The whole thing is under an MIT/X11-style license, but there's one
353 ;; command, 'Completion/Unix/Command/_darcs', which is under GPLv2+.
363 (uri (pypi-uri "xonsh" version))
366 "09rrfcwpirbxmjjqnsbyn7lwm1wyn41z5zhkbnv57i5hcgs72kx6"))
367 (modules '((guix build utils)))
370 ;; Delete bundled ply.
371 (delete-file-recursively "xonsh/ply")
372 (substitute* '("setup.py")
373 (("'xonsh\\.ply\\.ply',") ""))
375 (build-system python-build-system)
377 '(;; TODO Try running run the test suite.
378 ;; See 'requirements-tests.txt' in the source distribution for more
382 `(("python-ply" ,python-ply)))
383 (home-page "http://xon.sh/")
384 (synopsis "Python-ish shell")
386 "Xonsh is a Python-ish, BASHwards-looking shell language and command
387 prompt. The language is a superset of Python 3.4+ with additional shell
388 primitives that you are used to from Bash and IPython. It works on all major
389 systems including Linux, Mac OSX, and Windows. Xonsh is meant for the daily
390 use of experts and novices alike.")
394 (let ((commit "114432435e4eadd54334df6b37fcae505079b49f")
398 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
403 (url "https://github.com/scheme/scsh")
405 (file-name (string-append name "-" version "-checkout"))
408 "1ghk08akiz7hff1pndi8rmgamgcrn2mv9asbss9l79d3c2iaav3q"))))
409 (build-system gnu-build-system)
411 `(#:test-target "test"
413 (modify-phases %standard-phases
414 (add-before 'configure 'replace-rx
415 (lambda* (#:key inputs #:allow-other-keys)
416 (let* ((rx (assoc-ref inputs "scheme48-rx"))
417 (rxpath (string-append rx "/share/scheme48-"
418 ,(package-version scheme48)
420 (delete-file-recursively "rx")
421 (symlink rxpath "rx"))
423 (add-after 'unpack 'autoreconf
425 (zero? (system* "autoreconf")))))))
427 `(("scheme48" ,scheme48)
428 ("scheme48-rx" ,scheme48-rx)))
430 `(("autoconf" ,autoconf)
431 ("automake" ,automake)))
432 (home-page "https://github.com/scheme/scsh")
433 (synopsis "Unix shell embedded in Scheme")
435 "Scsh is a Unix shell embedded in Scheme. Scsh has two main
436 components: a process notation for running programs and setting up pipelines
437 and redirections, and a complete syscall library for low-level access to the
441 (define-public linenoise
442 (let ((commit "2105ce445821381cf1bca87b6d386d4ea88ee20d")
446 (version (string-append "1.0-" revision "." (string-take commit 7)))
451 (url "https://github.com/antirez/linenoise")
453 (file-name (string-append name "-" version "-checkout"))
456 "1z16qwix8z6a40fskdgxsibkqgdrp4q6ncp4n6hnv4r9iihy2d8r"))))
457 (build-system gnu-build-system)
459 `(#:tests? #f ;No tests are included
460 #:make-flags (list "CC=gcc")
462 (modify-phases %standard-phases
465 (lambda* (#:key outputs #:allow-other-keys)
466 ;; At the moment there is no 'make install' in upstream.
467 (let* ((out (assoc-ref outputs "out")))
468 (install-file "linenoise.h"
469 (string-append out "/include/linenoise"))
470 (install-file "linenoise.c"
471 (string-append out "/include/linenoise"))
473 (home-page "https://github.com/antirez/linenoise")
474 (synopsis "Minimal zero-config readline replacement")
476 "Linenoise is a minimal, zero-config, readline replacement.
477 Its features include:
480 @item Single and multi line editing mode with the usual key bindings
481 @item History handling
483 @item Hints (suggestions at the right of the prompt as you type)
484 @item A subset of VT100 escapes, ANSI.SYS compatible
488 (define-public s-shell
489 (let ((commit "da2e5c20c0c5f477ec3426dc2584889a789b1659")
493 (version (git-version "0.0.0" revision commit))
498 (url "https://github.com/rain-1/s")
500 (file-name (string-append name "-" version "-checkout"))
503 "0qiny71ww5nhzy4mnc8652hn0mlxyb67h333gbdxp4j4qxsi13q4"))))
504 (build-system gnu-build-system)
506 `(("linenoise" ,linenoise)))
509 #:make-flags (list "CC=gcc"
510 (string-append "PREFIX="
511 (assoc-ref %outputs "out")))
513 (modify-phases %standard-phases
514 (add-after 'unpack 'install-directory-fix
515 (lambda* (#:key outputs #:allow-other-keys)
516 (let* ((out (assoc-ref outputs "out"))
517 (bin (string-append out "/bin")))
518 (substitute* "Makefile"
521 (add-after 'install 'manpage
522 (lambda* (#:key outputs #:allow-other-keys)
523 (install-file "s.1" (string-append (assoc-ref outputs "out")
524 "/share/man/man1"))))
526 (lambda* (#:key inputs outputs #:allow-other-keys)
527 ;; At this point linenoise is meant to be included,
528 ;; so we have to really copy it into the working directory
530 (let* ((linenoise (assoc-ref inputs "linenoise"))
531 (noisepath (string-append linenoise "/include/linenoise"))
532 (out (assoc-ref outputs "out")))
533 (copy-recursively noisepath "linenoise")
535 (("/bin/s") (string-append out "/bin/s")))
537 (home-page "https://github.com/rain-1/s")
538 (synopsis "Extremely minimal shell with the simplest syntax possible")
540 "S is a new shell that aims to be extremely simple.
541 S does not implemnt the POSIX shell standard.
542 There are no globs or \"splatting\" where a variable $FOO turns into multiple
543 command line arguments. One token stays one token forever.
544 This is a \"no surprises\" straightforward approach.
546 There are no redirection operators > in the shell language, they are added as
547 extra programs. > is just another unix command, < is essentially cat(1).
548 A @code{andglob} program is also provided along with s.")
558 (uri (string-append "https://connochaetos.org/oksh/oksh-"
562 "0ln9yf6pxngsviqszv8klnnvn8vcpplvj1njdn8xr2y8frkbw8r3"))))
563 (build-system gnu-build-system)
565 `(; The test files are not part of the distributed tarball.
567 (home-page "https://connochaetos.org/oksh")
568 (synopsis "Port of OpenBSD Korn Shell")
570 "Oksh is a port of the OpenBSD Korn Shell.
571 The OpenBSD Korn Shell is a cleaned up and enhanced ksh.")
581 (uri (string-append "https://github.com/dimkr/loksh/archive/"
583 (file-name (string-append name "-" version ".tar.gz"))
586 "0i1b60g1p19s5cnzz0nmjzjnxywm9szzyp1rcwfcx3gmzvrwr2sc"))))
587 (build-system gnu-build-system)
589 `(("libbsd" ,libbsd)))
591 `(("pkg-config" ,pkg-config)))
593 `(#:tests? #f ;No tests included
594 #:make-flags (list "CC=gcc" "HAVE_LIBBSD=1"
595 (string-append "DESTDIR="
596 (assoc-ref %outputs "out"))
599 (modify-phases %standard-phases
600 (delete 'configure)))) ;No configure script
601 (home-page "https://github.com/dimkr/loksh")
602 (synopsis "Korn Shell from OpenBSD")
604 "loksh is a Linux port of OpenBSD's @command{ksh}. It is a small,
605 interactive POSIX shell targeted at resource-constrained systems.")
606 ;; The file 'LEGAL' says it is the public domain, and the 2
607 ;; exceptions which are listed are not included in this port.
608 (license public-domain)))
617 (uri (string-append "https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R"
621 "1x4zjj9259ijpf8jw0nyh1fnr1pbm5fwvylclpvcrlb45xrglf5d"))))
622 (build-system gnu-build-system)
624 `(#:tests? #f ; tests require access to /dev/tty
626 (modify-phases %standard-phases
631 (zero? (system* (which "sh") "Build.sh"))))
633 (lambda* (#:key outputs #:allow-other-keys)
634 (let* ((out (assoc-ref outputs "out"))
635 (bin (string-append out "/bin"))
636 (man (string-append out "/share/man/man1")))
637 (install-file "mksh" bin)
638 (with-directory-excursion bin
639 (symlink "mksh" "ksh"))
640 (install-file "mksh.1" man)))))))
641 (home-page "https://www.mirbsd.org/mksh.htm")
642 (synopsis "Korn Shell from MirBSD")
643 (description "mksh is an actively developed free implementation of the
644 Korn Shell programming language and a successor to the Public Domain Korn
649 (define-public oil-shell
655 (uri (string-append "https://www.oilshell.org/download/oil-"
659 "0ca68n46mhibarpfinqfkim6p3xmbz5rrpl4qr3sj9y0q6wm7sa2"))))
660 (build-system gnu-build-system)
662 '(#:tests? #f ; the tests are not distributed in the tarballs
663 #:strip-binaries? #f ; the binaries cannot be stripped
665 (modify-phases %standard-phases
666 (add-after 'unpack 'patch-compiler-invocation
668 (substitute* "configure"
672 (lambda* (#:key outputs #:allow-other-keys)
673 (let ((out (assoc-ref outputs "out")))
675 ;; The configure script doesn't recognize CONFIG_SHELL.
676 (setenv "CONFIG_SHELL" (which "sh"))
677 (invoke "./configure" (string-append "--prefix=" out)
678 "--with-readline"))))
679 (add-before 'install 'make-destination
681 ;; The build scripts don't create the destination directory.
682 (mkdir-p (string-append (assoc-ref %outputs "out") "/bin")))))))
684 `(("readline" ,readline)))
685 (synopsis "Bash-compatible Unix shell")
686 (description "Oil is a Unix / POSIX shell, compatible with Bash. It
687 implements the Oil language, which is a new shell language to which Bash can be
688 automatically translated. The Oil language is a superset of Bash. It also
689 implements the OSH language, a statically-parseable language based on Bash as it
690 is commonly written.")
691 (home-page "https://www.oilshell.org/")
692 (license (list psfl ; The Oil sources include a patched Python 2 source tree