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