Merge branch 'master' into core-updates
[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 <contact.ng0@cryptolab.net>
10 ;;;
11 ;;; This file is part of GNU Guix.
12 ;;;
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
17 ;;;
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
22 ;;;
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26 (define-module (gnu packages shells)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages algebra)
29 #:use-module (gnu packages autotools)
30 #:use-module (gnu packages base)
31 #:use-module (gnu packages bison)
32 #:use-module (gnu packages documentation)
33 #:use-module (gnu packages libedit)
34 #:use-module (gnu packages ncurses)
35 #:use-module (gnu packages pcre)
36 #:use-module (gnu packages perl)
37 #:use-module (gnu packages pkg-config)
38 #:use-module (gnu packages python)
39 #:use-module (gnu packages readline)
40 #:use-module (gnu packages scheme)
41 #:use-module (guix build-system gnu)
42 #:use-module (guix build-system python)
43 #:use-module (guix download)
44 #:use-module (guix git-download)
45 #:use-module (guix licenses)
46 #:use-module (guix packages))
47
48 (define-public dash
49 (package
50 (name "dash")
51 (version "0.5.9")
52 (source
53 (origin
54 (method url-fetch)
55 (uri (string-append "http://gondor.apana.org.au/~herbert/dash/files/"
56 name "-" version ".tar.gz"))
57 (sha256
58 (base32
59 "17328wd9n5krr5wd37smrk0y7fdf8aa3hmhm02br5mqpq0a3nycj"))
60 (modules '((guix build utils)))
61 (snippet
62 '(begin
63 ;; The man page hails from BSD, where (d)ash is the default shell.
64 ;; This isn't the case on Guix or indeed most other GNU systems.
65 (substitute* "src/dash.1"
66 (("the standard command interpreter for the system")
67 "a command interpreter based on the original Bourne shell"))
68 #t))))
69 (build-system gnu-build-system)
70 (inputs
71 `(("libedit" ,libedit)))
72 (arguments
73 `(#:configure-flags '("--with-libedit")))
74 (home-page "http://gondor.apana.org.au/~herbert/dash")
75 (synopsis "POSIX-compliant shell optimised for size")
76 (description
77 "dash is a POSIX-compliant @command{/bin/sh} implementation that aims to be
78 as small as possible, often without sacrificing speed. It is faster than the
79 GNU Bourne-Again Shell (@command{bash}) at most scripted tasks. dash is a
80 direct descendant of NetBSD's Almquist Shell (@command{ash}).")
81 (license (list bsd-3
82 gpl2+)))) ; mksignames.c
83
84 (define-public fish
85 (package
86 (name "fish")
87 (version "2.5.0")
88 (source (origin
89 (method url-fetch)
90 (uri (string-append "https://fishshell.com/files/"
91 version "/fish-" version ".tar.gz"))
92 (sha256
93 (base32
94 "19djav128nkhjxgfhwhc32i5y9d9c3karbh5yg67kqrdranyvh7q"))
95 (modules '((guix build utils)))
96 ;; Don't try to install /etc/fish/config.fish.
97 (snippet
98 '(substitute* "Makefile.in"
99 ((".*INSTALL.*sysconfdir.*fish.*") "")))))
100 (build-system gnu-build-system)
101 (native-inputs
102 `(("doxygen" ,doxygen)))
103 (inputs
104 `(("bc" ,bc)
105 ("ncurses" ,ncurses)
106 ("pcre2" ,pcre2) ;don't use the bundled PCRE2
107 ("python" ,python-wrapper))) ;for fish_config and manpage completions
108 (arguments
109 '(#:tests? #f ; no check target
110 #:configure-flags '("--sysconfdir=/etc")
111 #:phases
112 (modify-phases %standard-phases
113 ;; Embed absolute paths to store items.
114 (add-after 'unpack 'embed-store-paths
115 (lambda* (#:key inputs outputs #:allow-other-keys)
116 (substitute* '("share/functions/math.fish"
117 "share/functions/seq.fish")
118 (("\\| bc")
119 (string-append "| " (assoc-ref %build-inputs "bc")
120 "/bin/bc")))
121 (substitute* "share/functions/fish_update_completions.fish"
122 (("python") (which "python")))
123 #t)))))
124 (synopsis "The friendly interactive shell")
125 (description
126 "Fish (friendly interactive shell) is a shell focused on interactive use,
127 discoverability, and friendliness. Fish has very user-friendly and powerful
128 tab-completion, including descriptions of every completion, completion of
129 strings with wildcards, and many completions for specific commands. It also
130 has extensive and discoverable help. A special help command gives access to
131 all the fish documentation in your web browser. Other features include smart
132 terminal handling based on terminfo, an easy to search history, and syntax
133 highlighting.")
134 (home-page "https://fishshell.com/")
135 (license gpl2)))
136
137 (define-public rc
138 (package
139 (name "rc")
140 (version "1.7.4")
141 (source (origin
142 (method git-fetch)
143 (uri (git-reference
144 (url "git://github.com/rakitzis/rc.git")
145 ;; commit name 'release: rc-1.7.4'
146 (commit "c884da53a7c885d46ace2b92de78946855b18e92")))
147 (sha256
148 (base32
149 "00mgzvrrh9w96xa85g4gjbsvq02f08k4jwjcdnxq7kyh5xgiw95l"))
150 (file-name (string-append name "-" version "-checkout"))))
151 (build-system gnu-build-system)
152 (arguments
153 `(#:configure-flags
154 '("--with-edit=gnu")
155 #:phases
156 (modify-phases %standard-phases
157 (add-after
158 'unpack 'autoreconf
159 (lambda _ (zero? (system* "autoreconf" "-vfi"))))
160 (add-before
161 'autoreconf 'patch-trip.rc
162 (lambda _
163 (substitute* "trip.rc"
164 (("/bin/pwd") (which "pwd"))
165 (("/bin/sh") (which "sh"))
166 (("/bin/rm") (which "rm"))
167 (("/bin\\)") (string-append (dirname (which "rm")) ")")))
168 #t)))))
169 (inputs `(("readline" ,readline)
170 ("perl" ,perl)))
171 (native-inputs `(("autoconf" ,autoconf)
172 ("automake" ,automake)
173 ("libtool" ,libtool)
174 ("pkg-config" ,pkg-config)))
175 (synopsis "Alternative implementation of the rc shell by Byron Rakitzis")
176 (description
177 "This is a reimplementation by Byron Rakitzis of the Plan 9 shell. It
178 has a small feature set similar to a traditional Bourne shell.")
179 (home-page "http://github.com/rakitzis/rc")
180 (license zlib)))
181
182 (define-public es
183 (package
184 (name "es")
185 (version "0.9.1")
186 (source
187 (origin
188 (method url-fetch)
189 (uri (string-append "https://github.com/wryun/es-shell/releases/"
190 "download/v" version "/es-" version ".tar.gz"))
191 (sha256
192 (base32
193 "1fplzxc6lncz2lv2fyr2ig23rgg5j96rm2bbl1rs28mik771zd5h"))
194 (file-name (string-append name "-" version ".tar.gz"))))
195 (build-system gnu-build-system)
196 (arguments
197 `(#:test-target "test"
198 #:phases
199 (modify-phases %standard-phases
200 (add-before 'configure 're-enter-rootdir
201 ;; The tarball has no folder.
202 (lambda _
203 (chdir ".."))))))
204 (inputs
205 `(("readline" ,readline)))
206 (native-inputs
207 `(("bison" ,bison)))
208 (synopsis "Extensible shell with higher-order functions")
209 (description
210 "Es is an extensible shell. The language was derived from the Plan 9
211 shell, rc, and was influenced by functional programming languages, such as
212 Scheme, and the Tcl embeddable programming language. This implementation is
213 derived from Byron Rakitzis's public domain implementation of rc, and was
214 written by Paul Haahr and Byron Rakitzis.")
215 (home-page "https://wryun.github.io/es-shell/")
216 (license public-domain)))
217
218 (define-public tcsh
219 (package
220 (name "tcsh")
221 (version "6.20.00")
222 (source (origin
223 (method url-fetch)
224 ;; Old tarballs are moved to old/.
225 (uri (list (string-append "ftp://ftp.astron.com/pub/tcsh/"
226 "tcsh-" version ".tar.gz")
227 (string-append "ftp://ftp.astron.com/pub/tcsh/"
228 "old/tcsh-" version ".tar.gz")))
229 (sha256
230 (base32
231 "17ggxkkn5skl0v1x0j6hbv5l0sgnidfzwv16992sqkdm983fg7dq"))
232 (patches (search-patches "tcsh-fix-autotest.patch"
233 "tcsh-fix-out-of-bounds-read.patch"))
234 (patch-flags '("-p0"))))
235 (build-system gnu-build-system)
236 (native-inputs
237 `(("autoconf" ,autoconf)
238 ("perl" ,perl)))
239 (inputs
240 `(("ncurses" ,ncurses)))
241 (arguments
242 `(#:phases
243 (modify-phases %standard-phases
244 (add-before 'check 'patch-test-scripts
245 (lambda _
246 ;; Take care of pwd
247 (substitute* '("tests/commands.at" "tests/variables.at")
248 (("/bin/pwd") (which "pwd")))
249 ;; The .at files create shell scripts without shebangs. Erk.
250 (substitute* "tests/commands.at"
251 (("./output.sh") "/bin/sh output.sh"))
252 (substitute* "tests/syntax.at"
253 (("; other_script.csh") "; /bin/sh other_script.csh"))
254 ;; Now, let's generate the test suite and patch it
255 (system* "make" "tests/testsuite")
256
257 ;; This file is ISO-8859-1 encoded.
258 (with-fluids ((%default-port-encoding #f))
259 (substitute* "tests/testsuite"
260 (("/bin/sh") (which "sh"))))
261 #t))
262 (add-after 'install 'post-install
263 (lambda* (#:key inputs outputs #:allow-other-keys)
264 (let* ((out (assoc-ref %outputs "out"))
265 (bin (string-append out "/bin")))
266 (with-directory-excursion bin
267 (symlink "tcsh" "csh"))
268 #t))))))
269 (home-page "http://www.tcsh.org/")
270 (synopsis "Unix shell based on csh")
271 (description
272 "Tcsh is an enhanced, but completely compatible version of the Berkeley
273 UNIX C shell (csh). It is a command language interpreter usable both as an
274 interactive login shell and a shell script command processor. It includes a
275 command-line editor, programmable word completion, spelling correction, a
276 history mechanism, job control and a C-like syntax.")
277 (license bsd-4)))
278
279 (define-public zsh
280 (package
281 (name "zsh")
282 (version "5.2")
283 (source (origin
284 (method url-fetch)
285 (uri (list (string-append
286 "http://www.zsh.org/pub/zsh-" version
287 ".tar.gz")
288 (string-append
289 "http://www.zsh.org/pub/old/zsh-" version
290 ".tar.gz")))
291 (sha256
292 (base32
293 "0dsr450v8nydvpk8ry276fvbznlrjgddgp7zvhcw4cv69i9lr4ps"))))
294 (build-system gnu-build-system)
295 (arguments `(#:configure-flags '("--with-tcsetpgrp" "--enable-pcre")
296 #:phases
297 (modify-phases %standard-phases
298 (add-before 'configure 'fix-sh
299 (lambda _
300 ;; Some of the files are ISO-8859-1 encoded.
301 (with-fluids ((%default-port-encoding #f))
302 (substitute*
303 '("configure"
304 "configure.ac"
305 "Src/exec.c"
306 "Src/mkmakemod.sh"
307 "Config/installfns.sh"
308 "Config/defs.mk.in"
309 "Test/E01options.ztst"
310 "Test/A05execution.ztst"
311 "Test/A01grammar.ztst"
312 "Test/A06assign.ztst"
313 "Test/B02typeset.ztst"
314 "Completion/Unix/Command/_init_d"
315 "Util/preconfig")
316 (("/bin/sh") (which "sh")))))))))
317 (native-inputs `(("autoconf" ,autoconf)))
318 (inputs `(("ncurses" ,ncurses)
319 ("pcre" ,pcre)
320 ("perl" ,perl)))
321 (synopsis "Powerful shell for interactive use and scripting")
322 (description "The Z shell (zsh) is a Unix shell that can be used
323 as an interactive login shell and as a powerful command interpreter
324 for shell scripting. Zsh can be thought of as an extended Bourne shell
325 with a large number of improvements, including some features of bash,
326 ksh, and tcsh.")
327 (home-page "http://www.zsh.org/")
328
329 ;; The whole thing is under an MIT/X11-style license, but there's one
330 ;; command, 'Completion/Unix/Command/_darcs', which is under GPLv2+.
331 (license gpl2+)))
332
333 (define-public xonsh
334 (package
335 (name "xonsh")
336 (version "0.5.5")
337 (source
338 (origin
339 (method url-fetch)
340 (uri (pypi-uri "xonsh" version))
341 (sha256
342 (base32
343 "1wa5g1gxk4aw8jazp3fqmr7mlkdmnva83x28i9xd3s99lv0qb3dd"))
344 (modules '((guix build utils)))
345 (snippet
346 `(begin
347 ;; Delete bundled ply.
348 (delete-file-recursively "xonsh/ply")
349 (substitute* '("setup.py")
350 (("'xonsh\\.ply\\.ply',") ""))
351 #t))))
352 (build-system python-build-system)
353 (arguments
354 '(;; TODO Try running run the test suite.
355 ;; See 'requirements-tests.txt' in the source distribution for more
356 ;; information.
357 #:tests? #f))
358 (inputs
359 `(("python-ply" ,python-ply)))
360 (home-page "http://xon.sh/")
361 (synopsis "Python-ish shell")
362 (description
363 "Xonsh is a Python-ish, BASHwards-looking shell language and command
364 prompt. The language is a superset of Python 3.4+ with additional shell
365 primitives that you are used to from Bash and IPython. It works on all major
366 systems including Linux, Mac OSX, and Windows. Xonsh is meant for the daily
367 use of experts and novices alike.")
368 (license bsd-2)))
369
370 (define-public scsh
371 (let ((commit "114432435e4eadd54334df6b37fcae505079b49f")
372 (revision "1"))
373 (package
374 (name "scsh")
375 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
376 (source
377 (origin
378 (method git-fetch)
379 (uri (git-reference
380 (url "https://github.com/scheme/scsh")
381 (commit commit)))
382 (file-name (string-append name "-" version "-checkout"))
383 (sha256
384 (base32
385 "1ghk08akiz7hff1pndi8rmgamgcrn2mv9asbss9l79d3c2iaav3q"))))
386 (build-system gnu-build-system)
387 (arguments
388 `(#:test-target "test"
389 #:phases
390 (modify-phases %standard-phases
391 (add-before 'configure 'replace-rx
392 (lambda* (#:key inputs #:allow-other-keys)
393 (let* ((rx (assoc-ref inputs "scheme48-rx"))
394 (rxpath (string-append rx "/share/scheme48-"
395 ,(package-version scheme48)
396 "/rx")))
397 (delete-file-recursively "rx")
398 (symlink rxpath "rx"))
399 #t))
400 (add-before 'configure 'autoreconf
401 (lambda _
402 (zero? (system* "autoreconf")))))))
403 (inputs
404 `(("scheme48" ,scheme48)
405 ("scheme48-rx" ,scheme48-rx)))
406 (native-inputs
407 `(("autoconf" ,autoconf)
408 ("automake" ,automake)))
409 (home-page "https://github.com/scheme/scsh")
410 (synopsis "Unix shell embedded in Scheme")
411 (description
412 "Scsh is a Unix shell embedded in Scheme. Scsh has two main
413 components: a process notation for running programs and setting up pipelines
414 and redirections, and a complete syscall library for low-level access to the
415 operating system.")
416 (license bsd-3))))