Merge branch 'staging'
[jackhill/guix/guix.git] / gnu / packages / shells.scm
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>
11 ;;;
12 ;;; This file is part of GNU Guix.
13 ;;;
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.
18 ;;;
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.
23 ;;;
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/>.
26
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))
50
51 (define-public dash
52 (package
53 (name "dash")
54 (version "0.5.9.1")
55 (source
56 (origin
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
60 (method git-fetch)
61 (uri (git-reference
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"))
65 (sha256
66 (base32
67 "0p01vx7rbyf5hyyaff7h8cbhq81bm5fmq1m933484lncl9rafcai"))
68 (modules '((guix build utils)))
69 (snippet
70 '(begin
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"))
76 #t))))
77 (build-system gnu-build-system)
78 (native-inputs
79 `(("autoconf" ,autoconf)
80 ("automake" ,automake)))
81 (inputs
82 `(("libedit" ,libedit)))
83 (arguments
84 `(#:phases
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")
91 (description
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}).")
96 (license (list bsd-3
97 gpl2+)))) ; mksignames.c
98
99 (define-public fish
100 (package
101 (name "fish")
102 (version "2.5.0")
103 (source (origin
104 (method url-fetch)
105 (uri (string-append "https://fishshell.com/files/"
106 version "/fish-" version ".tar.gz"))
107 (sha256
108 (base32
109 "19djav128nkhjxgfhwhc32i5y9d9c3karbh5yg67kqrdranyvh7q"))
110 (modules '((guix build utils)))
111 ;; Don't try to install /etc/fish/config.fish.
112 (snippet
113 '(substitute* "Makefile.in"
114 ((".*INSTALL.*sysconfdir.*fish.*") "")))))
115 (build-system gnu-build-system)
116 (native-inputs
117 `(("doxygen" ,doxygen)))
118 (inputs
119 `(("bc" ,bc)
120 ("ncurses" ,ncurses)
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
124 (arguments
125 '(#:tests? #f ; no check target
126 #:configure-flags '("--sysconfdir=/etc")
127 #:phases
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")
134 (("\\| bc")
135 (string-append "| " (assoc-ref %build-inputs "bc")
136 "/bin/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")))
141 #t)))))
142 (synopsis "The friendly interactive shell")
143 (description
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
151 highlighting.")
152 (home-page "https://fishshell.com/")
153 (license gpl2)))
154
155 (define-public fish-guix
156 (package
157 (name "fish-guix")
158 (version "0.1.1")
159 (source
160 (origin
161 (method url-fetch)
162 (uri (string-append "https://dist.pragmatique.xyz/fish-guix/"
163 name "-" version ".tar.xz"))
164 (sha256
165 (base32
166 "0xi0j9lvzh43lrj82gz52n2cjln0i0pgayngrg4hy5w4449biy0z"))))
167 (build-system gnu-build-system)
168 (arguments
169 `(#:tests? #f ; No checks.
170 #:make-flags (list
171 (string-append "PREFIX=" %output))
172 #:phases
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")
177 (description
178 "Fish-guix provides completions for Guix for users of the fish shell.")
179 (license public-domain)))
180
181 (define-public rc
182 (package
183 (name "rc")
184 (version "1.7.4")
185 (source (origin
186 (method git-fetch)
187 (uri (git-reference
188 (url "git://github.com/rakitzis/rc.git")
189 ;; commit name 'release: rc-1.7.4'
190 (commit "c884da53a7c885d46ace2b92de78946855b18e92")))
191 (sha256
192 (base32
193 "00mgzvrrh9w96xa85g4gjbsvq02f08k4jwjcdnxq7kyh5xgiw95l"))
194 (file-name (string-append name "-" version "-checkout"))))
195 (build-system gnu-build-system)
196 (arguments
197 `(#:configure-flags
198 '("--with-edit=gnu")
199 #:phases
200 (modify-phases %standard-phases
201 (add-after
202 'unpack 'autoreconf
203 (lambda _ (zero? (system* "autoreconf" "-vfi"))))
204 (add-before
205 'autoreconf 'patch-trip.rc
206 (lambda _
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")) ")")))
212 #t)))))
213 (inputs `(("readline" ,readline)
214 ("perl" ,perl)))
215 (native-inputs `(("autoconf" ,autoconf)
216 ("automake" ,automake)
217 ("libtool" ,libtool)
218 ("pkg-config" ,pkg-config)))
219 (synopsis "Alternative implementation of the rc shell by Byron Rakitzis")
220 (description
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")
224 (license zlib)))
225
226 (define-public es
227 (package
228 (name "es")
229 (version "0.9.1")
230 (source
231 (origin
232 (method url-fetch)
233 (uri (string-append "https://github.com/wryun/es-shell/releases/"
234 "download/v" version "/es-" version ".tar.gz"))
235 (sha256
236 (base32
237 "1fplzxc6lncz2lv2fyr2ig23rgg5j96rm2bbl1rs28mik771zd5h"))
238 (file-name (string-append name "-" version ".tar.gz"))))
239 (build-system gnu-build-system)
240 (arguments
241 `(#:test-target "test"
242 #:phases
243 (modify-phases %standard-phases
244 (add-before 'configure 're-enter-rootdir
245 ;; The tarball has no folder.
246 (lambda _
247 (chdir ".."))))))
248 (inputs
249 `(("readline" ,readline)))
250 (native-inputs
251 `(("bison" ,bison)))
252 (synopsis "Extensible shell with higher-order functions")
253 (description
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)))
261
262 (define-public tcsh
263 (package
264 (name "tcsh")
265 (version "6.20.00")
266 (source (origin
267 (method url-fetch)
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")))
273 (sha256
274 (base32
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)
280 (native-inputs
281 `(("autoconf" ,autoconf)
282 ("perl" ,perl)))
283 (inputs
284 `(("ncurses" ,ncurses)))
285 (arguments
286 `(#:phases
287 (modify-phases %standard-phases
288 (add-before 'check 'patch-test-scripts
289 (lambda _
290 ;; Take care of pwd
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")
300
301 ;; This file is ISO-8859-1 encoded.
302 (with-fluids ((%default-port-encoding #f))
303 (substitute* "tests/testsuite"
304 (("/bin/sh") (which "sh"))))
305 #t))
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"))
312 #t))))))
313 (home-page "http://www.tcsh.org/")
314 (synopsis "Unix shell based on csh")
315 (description
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.")
321 (license bsd-4)))
322
323 (define-public zsh
324 (package
325 (name "zsh")
326 (version "5.2")
327 (source (origin
328 (method url-fetch)
329 (uri (list (string-append
330 "http://www.zsh.org/pub/zsh-" version
331 ".tar.gz")
332 (string-append
333 "http://www.zsh.org/pub/old/zsh-" version
334 ".tar.gz")))
335 (sha256
336 (base32
337 "0dsr450v8nydvpk8ry276fvbznlrjgddgp7zvhcw4cv69i9lr4ps"))))
338 (build-system gnu-build-system)
339 (arguments `(#:configure-flags '("--with-tcsetpgrp" "--enable-pcre")
340 #:phases
341 (modify-phases %standard-phases
342 (add-before 'configure 'fix-sh
343 (lambda _
344 ;; Some of the files are ISO-8859-1 encoded.
345 (with-fluids ((%default-port-encoding #f))
346 (substitute*
347 '("configure"
348 "configure.ac"
349 "Src/exec.c"
350 "Src/mkmakemod.sh"
351 "Config/installfns.sh"
352 "Config/defs.mk.in"
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"
359 "Util/preconfig")
360 (("/bin/sh") (which "sh")))))))))
361 (native-inputs `(("autoconf" ,autoconf)))
362 (inputs `(("ncurses" ,ncurses)
363 ("pcre" ,pcre)
364 ("perl" ,perl)))
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,
370 ksh, and tcsh.")
371 (home-page "http://www.zsh.org/")
372
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+.
375 (license gpl2+)))
376
377 (define-public xonsh
378 (package
379 (name "xonsh")
380 (version "0.5.9")
381 (source
382 (origin
383 (method url-fetch)
384 (uri (pypi-uri "xonsh" version))
385 (sha256
386 (base32
387 "09s5k7fh4p0vkq0fha4ikwqlqsyv84vmlbqn8ggn0ymd47ajv38z"))
388 (modules '((guix build utils)))
389 (snippet
390 `(begin
391 ;; Delete bundled ply.
392 (delete-file-recursively "xonsh/ply")
393 (substitute* '("setup.py")
394 (("'xonsh\\.ply\\.ply',") ""))
395 #t))))
396 (build-system python-build-system)
397 (arguments
398 '(;; TODO Try running run the test suite.
399 ;; See 'requirements-tests.txt' in the source distribution for more
400 ;; information.
401 #:tests? #f))
402 (inputs
403 `(("python-ply" ,python-ply)))
404 (home-page "http://xon.sh/")
405 (synopsis "Python-ish shell")
406 (description
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.")
412 (license bsd-2)))
413
414 (define-public scsh
415 (let ((commit "114432435e4eadd54334df6b37fcae505079b49f")
416 (revision "1"))
417 (package
418 (name "scsh")
419 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
420 (source
421 (origin
422 (method git-fetch)
423 (uri (git-reference
424 (url "https://github.com/scheme/scsh")
425 (commit commit)))
426 (file-name (string-append name "-" version "-checkout"))
427 (sha256
428 (base32
429 "1ghk08akiz7hff1pndi8rmgamgcrn2mv9asbss9l79d3c2iaav3q"))))
430 (build-system gnu-build-system)
431 (arguments
432 `(#:test-target "test"
433 #:phases
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)
440 "/rx")))
441 (delete-file-recursively "rx")
442 (symlink rxpath "rx"))
443 #t))
444 (add-before 'configure 'autoreconf
445 (lambda _
446 (zero? (system* "autoreconf")))))))
447 (inputs
448 `(("scheme48" ,scheme48)
449 ("scheme48-rx" ,scheme48-rx)))
450 (native-inputs
451 `(("autoconf" ,autoconf)
452 ("automake" ,automake)))
453 (home-page "https://github.com/scheme/scsh")
454 (synopsis "Unix shell embedded in Scheme")
455 (description
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
459 operating system.")
460 (license bsd-3))))
461
462 (define-public linenoise
463 (package
464 (name "linenoise")
465 (version "1.0")
466 (source
467 (origin
468 (method url-fetch)
469 (uri (string-append "https://github.com/antirez/linenoise/"
470 "archive/" version ".tar.gz"))
471 (file-name (string-append name "-" version ".tar.gz"))
472 (sha256
473 (base32
474 "05006hd56xcvxjdpll4x720bpfan7vwqmxbw8a2kvm10w57ll1gm"))))
475 (build-system gnu-build-system)
476 (arguments
477 `(#:tests? #f ;No tests are included
478 #:make-flags (list "CC=gcc")
479 #:phases
480 (modify-phases %standard-phases
481 (delete 'configure)
482 (replace 'install
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"))
490 #t))))))
491 (home-page "https://github.com/antirez/linenoise")
492 (synopsis "Minimal zero-config readline replacement")
493 (description
494 "Linenoise is a minimal, zero-config, readline replacement.
495 Its features include:
496
497 @enumerate
498 @item Single and multi line editing mode with the usual key bindings
499 @item History handling
500 @item Completion
501 @item Hints (suggestions at the right of the prompt as you type)
502 @item A subset of VT100 escapes, ANSI.SYS compatible
503 @end enumerate\n")
504 (license bsd-2)))
505
506 (define-public s
507 (let ((commit "6604341edb3a775ff94415762af3ee9bd86bfb3c")
508 (revision "1"))
509 (package
510 (name "s")
511 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
512 (source
513 (origin
514 (method git-fetch)
515 (uri (git-reference
516 (url "https://github.com/rain-1/s")
517 (commit commit)))
518 (file-name (string-append name "-" version "-checkout"))
519 (sha256
520 (base32
521 "1075cml6dl15d770j3m12yz90cjacsdslbv3gank1nxd76vmpdcr"))))
522 (build-system gnu-build-system)
523 (inputs
524 `(("linenoise" ,linenoise)))
525 (arguments
526 `(#:tests? #f
527 #:make-flags (list "CC=gcc")
528 #:phases
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"
535 (("out") bin))
536 #t)))
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"))))
541 (replace 'configure
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
545 ;; of s.
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")
550 (substitute* "s.c"
551 (("/bin/s") (string-append out "/bin/s")))
552 #t))))))
553 (home-page "https://github.com/rain-1/s")
554 (synopsis "Extremely minimal shell with the simplest syntax possible")
555 (description
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.
561
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.")
565 (license bsd-3))))
566
567 (define-public loksh
568 (package
569 (name "loksh")
570 (version "6.1")
571 (source
572 (origin
573 (method url-fetch)
574 (uri (string-append "https://github.com/dimkr/loksh/archive/"
575 version ".tar.gz"))
576 (file-name (string-append name "-" version ".tar.gz"))
577 (sha256
578 (base32
579 "1wg7ds56yr8fgg1m149bi53bvrwccwiashmwknggza1sqgj9m2lq"))))
580 (build-system gnu-build-system)
581 (inputs
582 `(("libbsd" ,libbsd)))
583 (native-inputs
584 `(("pkg-config" ,pkg-config)))
585 (arguments
586 `(#:tests? #f ;No tests included
587 #:make-flags (list "CC=gcc" "HAVE_LIBBSD=1"
588 (string-append "DESTDIR="
589 (assoc-ref %outputs "out"))
590 "PREFIX=")
591 #:phases
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")
596 (description
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)))