Merge branch 'staging' into core-updates
[jackhill/guix/guix.git] / gnu / packages / shells.scm
CommitLineData
c356339d 1;;; GNU Guix --- Functional package management for GNU
d754347c 2;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
618977ae 3;;; Copyright © 2014, 2015 David Thompson <davet@gnu.org>
7ccb874a 4;;; Copyright © 2014 Kevin Lemonnier <lemonnierk@ulrar.net>
9a57d3e6 5;;; Copyright © 2015 Jeff Mickey <j@codemac.net>
d019c05a 6;;; Copyright © 2016, 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
572ee05c 7;;; Copyright © 2016 Stefan Reichör <stefan@xsteve.at>
bc74e9e4 8;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
47956fa0 9;;; Copyright © 2017, 2018 ng0 <ng0@n0.is>
18d9d22a 10;;; Copyright © 2017, 2018 Leo Famulari <leo@famulari.name>
0daa1d64 11;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
e1dba5be 12;;; Copyright © 2019 Meiyo Peng <meiyo.peng@gmail.com>
2ccc9d69 13;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
2b9ef6e5 14;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
d0a26d0b 15;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
c356339d
TGR
16;;;
17;;; This file is part of GNU Guix.
18;;;
19;;; GNU Guix is free software; you can redistribute it and/or modify it
20;;; under the terms of the GNU General Public License as published by
21;;; the Free Software Foundation; either version 3 of the License, or (at
22;;; your option) any later version.
23;;;
24;;; GNU Guix is distributed in the hope that it will be useful, but
25;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27;;; GNU General Public License for more details.
28;;;
29;;; You should have received a copy of the GNU General Public License
30;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31
32(define-module (gnu packages shells)
d754347c 33 #:use-module (gnu packages)
9a57d3e6 34 #:use-module (gnu packages autotools)
d754347c 35 #:use-module (gnu packages base)
1d962fc0 36 #:use-module (gnu packages bash)
e6880040 37 #:use-module (gnu packages bison)
618977ae 38 #:use-module (gnu packages documentation)
28a671ed 39 #:use-module (gnu packages groff)
2ccc9d69 40 #:use-module (gnu packages guile)
cc5a76a7 41 #:use-module (gnu packages libbsd)
c356339d 42 #:use-module (gnu packages libedit)
618977ae 43 #:use-module (gnu packages ncurses)
7ccb874a 44 #:use-module (gnu packages pcre)
9a57d3e6
TGR
45 #:use-module (gnu packages perl)
46 #:use-module (gnu packages pkg-config)
618977ae 47 #:use-module (gnu packages python)
44d10b1f 48 #:use-module (gnu packages python-xyz)
9a57d3e6 49 #:use-module (gnu packages readline)
52ddeaa0 50 #:use-module (gnu packages scheme)
c356339d 51 #:use-module (guix build-system gnu)
1d515855 52 #:use-module (guix build-system python)
1d962fc0 53 #:use-module (guix build-system trivial)
c356339d 54 #:use-module (guix download)
9a57d3e6 55 #:use-module (guix git-download)
c356339d
TGR
56 #:use-module (guix licenses)
57 #:use-module (guix packages))
58
59(define-public dash
60 (package
61 (name "dash")
ade57b69 62 (version "0.5.10.2")
c356339d
TGR
63 (source
64 (origin
da20c38f
LF
65 (method url-fetch)
66 (uri (string-append "http://gondor.apana.org.au/~herbert/dash/files/"
67 "dash-" version ".tar.gz"))
c356339d
TGR
68 (sha256
69 (base32
ade57b69 70 "0wb0bwmqc661hylqcfdp7l7x12myw3vpqk513ncyqrjwvhckjriw"))
c356339d
TGR
71 (modules '((guix build utils)))
72 (snippet
73 '(begin
74 ;; The man page hails from BSD, where (d)ash is the default shell.
75 ;; This isn't the case on Guix or indeed most other GNU systems.
76 (substitute* "src/dash.1"
77 (("the standard command interpreter for the system")
78 "a command interpreter based on the original Bourne shell"))
79 #t))))
80 (build-system gnu-build-system)
81 (inputs
82 `(("libedit" ,libedit)))
83 (arguments
da20c38f 84 '(#:configure-flags '("--with-libedit")))
c356339d
TGR
85 (home-page "http://gondor.apana.org.au/~herbert/dash")
86 (synopsis "POSIX-compliant shell optimised for size")
87 (description
88 "dash is a POSIX-compliant @command{/bin/sh} implementation that aims to be
89as small as possible, often without sacrificing speed. It is faster than the
90GNU Bourne-Again Shell (@command{bash}) at most scripted tasks. dash is a
91direct descendant of NetBSD's Almquist Shell (@command{ash}).")
92 (license (list bsd-3
93 gpl2+)))) ; mksignames.c
618977ae
TGR
94
95(define-public fish
96 (package
97 (name "fish")
bb2f114d 98 (version "3.0.2")
e1dba5be
MP
99 (source
100 (origin
101 (method url-fetch)
102 (uri (string-append "https://github.com/fish-shell/fish-shell/"
103 "releases/download/" version "/"
104 name "-" version ".tar.gz"))
105 (sha256
bb2f114d 106 (base32 "03j3jl9jzlnhq4p86zj8wqsh5sx45j1d1fvfa80ks1cfdg68qwhl"))))
618977ae 107 (build-system gnu-build-system)
618977ae 108 (inputs
4bddd12a
MP
109 `(("fish-foreign-env" ,fish-foreign-env)
110 ("groff" ,groff) ; for 'fish --help'
a8d3bc47 111 ("ncurses" ,ncurses)
e1dba5be
MP
112 ("pcre2" ,pcre2) ; don't use the bundled PCRE2
113 ("python" ,python))) ; for fish_config and manpage completions
114 (native-inputs
115 `(("doxygen" ,doxygen)))
618977ae 116 (arguments
e1dba5be 117 '(#:tests? #f ; no check target
a8d3bc47
AI
118 #:phases
119 (modify-phases %standard-phases
e1dba5be
MP
120 (add-after 'unpack 'patch-source
121 (lambda _
122 (substitute* '("build_tools/build_commands_hdr.sh"
123 "build_tools/build_user_doc.sh")
124 (("/usr/bin/env") "env"))
125 #t))
126 ;; Embed absolute paths.
127 (add-before 'install 'embed-absolute-paths
128 (lambda _
129 (substitute* '("share/functions/__fish_config_interactive.fish"
130 "share/functions/fish_config.fish"
131 "share/functions/fish_update_completions.fish")
132 (("python3") (which "python3")))
28a671ed 133 (substitute* "share/functions/__fish_print_help.fish"
134 (("nroff") (which "nroff")))
e1dba5be
MP
135 #t))
136 ;; Source /etc/fish/config.fish from $__fish_sysconf_dir/config.fish.
137 (add-before 'install 'patch-fish-config
138 (lambda _
139 (let ((port (open-file "etc/config.fish" "a")))
140 (display (string-append
141 "\n\n"
142 "# Patched by Guix.\n"
143 "# Source /etc/fish/config.fish.\n"
144 "if test -f /etc/fish/config.fish\n"
145 " source /etc/fish/config.fish\n"
146 "end\n")
147 port)
148 (close-port port))
149 #t))
150 ;; Enable completions, functions and configurations in user's and
151 ;; system's guix profiles by adding them to __extra_* variables.
152 (add-before 'install 'patch-fish-extra-paths
153 (lambda _
154 (let ((port (open-file "share/__fish_build_paths.fish" "a")))
155 (display
156 (string-append
157 "\n\n"
158 "# Patched by Guix.\n"
159 "# Enable completions, functions and configurations in user's"
160 " and system's guix profiles by adding them to __extra_*"
161 " variables.\n"
162 "set -l __guix_profile_paths ~/.guix-profile"
163 " /run/current-system/profile\n"
164 "set __extra_completionsdir"
165 " $__guix_profile_paths\"/etc/fish/completions\""
166 " $__guix_profile_paths\"/share/fish/vendor_completions.d\""
167 " $__extra_completionsdir\n"
168 "set __extra_functionsdir"
169 " $__guix_profile_paths\"/etc/fish/functions\""
170 " $__guix_profile_paths\"/share/fish/vendor_functions.d\""
171 " $__extra_functionsdir\n"
172 "set __extra_confdir"
173 " $__guix_profile_paths\"/etc/fish/conf.d\""
174 " $__guix_profile_paths\"/share/fish/vendor_conf.d\""
175 " $__extra_confdir\n")
176 port)
177 (close-port port))
4bddd12a
MP
178 #t))
179 ;; Use fish-foreign-env to source /etc/profile.
180 (add-before 'install 'source-etc-profile
181 (lambda* (#:key inputs #:allow-other-keys)
182 (let ((port (open-file "share/__fish_build_paths.fish" "a")))
183 (display
184 (string-append
185 "\n\n"
186 "# Patched by Guix.\n"
187 "# Use fish-foreign-env to source /etc/profile.\n"
188 "if status is-login\n"
189 " set fish_function_path "
190 (assoc-ref inputs "fish-foreign-env") "/share/fish/functions"
191 " $__fish_datadir/functions\n"
192 " fenv source /etc/profile\n"
193 " set -e fish_function_path\n"
194 "end\n")
195 port)
196 (close-port port))
4f4bca0f 197 #t)))))
618977ae
TGR
198 (synopsis "The friendly interactive shell")
199 (description
200 "Fish (friendly interactive shell) is a shell focused on interactive use,
201discoverability, and friendliness. Fish has very user-friendly and powerful
202tab-completion, including descriptions of every completion, completion of
203strings with wildcards, and many completions for specific commands. It also
50786325
TGR
204has extensive and discoverable help. A special @command{help} command gives
205access to all the fish documentation in your web browser. Other features
206include smart terminal handling based on terminfo, an easy to search history,
207and syntax highlighting.")
618977ae
TGR
208 (home-page "https://fishshell.com/")
209 (license gpl2)))
9a57d3e6 210
1d962fc0
MP
211(define-public fish-foreign-env
212 (package
213 (name "fish-foreign-env")
214 (version "0.20190116")
215 (source
216 (origin
217 (method git-fetch)
218 (uri (git-reference
219 (url "https://github.com/oh-my-fish/plugin-foreign-env.git")
220 (commit "dddd9213272a0ab848d474d0cbde12ad034e65bc")))
221 (file-name (git-file-name name version))
222 (sha256
223 (base32 "00xqlyl3lffc5l0viin1nyp819wf81fncqyz87jx8ljjdhilmgbs"))))
224 (build-system trivial-build-system)
225 (arguments
226 '(#:modules ((guix build utils))
227 #:builder
228 (begin
229 (use-modules (guix build utils))
230 (let* ((source (assoc-ref %build-inputs "source"))
231 (out (assoc-ref %outputs "out"))
232 (func-path (string-append out "/share/fish/functions")))
233 (mkdir-p func-path)
234 (copy-recursively (string-append source "/functions")
235 func-path)
236
237 ;; Embed absolute paths.
238 (substitute* `(,(string-append func-path "/fenv.fish")
239 ,(string-append func-path "/fenv.apply.fish")
240 ,(string-append func-path "/fenv.main.fish"))
241 (("bash")
242 (string-append (assoc-ref %build-inputs "bash") "/bin/bash"))
243 (("sed")
244 (string-append (assoc-ref %build-inputs "sed") "/bin/sed"))
245 ((" tr ")
246 (string-append " " (assoc-ref %build-inputs "coreutils")
247 "/bin/tr ")))))))
248 (inputs
249 `(("bash" ,bash)
250 ("coreutils" ,coreutils)
251 ("sed" ,sed)))
252 (home-page "https://github.com/oh-my-fish/plugin-foreign-env")
253 (synopsis "Foreign environment interface for fish shell")
254 (description "@code{fish-foreign-env} wraps bash script execution in a way
255that environment variables that are exported or modified get imported back
256into fish.")
257 (license expat)))
258
9a57d3e6
TGR
259(define-public rc
260 (package
261 (name "rc")
262 (version "1.7.4")
263 (source (origin
264 (method git-fetch)
265 (uri (git-reference
5f13bf09 266 (url "https://github.com/rakitzis/rc.git")
487cf5aa 267 (commit (string-append "v" version))))
9a57d3e6
TGR
268 (sha256
269 (base32
487cf5aa
TGR
270 "0vj1h4pcg13vxsiydmmk87dr2sra9h4gwx0c4q6fjsiw4in78rrd"))
271 (file-name (git-file-name name version))))
9a57d3e6
TGR
272 (build-system gnu-build-system)
273 (arguments
274 `(#:configure-flags
275 '("--with-edit=gnu")
276 #:phases
277 (modify-phases %standard-phases
487cf5aa 278 (add-before 'bootstrap 'patch-trip.rc
9a57d3e6
TGR
279 (lambda _
280 (substitute* "trip.rc"
281 (("/bin/pwd") (which "pwd"))
282 (("/bin/sh") (which "sh"))
283 (("/bin/rm") (which "rm"))
284 (("/bin\\)") (string-append (dirname (which "rm")) ")")))
285 #t)))))
286 (inputs `(("readline" ,readline)
287 ("perl" ,perl)))
288 (native-inputs `(("autoconf" ,autoconf)
289 ("automake" ,automake)
290 ("libtool" ,libtool)
291 ("pkg-config" ,pkg-config)))
292 (synopsis "Alternative implementation of the rc shell by Byron Rakitzis")
293 (description
294 "This is a reimplementation by Byron Rakitzis of the Plan 9 shell. It
295has a small feature set similar to a traditional Bourne shell.")
7bf837fd 296 (home-page "https://github.com/rakitzis/rc")
9a57d3e6 297 (license zlib)))
d754347c 298
e6880040 299(define-public es
300 (package
301 (name "es")
302 (version "0.9.1")
303 (source
304 (origin
305 (method url-fetch)
306 (uri (string-append "https://github.com/wryun/es-shell/releases/"
307 "download/v" version "/es-" version ".tar.gz"))
308 (sha256
309 (base32
310 "1fplzxc6lncz2lv2fyr2ig23rgg5j96rm2bbl1rs28mik771zd5h"))
311 (file-name (string-append name "-" version ".tar.gz"))))
312 (build-system gnu-build-system)
313 (arguments
314 `(#:test-target "test"
315 #:phases
316 (modify-phases %standard-phases
317 (add-before 'configure 're-enter-rootdir
318 ;; The tarball has no folder.
319 (lambda _
320 (chdir ".."))))))
321 (inputs
322 `(("readline" ,readline)))
323 (native-inputs
324 `(("bison" ,bison)))
325 (synopsis "Extensible shell with higher-order functions")
326 (description
327 "Es is an extensible shell. The language was derived from the Plan 9
328shell, rc, and was influenced by functional programming languages, such as
329Scheme, and the Tcl embeddable programming language. This implementation is
330derived from Byron Rakitzis's public domain implementation of rc, and was
331written by Paul Haahr and Byron Rakitzis.")
332 (home-page "https://wryun.github.io/es-shell/")
333 (license public-domain)))
334
d754347c
TGR
335(define-public tcsh
336 (package
337 (name "tcsh")
d098aa3e 338 (version "6.22.02")
d754347c
TGR
339 (source (origin
340 (method url-fetch)
341 ;; Old tarballs are moved to old/.
342 (uri (list (string-append "ftp://ftp.astron.com/pub/tcsh/"
343 "tcsh-" version ".tar.gz")
344 (string-append "ftp://ftp.astron.com/pub/tcsh/"
345 "old/tcsh-" version ".tar.gz")))
346 (sha256
347 (base32
d098aa3e
MB
348 "0nw8prz1n0lmr82wnpyhrzmki630afn7p9cfgr3vl00vr9c72a7d"))
349 (patches (search-patches "tcsh-fix-autotest.patch"))
d754347c
TGR
350 (patch-flags '("-p0"))))
351 (build-system gnu-build-system)
816417f5 352 (native-inputs
d754347c 353 `(("autoconf" ,autoconf)
816417f5
LF
354 ("perl" ,perl)))
355 (inputs
356 `(("ncurses" ,ncurses)))
d754347c
TGR
357 (arguments
358 `(#:phases
c71011f8 359 (modify-phases %standard-phases
2b9ef6e5
MO
360 ,@(if (%current-target-system)
361 '((add-before 'configure 'set-cross-cc
362 (lambda _
363 (substitute* "configure"
364 (("CC_FOR_GETHOST=\"cc\"")
365 "CC_FOR_GETHOST=\"gcc\""))
366 #t)))
367 '())
c71011f8
LF
368 (add-before 'check 'patch-test-scripts
369 (lambda _
370 ;; Take care of pwd
371 (substitute* '("tests/commands.at" "tests/variables.at")
372 (("/bin/pwd") (which "pwd")))
373 ;; The .at files create shell scripts without shebangs. Erk.
374 (substitute* "tests/commands.at"
375 (("./output.sh") "/bin/sh output.sh"))
376 (substitute* "tests/syntax.at"
377 (("; other_script.csh") "; /bin/sh other_script.csh"))
378 ;; Now, let's generate the test suite and patch it
c22f655f 379 (invoke "make" "tests/testsuite")
d754347c 380
c71011f8
LF
381 ;; This file is ISO-8859-1 encoded.
382 (with-fluids ((%default-port-encoding #f))
383 (substitute* "tests/testsuite"
384 (("/bin/sh") (which "sh"))))
385 #t))
386 (add-after 'install 'post-install
387 (lambda* (#:key inputs outputs #:allow-other-keys)
388 (let* ((out (assoc-ref %outputs "out"))
389 (bin (string-append out "/bin")))
390 (with-directory-excursion bin
391 (symlink "tcsh" "csh"))
392 #t))))))
d754347c
TGR
393 (home-page "http://www.tcsh.org/")
394 (synopsis "Unix shell based on csh")
395 (description
396 "Tcsh is an enhanced, but completely compatible version of the Berkeley
397UNIX C shell (csh). It is a command language interpreter usable both as an
398interactive login shell and a shell script command processor. It includes a
399command-line editor, programmable word completion, spelling correction, a
400history mechanism, job control and a C-like syntax.")
401 (license bsd-4)))
7ccb874a
TGR
402
403(define-public zsh
404 (package
405 (name "zsh")
021b42f5 406 (version "5.6.2")
7ccb874a
TGR
407 (source (origin
408 (method url-fetch)
409 (uri (list (string-append
4dbef671 410 "https://www.zsh.org/pub/zsh-" version
379848ed 411 ".tar.xz")
7ccb874a 412 (string-append
4dbef671 413 "https://www.zsh.org/pub/old/zsh-" version
379848ed 414 ".tar.xz")))
7ccb874a
TGR
415 (sha256
416 (base32
021b42f5 417 "17iffliqcj4hv91g0bd2sxsyfcz51mfyh97sp2iyrs2p0mndc2x5"))))
7ccb874a
TGR
418 (build-system gnu-build-system)
419 (arguments `(#:configure-flags '("--with-tcsetpgrp" "--enable-pcre")
ddee9a6e
TGR
420 #:phases
421 (modify-phases %standard-phases
422 (add-before 'configure 'fix-sh
423 (lambda _
424 ;; Some of the files are ISO-8859-1 encoded.
425 (with-fluids ((%default-port-encoding #f))
426 (substitute*
427 '("configure"
428 "configure.ac"
429 "Src/exec.c"
430 "Src/mkmakemod.sh"
431 "Config/installfns.sh"
432 "Config/defs.mk.in"
433 "Test/E01options.ztst"
434 "Test/A05execution.ztst"
435 "Test/A01grammar.ztst"
436 "Test/A06assign.ztst"
437 "Test/B02typeset.ztst"
438 "Completion/Unix/Command/_init_d"
439 "Util/preconfig")
4440e40c
LF
440 (("/bin/sh") (which "sh"))))))
441 (add-before 'check 'patch-test
442 (lambda _
443 ;; In Zsh, `command -p` searches a predefined set of
444 ;; paths that don't exist in the build environment. See
445 ;; the assignment of 'path' in Src/init.c'
446 (substitute* "Test/A01grammar.ztst"
447 (("command -pv") "command -v")
448 (("command -p") "command ")
449 (("'command' -p") "'command' "))
450 #t)))))
7ccb874a
TGR
451 (native-inputs `(("autoconf" ,autoconf)))
452 (inputs `(("ncurses" ,ncurses)
453 ("pcre" ,pcre)
454 ("perl" ,perl)))
455 (synopsis "Powerful shell for interactive use and scripting")
456 (description "The Z shell (zsh) is a Unix shell that can be used
457as an interactive login shell and as a powerful command interpreter
458for shell scripting. Zsh can be thought of as an extended Bourne shell
459with a large number of improvements, including some features of bash,
460ksh, and tcsh.")
4dbef671 461 (home-page "https://www.zsh.org/")
7ccb874a
TGR
462
463 ;; The whole thing is under an MIT/X11-style license, but there's one
464 ;; command, 'Completion/Unix/Command/_darcs', which is under GPLv2+.
465 (license gpl2+)))
1d515855
SR
466
467(define-public xonsh
468 (package
469 (name "xonsh")
9822835f 470 (version "0.6.2")
1d515855
SR
471 (source
472 (origin
473 (method url-fetch)
474 (uri (pypi-uri "xonsh" version))
475 (sha256
476 (base32
9822835f 477 "0c2bbmdg0n10q54vq9k1z5n53l0mh1hb1q5xprfhilvrbr6hlcwr"))
cfb7e269
DM
478 (modules '((guix build utils)))
479 (snippet
480 `(begin
481 ;; Delete bundled ply.
482 (delete-file-recursively "xonsh/ply")
483 (substitute* '("setup.py")
572ee05c 484 (("'xonsh\\.ply\\.ply',") ""))
cfb7e269 485 #t))))
1d515855 486 (build-system python-build-system)
792e6079
LF
487 (arguments
488 '(;; TODO Try running run the test suite.
489 ;; See 'requirements-tests.txt' in the source distribution for more
490 ;; information.
491 #:tests? #f))
cfb7e269
DM
492 (inputs
493 `(("python-ply" ,python-ply)))
9a50f47c 494 (home-page "https://xon.sh/")
1d515855
SR
495 (synopsis "Python-ish shell")
496 (description
497 "Xonsh is a Python-ish, BASHwards-looking shell language and command
e813f395
KK
498prompt. The language is a superset of Python 3.4+ with additional shell
499primitives that you are used to from Bash and IPython. It works on all major
500systems including Linux, Mac OSX, and Windows. Xonsh is meant for the daily
1d515855
SR
501use of experts and novices alike.")
502 (license bsd-2)))
52ddeaa0 503
504(define-public scsh
505 (let ((commit "114432435e4eadd54334df6b37fcae505079b49f")
506 (revision "1"))
507 (package
508 (name "scsh")
509 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
510 (source
511 (origin
512 (method git-fetch)
513 (uri (git-reference
514 (url "https://github.com/scheme/scsh")
515 (commit commit)))
516 (file-name (string-append name "-" version "-checkout"))
517 (sha256
518 (base32
519 "1ghk08akiz7hff1pndi8rmgamgcrn2mv9asbss9l79d3c2iaav3q"))))
520 (build-system gnu-build-system)
521 (arguments
522 `(#:test-target "test"
523 #:phases
524 (modify-phases %standard-phases
525 (add-before 'configure 'replace-rx
526 (lambda* (#:key inputs #:allow-other-keys)
527 (let* ((rx (assoc-ref inputs "scheme48-rx"))
528 (rxpath (string-append rx "/share/scheme48-"
529 ,(package-version scheme48)
530 "/rx")))
531 (delete-file-recursively "rx")
532 (symlink rxpath "rx"))
bc74e9e4 533 #t)))))
52ddeaa0 534 (inputs
535 `(("scheme48" ,scheme48)
536 ("scheme48-rx" ,scheme48-rx)))
537 (native-inputs
538 `(("autoconf" ,autoconf)
539 ("automake" ,automake)))
540 (home-page "https://github.com/scheme/scsh")
541 (synopsis "Unix shell embedded in Scheme")
542 (description
543 "Scsh is a Unix shell embedded in Scheme. Scsh has two main
544components: a process notation for running programs and setting up pipelines
545and redirections, and a complete syscall library for low-level access to the
546operating system.")
547 (license bsd-3))))
cc5a76a7 548
17cf788f 549(define-public linenoise
05af41a1 550 (let ((commit "2105ce445821381cf1bca87b6d386d4ea88ee20d")
551 (revision "1"))
552 (package
553 (name "linenoise")
554 (version (string-append "1.0-" revision "." (string-take commit 7)))
555 (source
556 (origin
557 (method git-fetch)
558 (uri (git-reference
559 (url "https://github.com/antirez/linenoise")
560 (commit commit)))
561 (file-name (string-append name "-" version "-checkout"))
562 (sha256
563 (base32
564 "1z16qwix8z6a40fskdgxsibkqgdrp4q6ncp4n6hnv4r9iihy2d8r"))))
565 (build-system gnu-build-system)
566 (arguments
567 `(#:tests? #f ;No tests are included
568 #:make-flags (list "CC=gcc")
569 #:phases
570 (modify-phases %standard-phases
571 (delete 'configure)
572 (replace 'install
573 (lambda* (#:key outputs #:allow-other-keys)
574 ;; At the moment there is no 'make install' in upstream.
575 (let* ((out (assoc-ref outputs "out")))
576 (install-file "linenoise.h"
577 (string-append out "/include/linenoise"))
578 (install-file "linenoise.c"
579 (string-append out "/include/linenoise"))
580 #t))))))
581 (home-page "https://github.com/antirez/linenoise")
582 (synopsis "Minimal zero-config readline replacement")
583 (description
584 "Linenoise is a minimal, zero-config, readline replacement.
17cf788f 585Its features include:
586
587@enumerate
588@item Single and multi line editing mode with the usual key bindings
589@item History handling
590@item Completion
591@item Hints (suggestions at the right of the prompt as you type)
592@item A subset of VT100 escapes, ANSI.SYS compatible
593@end enumerate\n")
05af41a1 594 (license bsd-2))))
17cf788f 595
9a68fb6c 596(define-public s-shell
e536b1d3 597 (let ((commit "da2e5c20c0c5f477ec3426dc2584889a789b1659")
598 (revision "2"))
0e4591bb 599 (package
9a68fb6c 600 (name "s-shell")
e536b1d3 601 (version (git-version "0.0.0" revision commit))
0e4591bb 602 (source
603 (origin
604 (method git-fetch)
605 (uri (git-reference
606 (url "https://github.com/rain-1/s")
607 (commit commit)))
608 (file-name (string-append name "-" version "-checkout"))
609 (sha256
610 (base32
e536b1d3 611 "0qiny71ww5nhzy4mnc8652hn0mlxyb67h333gbdxp4j4qxsi13q4"))))
0e4591bb 612 (build-system gnu-build-system)
613 (inputs
614 `(("linenoise" ,linenoise)))
615 (arguments
616 `(#:tests? #f
e536b1d3 617 #:make-flags (list "CC=gcc"
618 (string-append "PREFIX="
619 (assoc-ref %outputs "out")))
0e4591bb 620 #:phases
621 (modify-phases %standard-phases
622 (add-after 'unpack 'install-directory-fix
623 (lambda* (#:key outputs #:allow-other-keys)
624 (let* ((out (assoc-ref outputs "out"))
625 (bin (string-append out "/bin")))
626 (substitute* "Makefile"
627 (("out") bin))
628 #t)))
629 (add-after 'install 'manpage
630 (lambda* (#:key outputs #:allow-other-keys)
631 (install-file "s.1" (string-append (assoc-ref outputs "out")
632 "/share/man/man1"))))
633 (replace 'configure
634 (lambda* (#:key inputs outputs #:allow-other-keys)
635 ;; At this point linenoise is meant to be included,
636 ;; so we have to really copy it into the working directory
637 ;; of s.
638 (let* ((linenoise (assoc-ref inputs "linenoise"))
639 (noisepath (string-append linenoise "/include/linenoise"))
640 (out (assoc-ref outputs "out")))
641 (copy-recursively noisepath "linenoise")
642 (substitute* "s.c"
643 (("/bin/s") (string-append out "/bin/s")))
644 #t))))))
645 (home-page "https://github.com/rain-1/s")
646 (synopsis "Extremely minimal shell with the simplest syntax possible")
647 (description
648 "S is a new shell that aims to be extremely simple.
649S does not implemnt the POSIX shell standard.
650There are no globs or \"splatting\" where a variable $FOO turns into multiple
651command line arguments. One token stays one token forever.
652This is a \"no surprises\" straightforward approach.
653
654There are no redirection operators > in the shell language, they are added as
655extra programs. > is just another unix command, < is essentially cat(1).
656A @code{andglob} program is also provided along with s.")
657 (license bsd-3))))
658
7e3c977d 659(define-public oksh
660 (package
661 (name "oksh")
662 (version "0.5.9")
663 (source
664 (origin
665 (method url-fetch)
666 (uri (string-append "https://connochaetos.org/oksh/oksh-"
667 version ".tar.gz"))
668 (sha256
669 (base32
670 "0ln9yf6pxngsviqszv8klnnvn8vcpplvj1njdn8xr2y8frkbw8r3"))))
671 (build-system gnu-build-system)
672 (arguments
673 `(; The test files are not part of the distributed tarball.
674 #:tests? #f))
675 (home-page "https://connochaetos.org/oksh")
676 (synopsis "Port of OpenBSD Korn Shell")
677 (description
678 "Oksh is a port of the OpenBSD Korn Shell.
679The OpenBSD Korn Shell is a cleaned up and enhanced ksh.")
680 (license gpl3+)))
681
cc5a76a7 682(define-public loksh
683 (package
684 (name "loksh")
3ed134c4 685 (version "6.6")
cc5a76a7 686 (source
687 (origin
e5d75770
TGR
688 (method git-fetch)
689 (uri (git-reference
690 (url "https://github.com/dimkr/loksh.git")
691 (commit version)))
692 (file-name (git-file-name name version))
cc5a76a7 693 (sha256
3ed134c4 694 (base32 "1a8s64n97ikvvi7ckirxnnjvcmhr3dd4rnqm2ivapyzb0wp42jk7"))))
cc5a76a7 695 (build-system gnu-build-system)
696 (inputs
716cd19a
TGR
697 `(("libbsd" ,libbsd)
698 ("ncurses" ,ncurses)))
cc5a76a7 699 (native-inputs
700 `(("pkg-config" ,pkg-config)))
701 (arguments
f437e39a 702 `(#:tests? #f ; no tests included
cc5a76a7 703 #:make-flags (list "CC=gcc" "HAVE_LIBBSD=1"
f437e39a
TGR
704 (string-append "PREFIX="
705 (assoc-ref %outputs "out")))
cc5a76a7 706 #:phases
707 (modify-phases %standard-phases
f437e39a 708 (delete 'configure)))) ; no configure script
cc5a76a7 709 (home-page "https://github.com/dimkr/loksh")
710 (synopsis "Korn Shell from OpenBSD")
711 (description
712 "loksh is a Linux port of OpenBSD's @command{ksh}. It is a small,
713interactive POSIX shell targeted at resource-constrained systems.")
714 ;; The file 'LEGAL' says it is the public domain, and the 2
715 ;; exceptions which are listed are not included in this port.
716 (license public-domain)))
0daa1d64
AI
717
718(define-public mksh
719 (package
720 (name "mksh")
e7dfbae8 721 (version "57")
0daa1d64
AI
722 (source
723 (origin
724 (method url-fetch)
725 (uri (string-append "https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R"
726 version ".tgz"))
727 (sha256
e7dfbae8 728 (base32 "0xdykm1z710wriwd6nc8s8lwk2dwjl63dq96xxaawlid31a1241x"))))
0daa1d64
AI
729 (build-system gnu-build-system)
730 (arguments
e7dfbae8 731 `(#:tests? #f ; tests require access to /dev/tty
0daa1d64
AI
732 #:phases
733 (modify-phases %standard-phases
734 (delete 'configure)
735 (replace 'build
736 (lambda _
737 (setenv "CC" "gcc")
2385ecb2 738 (invoke (which "sh") "Build.sh")))
0daa1d64
AI
739 (replace 'install
740 (lambda* (#:key outputs #:allow-other-keys)
741 (let* ((out (assoc-ref outputs "out"))
742 (bin (string-append out "/bin"))
743 (man (string-append out "/share/man/man1")))
744 (install-file "mksh" bin)
745 (with-directory-excursion bin
746 (symlink "mksh" "ksh"))
2385ecb2
TGR
747 (install-file "mksh.1" man)
748 #t))))))
0daa1d64
AI
749 (home-page "https://www.mirbsd.org/mksh.htm")
750 (synopsis "Korn Shell from MirBSD")
751 (description "mksh is an actively developed free implementation of the
752Korn Shell programming language and a successor to the Public Domain Korn
753Shell (pdksh).")
754 (license (list miros
e7dfbae8 755 isc)))) ; strlcpy.c
18d9d22a
LF
756
757(define-public oil-shell
758 (package
759 (name "oil-shell")
7284b11f 760 (version "0.6.0")
18d9d22a
LF
761 (source (origin
762 (method url-fetch)
763 (uri (string-append "https://www.oilshell.org/download/oil-"
764 version ".tar.xz"))
765 (sha256
766 (base32
7284b11f 767 "1dw4mgnlmaxlfygasfihgvbj32d3m9w6k5j7azb9d9lp35f3l7hl"))))
18d9d22a
LF
768 (build-system gnu-build-system)
769 (arguments
770 '(#:tests? #f ; the tests are not distributed in the tarballs
771 #:strip-binaries? #f ; the binaries cannot be stripped
772 #:phases
773 (modify-phases %standard-phases
774 (add-after 'unpack 'patch-compiler-invocation
775 (lambda _
776 (substitute* "configure"
777 ((" cc ") " gcc "))
778 #t))
779 (replace 'configure
780 (lambda* (#:key outputs #:allow-other-keys)
781 (let ((out (assoc-ref outputs "out")))
782 (setenv "CC" "gcc")
783 ;; The configure script doesn't recognize CONFIG_SHELL.
784 (setenv "CONFIG_SHELL" (which "sh"))
785 (invoke "./configure" (string-append "--prefix=" out)
786 "--with-readline"))))
787 (add-before 'install 'make-destination
788 (lambda _
789 ;; The build scripts don't create the destination directory.
790 (mkdir-p (string-append (assoc-ref %outputs "out") "/bin")))))))
791 (inputs
792 `(("readline" ,readline)))
793 (synopsis "Bash-compatible Unix shell")
794 (description "Oil is a Unix / POSIX shell, compatible with Bash. It
795implements the Oil language, which is a new shell language to which Bash can be
796automatically translated. The Oil language is a superset of Bash. It also
797implements the OSH language, a statically-parseable language based on Bash as it
798is commonly written.")
799 (home-page "https://www.oilshell.org/")
800 (license (list psfl ; The Oil sources include a patched Python 2 source tree
801 asl2.0))))
2ccc9d69
TS
802
803(define-public gash
804 (package
805 (name "gash")
d0a26d0b 806 (version "0.2.0")
2ccc9d69
TS
807 (source
808 (origin (method url-fetch)
809 (uri (string-append "mirror://savannah/gash/gash-"
810 version ".tar.gz"))
811 (sha256
812 (base32
d0a26d0b
JN
813 "13m0yz5h9nj3x40mr6wr5xcpq1lscndfwcicw3skrz801025hhgf"))
814 (modules '((guix build utils)))))
2ccc9d69
TS
815 (build-system gnu-build-system)
816 (native-inputs
817 `(("pkg-config" ,pkg-config)))
818 (inputs
819 `(("guile" ,guile-2.2)))
d0a26d0b
JN
820 (arguments
821 '(#:make-flags '("XFAIL_TESTS=tests/redirects.org")))
2ccc9d69
TS
822 (home-page "https://savannah.nongnu.org/projects/gash/")
823 (synopsis "POSIX-compatible shell written in Guile Scheme")
824 (description "Gash is a POSIX-compatible shell written in Guile
825Scheme. It provides both the shell interface, as well as a Guile
826library for parsing shell scripts. Gash is designed to bootstrap Bash
827as part of the Guix bootstrap process.")
828 (license gpl3+)))