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