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@infotropique.org>
10 ;;; Copyright © 2017 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
94 (uri (string-append "https://fishshell.com/files/"
95 version "/fish-" version ".tar.gz"))
98 "1yzx73kg5ng5ivhi68756sl5hpb8869110l9fwim6gn7f7bbprby"))
99 (modules '((guix build utils)))
100 ;; Don't try to install /etc/fish/config.fish.
102 '(substitute* "Makefile.in"
103 ((".*INSTALL.*sysconfdir.*fish.*") "")))))
104 (build-system gnu-build-system)
106 `(("doxygen" ,doxygen)))
110 ("groff" ,groff) ;for 'fish --help'
111 ("pcre2" ,pcre2) ;don't use the bundled PCRE2
112 ("python" ,python-wrapper))) ;for fish_config and manpage completions
114 '(#:tests? #f ; no check target
115 #:configure-flags '("--sysconfdir=/etc")
117 (modify-phases %standard-phases
118 ;; Embed absolute paths to store items.
119 (add-after 'unpack 'embed-store-paths
120 (lambda* (#:key inputs outputs #:allow-other-keys)
121 (substitute* '("share/functions/math.fish"
122 "share/functions/seq.fish")
124 (string-append "| " (assoc-ref %build-inputs "bc")
126 (substitute* "share/functions/fish_update_completions.fish"
127 (("python") (which "python")))
128 (substitute* "share/functions/__fish_print_help.fish"
129 (("nroff") (which "nroff")))
131 (synopsis "The friendly interactive shell")
133 "Fish (friendly interactive shell) is a shell focused on interactive use,
134 discoverability, and friendliness. Fish has very user-friendly and powerful
135 tab-completion, including descriptions of every completion, completion of
136 strings with wildcards, and many completions for specific commands. It also
137 has extensive and discoverable help. A special help command gives access to
138 all the fish documentation in your web browser. Other features include smart
139 terminal handling based on terminfo, an easy to search history, and syntax
141 (home-page "https://fishshell.com/")
144 (define-public fish-guix
151 (uri (string-append "https://dist.infotropique.org/fish-guix/"
152 name "-" version ".tar.xz"))
155 "0xi0j9lvzh43lrj82gz52n2cjln0i0pgayngrg4hy5w4449biy0z"))))
156 (build-system gnu-build-system)
158 `(#:tests? #f ; No checks.
160 (string-append "PREFIX=" %output))
162 (modify-phases %standard-phases
163 (delete 'configure)))) ; No configure script.
164 (home-page "https://www.infotropique.org/projects/fish-guix/")
165 (synopsis "Fish completions for Guix")
167 "Fish-guix provides completions for Guix for users of the fish shell.")
168 (license public-domain)))
177 (url "https://github.com/rakitzis/rc.git")
178 ;; commit name 'release: rc-1.7.4'
179 (commit "c884da53a7c885d46ace2b92de78946855b18e92")))
182 "00mgzvrrh9w96xa85g4gjbsvq02f08k4jwjcdnxq7kyh5xgiw95l"))
183 (file-name (string-append name "-" version "-checkout"))))
184 (build-system gnu-build-system)
189 (modify-phases %standard-phases
192 (lambda _ (zero? (system* "autoreconf" "-vfi"))))
194 'autoreconf 'patch-trip.rc
196 (substitute* "trip.rc"
197 (("/bin/pwd") (which "pwd"))
198 (("/bin/sh") (which "sh"))
199 (("/bin/rm") (which "rm"))
200 (("/bin\\)") (string-append (dirname (which "rm")) ")")))
202 (inputs `(("readline" ,readline)
204 (native-inputs `(("autoconf" ,autoconf)
205 ("automake" ,automake)
207 ("pkg-config" ,pkg-config)))
208 (synopsis "Alternative implementation of the rc shell by Byron Rakitzis")
210 "This is a reimplementation by Byron Rakitzis of the Plan 9 shell. It
211 has a small feature set similar to a traditional Bourne shell.")
212 (home-page "https://github.com/rakitzis/rc")
222 (uri (string-append "https://github.com/wryun/es-shell/releases/"
223 "download/v" version "/es-" version ".tar.gz"))
226 "1fplzxc6lncz2lv2fyr2ig23rgg5j96rm2bbl1rs28mik771zd5h"))
227 (file-name (string-append name "-" version ".tar.gz"))))
228 (build-system gnu-build-system)
230 `(#:test-target "test"
232 (modify-phases %standard-phases
233 (add-before 'configure 're-enter-rootdir
234 ;; The tarball has no folder.
238 `(("readline" ,readline)))
241 (synopsis "Extensible shell with higher-order functions")
243 "Es is an extensible shell. The language was derived from the Plan 9
244 shell, rc, and was influenced by functional programming languages, such as
245 Scheme, and the Tcl embeddable programming language. This implementation is
246 derived from Byron Rakitzis's public domain implementation of rc, and was
247 written by Paul Haahr and Byron Rakitzis.")
248 (home-page "https://wryun.github.io/es-shell/")
249 (license public-domain)))
257 ;; Old tarballs are moved to old/.
258 (uri (list (string-append "ftp://ftp.astron.com/pub/tcsh/"
259 "tcsh-" version ".tar.gz")
260 (string-append "ftp://ftp.astron.com/pub/tcsh/"
261 "old/tcsh-" version ".tar.gz")))
264 "17ggxkkn5skl0v1x0j6hbv5l0sgnidfzwv16992sqkdm983fg7dq"))
265 (patches (search-patches "tcsh-fix-autotest.patch"
266 "tcsh-fix-out-of-bounds-read.patch"))
267 (patch-flags '("-p0"))))
268 (build-system gnu-build-system)
270 `(("autoconf" ,autoconf)
273 `(("ncurses" ,ncurses)))
276 (modify-phases %standard-phases
277 (add-before 'check 'patch-test-scripts
280 (substitute* '("tests/commands.at" "tests/variables.at")
281 (("/bin/pwd") (which "pwd")))
282 ;; The .at files create shell scripts without shebangs. Erk.
283 (substitute* "tests/commands.at"
284 (("./output.sh") "/bin/sh output.sh"))
285 (substitute* "tests/syntax.at"
286 (("; other_script.csh") "; /bin/sh other_script.csh"))
287 ;; Now, let's generate the test suite and patch it
288 (system* "make" "tests/testsuite")
290 ;; This file is ISO-8859-1 encoded.
291 (with-fluids ((%default-port-encoding #f))
292 (substitute* "tests/testsuite"
293 (("/bin/sh") (which "sh"))))
295 (add-after 'install 'post-install
296 (lambda* (#:key inputs outputs #:allow-other-keys)
297 (let* ((out (assoc-ref %outputs "out"))
298 (bin (string-append out "/bin")))
299 (with-directory-excursion bin
300 (symlink "tcsh" "csh"))
302 (home-page "http://www.tcsh.org/")
303 (synopsis "Unix shell based on csh")
305 "Tcsh is an enhanced, but completely compatible version of the Berkeley
306 UNIX C shell (csh). It is a command language interpreter usable both as an
307 interactive login shell and a shell script command processor. It includes a
308 command-line editor, programmable word completion, spelling correction, a
309 history mechanism, job control and a C-like syntax.")
318 (uri (list (string-append
319 "http://www.zsh.org/pub/zsh-" version
322 "http://www.zsh.org/pub/old/zsh-" version
326 "0dsr450v8nydvpk8ry276fvbznlrjgddgp7zvhcw4cv69i9lr4ps"))))
327 (build-system gnu-build-system)
328 (arguments `(#:configure-flags '("--with-tcsetpgrp" "--enable-pcre")
330 (modify-phases %standard-phases
331 (add-before 'configure 'fix-sh
333 ;; Some of the files are ISO-8859-1 encoded.
334 (with-fluids ((%default-port-encoding #f))
340 "Config/installfns.sh"
342 "Test/E01options.ztst"
343 "Test/A05execution.ztst"
344 "Test/A01grammar.ztst"
345 "Test/A06assign.ztst"
346 "Test/B02typeset.ztst"
347 "Completion/Unix/Command/_init_d"
349 (("/bin/sh") (which "sh")))))))))
350 (native-inputs `(("autoconf" ,autoconf)))
351 (inputs `(("ncurses" ,ncurses)
354 (synopsis "Powerful shell for interactive use and scripting")
355 (description "The Z shell (zsh) is a Unix shell that can be used
356 as an interactive login shell and as a powerful command interpreter
357 for shell scripting. Zsh can be thought of as an extended Bourne shell
358 with a large number of improvements, including some features of bash,
360 (home-page "http://www.zsh.org/")
362 ;; The whole thing is under an MIT/X11-style license, but there's one
363 ;; command, 'Completion/Unix/Command/_darcs', which is under GPLv2+.
373 (uri (pypi-uri "xonsh" version))
376 "1yz595hx5bni524m73cx8a08vcr6vfksfci14nx2ylz53igzva2c"))
377 (modules '((guix build utils)))
380 ;; Delete bundled ply.
381 (delete-file-recursively "xonsh/ply")
382 (substitute* '("setup.py")
383 (("'xonsh\\.ply\\.ply',") ""))
385 (build-system python-build-system)
387 '(;; TODO Try running run the test suite.
388 ;; See 'requirements-tests.txt' in the source distribution for more
392 `(("python-ply" ,python-ply)))
393 (home-page "http://xon.sh/")
394 (synopsis "Python-ish shell")
396 "Xonsh is a Python-ish, BASHwards-looking shell language and command
397 prompt. The language is a superset of Python 3.4+ with additional shell
398 primitives that you are used to from Bash and IPython. It works on all major
399 systems including Linux, Mac OSX, and Windows. Xonsh is meant for the daily
400 use of experts and novices alike.")
404 (let ((commit "114432435e4eadd54334df6b37fcae505079b49f")
408 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
413 (url "https://github.com/scheme/scsh")
415 (file-name (string-append name "-" version "-checkout"))
418 "1ghk08akiz7hff1pndi8rmgamgcrn2mv9asbss9l79d3c2iaav3q"))))
419 (build-system gnu-build-system)
421 `(#:test-target "test"
423 (modify-phases %standard-phases
424 (add-before 'configure 'replace-rx
425 (lambda* (#:key inputs #:allow-other-keys)
426 (let* ((rx (assoc-ref inputs "scheme48-rx"))
427 (rxpath (string-append rx "/share/scheme48-"
428 ,(package-version scheme48)
430 (delete-file-recursively "rx")
431 (symlink rxpath "rx"))
433 (add-before 'configure 'autoreconf
435 (zero? (system* "autoreconf")))))))
437 `(("scheme48" ,scheme48)
438 ("scheme48-rx" ,scheme48-rx)))
440 `(("autoconf" ,autoconf)
441 ("automake" ,automake)))
442 (home-page "https://github.com/scheme/scsh")
443 (synopsis "Unix shell embedded in Scheme")
445 "Scsh is a Unix shell embedded in Scheme. Scsh has two main
446 components: a process notation for running programs and setting up pipelines
447 and redirections, and a complete syscall library for low-level access to the
451 (define-public linenoise
452 (let ((commit "2105ce445821381cf1bca87b6d386d4ea88ee20d")
456 (version (string-append "1.0-" revision "." (string-take commit 7)))
461 (url "https://github.com/antirez/linenoise")
463 (file-name (string-append name "-" version "-checkout"))
466 "1z16qwix8z6a40fskdgxsibkqgdrp4q6ncp4n6hnv4r9iihy2d8r"))))
467 (build-system gnu-build-system)
469 `(#:tests? #f ;No tests are included
470 #:make-flags (list "CC=gcc")
472 (modify-phases %standard-phases
475 (lambda* (#:key outputs #:allow-other-keys)
476 ;; At the moment there is no 'make install' in upstream.
477 (let* ((out (assoc-ref outputs "out")))
478 (install-file "linenoise.h"
479 (string-append out "/include/linenoise"))
480 (install-file "linenoise.c"
481 (string-append out "/include/linenoise"))
483 (home-page "https://github.com/antirez/linenoise")
484 (synopsis "Minimal zero-config readline replacement")
486 "Linenoise is a minimal, zero-config, readline replacement.
487 Its features include:
490 @item Single and multi line editing mode with the usual key bindings
491 @item History handling
493 @item Hints (suggestions at the right of the prompt as you type)
494 @item A subset of VT100 escapes, ANSI.SYS compatible
498 (define-public s-shell
499 (let ((commit "6604341edb3a775ff94415762af3ee9bd86bfb3c")
503 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
508 (url "https://github.com/rain-1/s")
510 (file-name (string-append name "-" version "-checkout"))
513 "1075cml6dl15d770j3m12yz90cjacsdslbv3gank1nxd76vmpdcr"))))
514 (build-system gnu-build-system)
516 `(("linenoise" ,linenoise)))
519 #:make-flags (list "CC=gcc")
521 (modify-phases %standard-phases
522 (add-after 'unpack 'install-directory-fix
523 (lambda* (#:key outputs #:allow-other-keys)
524 (let* ((out (assoc-ref outputs "out"))
525 (bin (string-append out "/bin")))
526 (substitute* "Makefile"
529 (add-after 'install 'manpage
530 (lambda* (#:key outputs #:allow-other-keys)
531 (install-file "s.1" (string-append (assoc-ref outputs "out")
532 "/share/man/man1"))))
534 (lambda* (#:key inputs outputs #:allow-other-keys)
535 ;; At this point linenoise is meant to be included,
536 ;; so we have to really copy it into the working directory
538 (let* ((linenoise (assoc-ref inputs "linenoise"))
539 (noisepath (string-append linenoise "/include/linenoise"))
540 (out (assoc-ref outputs "out")))
541 (copy-recursively noisepath "linenoise")
543 (("/bin/s") (string-append out "/bin/s")))
545 (home-page "https://github.com/rain-1/s")
546 (synopsis "Extremely minimal shell with the simplest syntax possible")
548 "S is a new shell that aims to be extremely simple.
549 S does not implemnt the POSIX shell standard.
550 There are no globs or \"splatting\" where a variable $FOO turns into multiple
551 command line arguments. One token stays one token forever.
552 This is a \"no surprises\" straightforward approach.
554 There are no redirection operators > in the shell language, they are added as
555 extra programs. > is just another unix command, < is essentially cat(1).
556 A @code{andglob} program is also provided along with s.")
566 (uri (string-append "https://connochaetos.org/oksh/oksh-"
570 "0ln9yf6pxngsviqszv8klnnvn8vcpplvj1njdn8xr2y8frkbw8r3"))))
571 (build-system gnu-build-system)
573 `(; The test files are not part of the distributed tarball.
575 (home-page "https://connochaetos.org/oksh")
576 (synopsis "Port of OpenBSD Korn Shell")
578 "Oksh is a port of the OpenBSD Korn Shell.
579 The OpenBSD Korn Shell is a cleaned up and enhanced ksh.")
589 (uri (string-append "https://github.com/dimkr/loksh/archive/"
591 (file-name (string-append name "-" version ".tar.gz"))
594 "1wg7ds56yr8fgg1m149bi53bvrwccwiashmwknggza1sqgj9m2lq"))))
595 (build-system gnu-build-system)
597 `(("libbsd" ,libbsd)))
599 `(("pkg-config" ,pkg-config)))
601 `(#:tests? #f ;No tests included
602 #:make-flags (list "CC=gcc" "HAVE_LIBBSD=1"
603 (string-append "DESTDIR="
604 (assoc-ref %outputs "out"))
607 (modify-phases %standard-phases
608 (delete 'configure)))) ;No configure script
609 (home-page "https://github.com/dimkr/loksh")
610 (synopsis "Korn Shell from OpenBSD")
612 "loksh is a Linux port of OpenBSD's @command{ksh}. It is a small,
613 interactive POSIX shell targeted at resource-constrained systems.")
614 ;; The file 'LEGAL' says it is the public domain, and the 2
615 ;; exceptions which are listed are not included in this port.
616 (license public-domain)))
625 (uri (string-append "https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R"
629 "1x4zjj9259ijpf8jw0nyh1fnr1pbm5fwvylclpvcrlb45xrglf5d"))))
630 (build-system gnu-build-system)
632 `(#:tests? #f ; tests require access to /dev/tty
634 (modify-phases %standard-phases
639 (zero? (system* (which "sh") "Build.sh"))))
641 (lambda* (#:key outputs #:allow-other-keys)
642 (let* ((out (assoc-ref outputs "out"))
643 (bin (string-append out "/bin"))
644 (man (string-append out "/share/man/man1")))
645 (install-file "mksh" bin)
646 (with-directory-excursion bin
647 (symlink "mksh" "ksh"))
648 (install-file "mksh.1" man)))))))
649 (home-page "https://www.mirbsd.org/mksh.htm")
650 (synopsis "Korn Shell from MirBSD")
651 (description "mksh is an actively developed free implementation of the
652 Korn Shell programming language and a successor to the Public Domain Korn