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