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, 2018 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 "0wb0bwmqc661hylqcfdp7l7x12myw3vpqk513ncyqrjwvhckjriw"))
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 (string-append "v" version))))
161 "0vj1h4pcg13vxsiydmmk87dr2sra9h4gwx0c4q6fjsiw4in78rrd"))
162 (file-name (git-file-name name version))))
163 (build-system gnu-build-system)
168 (modify-phases %standard-phases
169 (add-before 'bootstrap 'patch-trip.rc
171 (substitute* "trip.rc"
172 (("/bin/pwd") (which "pwd"))
173 (("/bin/sh") (which "sh"))
174 (("/bin/rm") (which "rm"))
175 (("/bin\\)") (string-append (dirname (which "rm")) ")")))
177 (inputs `(("readline" ,readline)
179 (native-inputs `(("autoconf" ,autoconf)
180 ("automake" ,automake)
182 ("pkg-config" ,pkg-config)))
183 (synopsis "Alternative implementation of the rc shell by Byron Rakitzis")
185 "This is a reimplementation by Byron Rakitzis of the Plan 9 shell. It
186 has a small feature set similar to a traditional Bourne shell.")
187 (home-page "https://github.com/rakitzis/rc")
197 (uri (string-append "https://github.com/wryun/es-shell/releases/"
198 "download/v" version "/es-" version ".tar.gz"))
201 "1fplzxc6lncz2lv2fyr2ig23rgg5j96rm2bbl1rs28mik771zd5h"))
202 (file-name (string-append name "-" version ".tar.gz"))))
203 (build-system gnu-build-system)
205 `(#:test-target "test"
207 (modify-phases %standard-phases
208 (add-before 'configure 're-enter-rootdir
209 ;; The tarball has no folder.
213 `(("readline" ,readline)))
216 (synopsis "Extensible shell with higher-order functions")
218 "Es is an extensible shell. The language was derived from the Plan 9
219 shell, rc, and was influenced by functional programming languages, such as
220 Scheme, and the Tcl embeddable programming language. This implementation is
221 derived from Byron Rakitzis's public domain implementation of rc, and was
222 written by Paul Haahr and Byron Rakitzis.")
223 (home-page "https://wryun.github.io/es-shell/")
224 (license public-domain)))
232 ;; Old tarballs are moved to old/.
233 (uri (list (string-append "ftp://ftp.astron.com/pub/tcsh/"
234 "tcsh-" version ".tar.gz")
235 (string-append "ftp://ftp.astron.com/pub/tcsh/"
236 "old/tcsh-" version ".tar.gz")))
239 "17ggxkkn5skl0v1x0j6hbv5l0sgnidfzwv16992sqkdm983fg7dq"))
240 (patches (search-patches "tcsh-fix-autotest.patch"
241 "tcsh-fix-out-of-bounds-read.patch"))
242 (patch-flags '("-p0"))))
243 (build-system gnu-build-system)
245 `(("autoconf" ,autoconf)
248 `(("ncurses" ,ncurses)))
251 (modify-phases %standard-phases
252 (add-before 'check 'patch-test-scripts
255 (substitute* '("tests/commands.at" "tests/variables.at")
256 (("/bin/pwd") (which "pwd")))
257 ;; The .at files create shell scripts without shebangs. Erk.
258 (substitute* "tests/commands.at"
259 (("./output.sh") "/bin/sh output.sh"))
260 (substitute* "tests/syntax.at"
261 (("; other_script.csh") "; /bin/sh other_script.csh"))
262 ;; Now, let's generate the test suite and patch it
263 (invoke "make" "tests/testsuite")
265 ;; This file is ISO-8859-1 encoded.
266 (with-fluids ((%default-port-encoding #f))
267 (substitute* "tests/testsuite"
268 (("/bin/sh") (which "sh"))))
270 (add-after 'install 'post-install
271 (lambda* (#:key inputs outputs #:allow-other-keys)
272 (let* ((out (assoc-ref %outputs "out"))
273 (bin (string-append out "/bin")))
274 (with-directory-excursion bin
275 (symlink "tcsh" "csh"))
277 (home-page "http://www.tcsh.org/")
278 (synopsis "Unix shell based on csh")
280 "Tcsh is an enhanced, but completely compatible version of the Berkeley
281 UNIX C shell (csh). It is a command language interpreter usable both as an
282 interactive login shell and a shell script command processor. It includes a
283 command-line editor, programmable word completion, spelling correction, a
284 history mechanism, job control and a C-like syntax.")
293 (uri (list (string-append
294 "https://www.zsh.org/pub/zsh-" version
297 "https://www.zsh.org/pub/old/zsh-" version
301 "17iffliqcj4hv91g0bd2sxsyfcz51mfyh97sp2iyrs2p0mndc2x5"))))
302 (build-system gnu-build-system)
303 (arguments `(#:configure-flags '("--with-tcsetpgrp" "--enable-pcre")
305 (modify-phases %standard-phases
306 (add-before 'configure 'fix-sh
308 ;; Some of the files are ISO-8859-1 encoded.
309 (with-fluids ((%default-port-encoding #f))
315 "Config/installfns.sh"
317 "Test/E01options.ztst"
318 "Test/A05execution.ztst"
319 "Test/A01grammar.ztst"
320 "Test/A06assign.ztst"
321 "Test/B02typeset.ztst"
322 "Completion/Unix/Command/_init_d"
324 (("/bin/sh") (which "sh"))))))
325 (add-before 'check 'patch-test
327 ;; In Zsh, `command -p` searches a predefined set of
328 ;; paths that don't exist in the build environment. See
329 ;; the assignment of 'path' in Src/init.c'
330 (substitute* "Test/A01grammar.ztst"
331 (("command -pv") "command -v")
332 (("command -p") "command ")
333 (("'command' -p") "'command' "))
335 (native-inputs `(("autoconf" ,autoconf)))
336 (inputs `(("ncurses" ,ncurses)
339 (synopsis "Powerful shell for interactive use and scripting")
340 (description "The Z shell (zsh) is a Unix shell that can be used
341 as an interactive login shell and as a powerful command interpreter
342 for shell scripting. Zsh can be thought of as an extended Bourne shell
343 with a large number of improvements, including some features of bash,
345 (home-page "https://www.zsh.org/")
347 ;; The whole thing is under an MIT/X11-style license, but there's one
348 ;; command, 'Completion/Unix/Command/_darcs', which is under GPLv2+.
358 (uri (pypi-uri "xonsh" version))
361 "0c2bbmdg0n10q54vq9k1z5n53l0mh1hb1q5xprfhilvrbr6hlcwr"))
362 (modules '((guix build utils)))
365 ;; Delete bundled ply.
366 (delete-file-recursively "xonsh/ply")
367 (substitute* '("setup.py")
368 (("'xonsh\\.ply\\.ply',") ""))
370 (build-system python-build-system)
372 '(;; TODO Try running run the test suite.
373 ;; See 'requirements-tests.txt' in the source distribution for more
377 `(("python-ply" ,python-ply)))
378 (home-page "http://xon.sh/")
379 (synopsis "Python-ish shell")
381 "Xonsh is a Python-ish, BASHwards-looking shell language and command
382 prompt. The language is a superset of Python 3.4+ with additional shell
383 primitives that you are used to from Bash and IPython. It works on all major
384 systems including Linux, Mac OSX, and Windows. Xonsh is meant for the daily
385 use of experts and novices alike.")
389 (let ((commit "114432435e4eadd54334df6b37fcae505079b49f")
393 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
398 (url "https://github.com/scheme/scsh")
400 (file-name (string-append name "-" version "-checkout"))
403 "1ghk08akiz7hff1pndi8rmgamgcrn2mv9asbss9l79d3c2iaav3q"))))
404 (build-system gnu-build-system)
406 `(#:test-target "test"
408 (modify-phases %standard-phases
409 (add-before 'configure 'replace-rx
410 (lambda* (#:key inputs #:allow-other-keys)
411 (let* ((rx (assoc-ref inputs "scheme48-rx"))
412 (rxpath (string-append rx "/share/scheme48-"
413 ,(package-version scheme48)
415 (delete-file-recursively "rx")
416 (symlink rxpath "rx"))
419 `(("scheme48" ,scheme48)
420 ("scheme48-rx" ,scheme48-rx)))
422 `(("autoconf" ,autoconf)
423 ("automake" ,automake)))
424 (home-page "https://github.com/scheme/scsh")
425 (synopsis "Unix shell embedded in Scheme")
427 "Scsh is a Unix shell embedded in Scheme. Scsh has two main
428 components: a process notation for running programs and setting up pipelines
429 and redirections, and a complete syscall library for low-level access to the
433 (define-public linenoise
434 (let ((commit "2105ce445821381cf1bca87b6d386d4ea88ee20d")
438 (version (string-append "1.0-" revision "." (string-take commit 7)))
443 (url "https://github.com/antirez/linenoise")
445 (file-name (string-append name "-" version "-checkout"))
448 "1z16qwix8z6a40fskdgxsibkqgdrp4q6ncp4n6hnv4r9iihy2d8r"))))
449 (build-system gnu-build-system)
451 `(#:tests? #f ;No tests are included
452 #:make-flags (list "CC=gcc")
454 (modify-phases %standard-phases
457 (lambda* (#:key outputs #:allow-other-keys)
458 ;; At the moment there is no 'make install' in upstream.
459 (let* ((out (assoc-ref outputs "out")))
460 (install-file "linenoise.h"
461 (string-append out "/include/linenoise"))
462 (install-file "linenoise.c"
463 (string-append out "/include/linenoise"))
465 (home-page "https://github.com/antirez/linenoise")
466 (synopsis "Minimal zero-config readline replacement")
468 "Linenoise is a minimal, zero-config, readline replacement.
469 Its features include:
472 @item Single and multi line editing mode with the usual key bindings
473 @item History handling
475 @item Hints (suggestions at the right of the prompt as you type)
476 @item A subset of VT100 escapes, ANSI.SYS compatible
480 (define-public s-shell
481 (let ((commit "da2e5c20c0c5f477ec3426dc2584889a789b1659")
485 (version (git-version "0.0.0" revision commit))
490 (url "https://github.com/rain-1/s")
492 (file-name (string-append name "-" version "-checkout"))
495 "0qiny71ww5nhzy4mnc8652hn0mlxyb67h333gbdxp4j4qxsi13q4"))))
496 (build-system gnu-build-system)
498 `(("linenoise" ,linenoise)))
501 #:make-flags (list "CC=gcc"
502 (string-append "PREFIX="
503 (assoc-ref %outputs "out")))
505 (modify-phases %standard-phases
506 (add-after 'unpack 'install-directory-fix
507 (lambda* (#:key outputs #:allow-other-keys)
508 (let* ((out (assoc-ref outputs "out"))
509 (bin (string-append out "/bin")))
510 (substitute* "Makefile"
513 (add-after 'install 'manpage
514 (lambda* (#:key outputs #:allow-other-keys)
515 (install-file "s.1" (string-append (assoc-ref outputs "out")
516 "/share/man/man1"))))
518 (lambda* (#:key inputs outputs #:allow-other-keys)
519 ;; At this point linenoise is meant to be included,
520 ;; so we have to really copy it into the working directory
522 (let* ((linenoise (assoc-ref inputs "linenoise"))
523 (noisepath (string-append linenoise "/include/linenoise"))
524 (out (assoc-ref outputs "out")))
525 (copy-recursively noisepath "linenoise")
527 (("/bin/s") (string-append out "/bin/s")))
529 (home-page "https://github.com/rain-1/s")
530 (synopsis "Extremely minimal shell with the simplest syntax possible")
532 "S is a new shell that aims to be extremely simple.
533 S does not implemnt the POSIX shell standard.
534 There are no globs or \"splatting\" where a variable $FOO turns into multiple
535 command line arguments. One token stays one token forever.
536 This is a \"no surprises\" straightforward approach.
538 There are no redirection operators > in the shell language, they are added as
539 extra programs. > is just another unix command, < is essentially cat(1).
540 A @code{andglob} program is also provided along with s.")
550 (uri (string-append "https://connochaetos.org/oksh/oksh-"
554 "0ln9yf6pxngsviqszv8klnnvn8vcpplvj1njdn8xr2y8frkbw8r3"))))
555 (build-system gnu-build-system)
557 `(; The test files are not part of the distributed tarball.
559 (home-page "https://connochaetos.org/oksh")
560 (synopsis "Port of OpenBSD Korn Shell")
562 "Oksh is a port of the OpenBSD Korn Shell.
563 The OpenBSD Korn Shell is a cleaned up and enhanced ksh.")
574 (url "https://github.com/dimkr/loksh.git")
576 (file-name (git-file-name name version))
578 (base32 "1d92cf5iadj1vwg0wwksaq1691zaxjrd2y4qygj4sdd25zsahj6p"))))
579 (build-system gnu-build-system)
582 ("ncurses" ,ncurses)))
584 `(("pkg-config" ,pkg-config)))
586 `(#:tests? #f ; no tests included
587 #:make-flags (list "CC=gcc" "HAVE_LIBBSD=1"
588 (string-append "PREFIX="
589 (assoc-ref %outputs "out")))
591 (modify-phases %standard-phases
592 (delete 'configure)))) ; no configure script
593 (home-page "https://github.com/dimkr/loksh")
594 (synopsis "Korn Shell from OpenBSD")
596 "loksh is a Linux port of OpenBSD's @command{ksh}. It is a small,
597 interactive POSIX shell targeted at resource-constrained systems.")
598 ;; The file 'LEGAL' says it is the public domain, and the 2
599 ;; exceptions which are listed are not included in this port.
600 (license public-domain)))
609 (uri (string-append "https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R"
613 "1x4zjj9259ijpf8jw0nyh1fnr1pbm5fwvylclpvcrlb45xrglf5d"))))
614 (build-system gnu-build-system)
616 `(#:tests? #f ; tests require access to /dev/tty
618 (modify-phases %standard-phases
623 (invoke (which "sh") "Build.sh")))
625 (lambda* (#:key outputs #:allow-other-keys)
626 (let* ((out (assoc-ref outputs "out"))
627 (bin (string-append out "/bin"))
628 (man (string-append out "/share/man/man1")))
629 (install-file "mksh" bin)
630 (with-directory-excursion bin
631 (symlink "mksh" "ksh"))
632 (install-file "mksh.1" man)
634 (home-page "https://www.mirbsd.org/mksh.htm")
635 (synopsis "Korn Shell from MirBSD")
636 (description "mksh is an actively developed free implementation of the
637 Korn Shell programming language and a successor to the Public Domain Korn
642 (define-public oil-shell
648 (uri (string-append "https://www.oilshell.org/download/oil-"
652 "03zc7rhhpl0cybng2i3c33pky1knsnyvn526bn91hg6w4znvn66w"))))
653 (build-system gnu-build-system)
655 '(#:tests? #f ; the tests are not distributed in the tarballs
656 #:strip-binaries? #f ; the binaries cannot be stripped
658 (modify-phases %standard-phases
659 (add-after 'unpack 'patch-compiler-invocation
661 (substitute* "configure"
665 (lambda* (#:key outputs #:allow-other-keys)
666 (let ((out (assoc-ref outputs "out")))
668 ;; The configure script doesn't recognize CONFIG_SHELL.
669 (setenv "CONFIG_SHELL" (which "sh"))
670 (invoke "./configure" (string-append "--prefix=" out)
671 "--with-readline"))))
672 (add-before 'install 'make-destination
674 ;; The build scripts don't create the destination directory.
675 (mkdir-p (string-append (assoc-ref %outputs "out") "/bin")))))))
677 `(("readline" ,readline)))
678 (synopsis "Bash-compatible Unix shell")
679 (description "Oil is a Unix / POSIX shell, compatible with Bash. It
680 implements the Oil language, which is a new shell language to which Bash can be
681 automatically translated. The Oil language is a superset of Bash. It also
682 implements the OSH language, a statically-parseable language based on Bash as it
683 is commonly written.")
684 (home-page "https://www.oilshell.org/")
685 (license (list psfl ; The Oil sources include a patched Python 2 source tree