109baacc302cc06aa4b7781a2aca51922b5d69e3
[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 ;;; Copyright © 2020 Ryan Prior <rprior@protonmail.com>
18 ;;;
19 ;;; This file is part of GNU Guix.
20 ;;;
21 ;;; GNU Guix is free software; you can redistribute it and/or modify it
22 ;;; under the terms of the GNU General Public License as published by
23 ;;; the Free Software Foundation; either version 3 of the License, or (at
24 ;;; your option) any later version.
25 ;;;
26 ;;; GNU Guix is distributed in the hope that it will be useful, but
27 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
28 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 ;;; GNU General Public License for more details.
30 ;;;
31 ;;; You should have received a copy of the GNU General Public License
32 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
33
34 (define-module (gnu packages shells)
35 #:use-module (gnu packages)
36 #:use-module (gnu packages autotools)
37 #:use-module (gnu packages base)
38 #:use-module (gnu packages bash)
39 #:use-module (gnu packages bison)
40 #:use-module (gnu packages documentation)
41 #:use-module (gnu packages groff)
42 #:use-module (gnu packages guile)
43 #:use-module (gnu packages libbsd)
44 #:use-module (gnu packages libedit)
45 #:use-module (gnu packages linux)
46 #:use-module (gnu packages ncurses)
47 #:use-module (gnu packages pcre)
48 #:use-module (gnu packages perl)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages python-xyz)
52 #:use-module (gnu packages readline)
53 #:use-module (gnu packages scheme)
54 #:use-module (guix build-system cmake)
55 #:use-module (guix build-system gnu)
56 #:use-module (guix build-system python)
57 #:use-module (guix build-system trivial)
58 #:use-module (guix download)
59 #:use-module (guix git-download)
60 #:use-module (guix licenses)
61 #:use-module (guix packages)
62 #:use-module (guix utils))
63
64 (define-public dash
65 (package
66 (name "dash")
67 (version "0.5.11")
68 (source
69 (origin
70 (method url-fetch)
71 (uri (string-append "http://gondor.apana.org.au/~herbert/dash/files/"
72 "dash-" version ".tar.gz"))
73 (sha256
74 (base32 "1jwilfsy249d3q7fagg1ga4bgc2bg1fzw63r2nan0m77bznsdnad"))
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
445 `("--with-tcsetpgrp"
446 "--enable-pcre"
447 "--enable-maildir-support"
448 ;; share/zsh/site-functions isn't populated
449 "--disable-site-fndir"
450 ,(string-append
451 "--enable-additional-fpath="
452 "/usr/local/share/zsh/site-functions," ; for foreign OS
453 "/run/current-system/profile/share/zsh/site-functions"))
454 #:phases
455 (modify-phases %standard-phases
456 (add-before 'configure 'fix-sh
457 (lambda _
458 ;; Some of the files are ISO-8859-1 encoded.
459 (with-fluids ((%default-port-encoding #f))
460 (substitute*
461 '("configure"
462 "configure.ac"
463 "Src/exec.c"
464 "Src/mkmakemod.sh"
465 "Config/installfns.sh"
466 "Config/defs.mk.in"
467 "Test/E01options.ztst"
468 "Test/A05execution.ztst"
469 "Test/A01grammar.ztst"
470 "Test/A06assign.ztst"
471 "Test/B02typeset.ztst"
472 "Completion/Unix/Command/_init_d"
473 "Util/preconfig")
474 (("/bin/sh") (which "sh"))))))
475 (add-before 'check 'patch-test
476 (lambda _
477 ;; In Zsh, `command -p` searches a predefined set of
478 ;; paths that don't exist in the build environment. See
479 ;; the assignment of 'path' in Src/init.c'
480 (substitute* "Test/A01grammar.ztst"
481 (("command -pv") "command -v")
482 (("command -p") "command ")
483 (("'command' -p") "'command' "))
484 #t)))))
485 (native-inputs `(("autoconf" ,autoconf)))
486 (inputs `(("ncurses" ,ncurses)
487 ("pcre" ,pcre)
488 ("perl" ,perl)))
489 (synopsis "Powerful shell for interactive use and scripting")
490 (description "The Z shell (zsh) is a Unix shell that can be used
491 as an interactive login shell and as a powerful command interpreter
492 for shell scripting. Zsh can be thought of as an extended Bourne shell
493 with a large number of improvements, including some features of bash,
494 ksh, and tcsh.")
495 (home-page "https://www.zsh.org/")
496
497 ;; The whole thing is under an MIT/X11-style license, but there's one
498 ;; command, 'Completion/Unix/Command/_darcs', which is under GPLv2+.
499 (license gpl2+)))
500
501 (define-public xonsh
502 (package
503 (name "xonsh")
504 (version "0.9.18")
505 (source
506 (origin
507 (method url-fetch)
508 (uri (pypi-uri "xonsh" version))
509 (sha256
510 (base32
511 "1h4rrwzwiwkyi9p49sjn97rl39fqq2r23hchzsw0s3fcwa7m8fkj"))
512 (modules '((guix build utils)))
513 (snippet
514 `(begin
515 ;; Delete bundled PLY.
516 (delete-file-recursively "xonsh/ply")
517 (substitute* "setup.py"
518 (("\"xonsh\\.ply\\.ply\",") ""))
519 ;; Use our properly packaged PLY instead.
520 (substitute* (list "setup.py"
521 "tests/test_lexer.py"
522 "xonsh/__amalgam__.py"
523 "xonsh/lexer.py"
524 "xonsh/parsers/base.py"
525 "xonsh/xonfig.py")
526 (("from xonsh\\.ply\\.(.*) import" _ module)
527 (format #f "from ~a import" module))
528 (("from xonsh\\.ply import") "import"))
529 #t))))
530 (build-system python-build-system)
531 (arguments
532 '(;; TODO Try running run the test suite.
533 ;; See 'requirements-tests.txt' in the source distribution for more
534 ;; information.
535 #:tests? #f))
536 (inputs
537 `(("python-ply" ,python-ply)))
538 (home-page "https://xon.sh/")
539 (synopsis "Python-ish shell")
540 (description
541 "Xonsh is a Python-ish, BASHwards-looking shell language and command
542 prompt. The language is a superset of Python 3.4+ with additional shell
543 primitives that you are used to from Bash and IPython. It works on all major
544 systems including Linux, Mac OSX, and Windows. Xonsh is meant for the daily
545 use of experts and novices alike.")
546 (license bsd-2)))
547
548 (define-public scsh
549 (let ((commit "114432435e4eadd54334df6b37fcae505079b49f")
550 (revision "1"))
551 (package
552 (name "scsh")
553 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
554 (source
555 (origin
556 (method git-fetch)
557 (uri (git-reference
558 (url "https://github.com/scheme/scsh")
559 (commit commit)))
560 (file-name (string-append name "-" version "-checkout"))
561 (sha256
562 (base32
563 "1ghk08akiz7hff1pndi8rmgamgcrn2mv9asbss9l79d3c2iaav3q"))))
564 (build-system gnu-build-system)
565 (arguments
566 `(#:test-target "test"
567 #:phases
568 (modify-phases %standard-phases
569 (add-before 'configure 'replace-rx
570 (lambda* (#:key inputs #:allow-other-keys)
571 (let* ((rx (assoc-ref inputs "scheme48-rx"))
572 (rxpath (string-append rx "/share/scheme48-"
573 ,(package-version scheme48)
574 "/rx")))
575 (delete-file-recursively "rx")
576 (symlink rxpath "rx"))
577 #t)))))
578 (inputs
579 `(("scheme48" ,scheme48)
580 ("scheme48-rx" ,scheme48-rx)))
581 (native-inputs
582 `(("autoconf" ,autoconf)
583 ("automake" ,automake)))
584 (home-page "https://github.com/scheme/scsh")
585 (synopsis "Unix shell embedded in Scheme")
586 (description
587 "Scsh is a Unix shell embedded in Scheme. Scsh has two main
588 components: a process notation for running programs and setting up pipelines
589 and redirections, and a complete syscall library for low-level access to the
590 operating system.")
591 (license bsd-3))))
592
593 (define-public linenoise
594 (let ((commit "2105ce445821381cf1bca87b6d386d4ea88ee20d")
595 (revision "1"))
596 (package
597 (name "linenoise")
598 (version (string-append "1.0-" revision "." (string-take commit 7)))
599 (source
600 (origin
601 (method git-fetch)
602 (uri (git-reference
603 (url "https://github.com/antirez/linenoise")
604 (commit commit)))
605 (file-name (string-append name "-" version "-checkout"))
606 (sha256
607 (base32
608 "1z16qwix8z6a40fskdgxsibkqgdrp4q6ncp4n6hnv4r9iihy2d8r"))))
609 (build-system gnu-build-system)
610 (arguments
611 `(#:tests? #f ; no tests are included
612 #:make-flags
613 (list ,(string-append "CC=" (cc-for-target)))
614 #:phases
615 (modify-phases %standard-phases
616 (delete 'configure)
617 (replace 'install
618 (lambda* (#:key outputs #:allow-other-keys)
619 ;; At the moment there is no 'make install' in upstream.
620 (let* ((out (assoc-ref outputs "out")))
621 (install-file "linenoise.h"
622 (string-append out "/include/linenoise"))
623 (install-file "linenoise.c"
624 (string-append out "/include/linenoise"))
625 #t))))))
626 (home-page "https://github.com/antirez/linenoise")
627 (synopsis "Minimal zero-config readline replacement")
628 (description
629 "Linenoise is a minimal, zero-config, readline replacement.
630 Its features include:
631
632 @enumerate
633 @item Single and multi line editing mode with the usual key bindings
634 @item History handling
635 @item Completion
636 @item Hints (suggestions at the right of the prompt as you type)
637 @item A subset of VT100 escapes, ANSI.SYS compatible
638 @end enumerate\n")
639 (license bsd-2))))
640
641 (define-public s-shell
642 (let ((commit "da2e5c20c0c5f477ec3426dc2584889a789b1659")
643 (revision "2"))
644 (package
645 (name "s-shell")
646 (version (git-version "0.0.0" revision commit))
647 (source
648 (origin
649 (method git-fetch)
650 (uri (git-reference
651 (url "https://github.com/rain-1/s")
652 (commit commit)))
653 (file-name (string-append name "-" version "-checkout"))
654 (sha256
655 (base32
656 "0qiny71ww5nhzy4mnc8652hn0mlxyb67h333gbdxp4j4qxsi13q4"))))
657 (build-system gnu-build-system)
658 (inputs
659 `(("linenoise" ,linenoise)))
660 (arguments
661 `(#:tests? #f
662 #:make-flags (list "CC=gcc"
663 (string-append "PREFIX="
664 (assoc-ref %outputs "out")))
665 #:phases
666 (modify-phases %standard-phases
667 (add-after 'unpack 'install-directory-fix
668 (lambda* (#:key outputs #:allow-other-keys)
669 (let* ((out (assoc-ref outputs "out"))
670 (bin (string-append out "/bin")))
671 (substitute* "Makefile"
672 (("out") bin))
673 #t)))
674 (add-after 'install 'manpage
675 (lambda* (#:key outputs #:allow-other-keys)
676 (install-file "s.1" (string-append (assoc-ref outputs "out")
677 "/share/man/man1"))))
678 (replace 'configure
679 (lambda* (#:key inputs outputs #:allow-other-keys)
680 ;; At this point linenoise is meant to be included,
681 ;; so we have to really copy it into the working directory
682 ;; of s.
683 (let* ((linenoise (assoc-ref inputs "linenoise"))
684 (noisepath (string-append linenoise "/include/linenoise"))
685 (out (assoc-ref outputs "out")))
686 (copy-recursively noisepath "linenoise")
687 (substitute* "s.c"
688 (("/bin/s") (string-append out "/bin/s")))
689 #t))))))
690 (home-page "https://github.com/rain-1/s")
691 (synopsis "Extremely minimal shell with the simplest syntax possible")
692 (description
693 "S is a new shell that aims to be extremely simple.
694 S does not implemnt the POSIX shell standard.
695 There are no globs or \"splatting\" where a variable $FOO turns into multiple
696 command line arguments. One token stays one token forever.
697 This is a \"no surprises\" straightforward approach.
698
699 There are no redirection operators > in the shell language, they are added as
700 extra programs. > is just another unix command, < is essentially cat(1).
701 A @code{andglob} program is also provided along with s.")
702 (license bsd-3))))
703
704 (define-public oksh
705 (package
706 (name "oksh")
707 (version "0.5.9")
708 (source
709 (origin
710 (method url-fetch)
711 (uri (string-append "https://connochaetos.org/oksh/oksh-"
712 version ".tar.gz"))
713 (sha256
714 (base32
715 "0ln9yf6pxngsviqszv8klnnvn8vcpplvj1njdn8xr2y8frkbw8r3"))))
716 (build-system gnu-build-system)
717 (arguments
718 `(; The test files are not part of the distributed tarball.
719 #:tests? #f))
720 (home-page "https://connochaetos.org/oksh")
721 (synopsis "Port of OpenBSD Korn Shell")
722 (description
723 "Oksh is a port of the OpenBSD Korn Shell.
724 The OpenBSD Korn Shell is a cleaned up and enhanced ksh.")
725 (license gpl3+)))
726
727 (define-public loksh
728 (package
729 (name "loksh")
730 (version "6.6")
731 (source
732 (origin
733 (method git-fetch)
734 (uri (git-reference
735 (url "https://github.com/dimkr/loksh.git")
736 (commit version)))
737 (file-name (git-file-name name version))
738 (sha256
739 (base32 "1a8s64n97ikvvi7ckirxnnjvcmhr3dd4rnqm2ivapyzb0wp42jk7"))))
740 (build-system gnu-build-system)
741 (inputs
742 `(("libbsd" ,libbsd)
743 ("ncurses" ,ncurses)))
744 (native-inputs
745 `(("pkg-config" ,pkg-config)))
746 (arguments
747 `(#:tests? #f ; no tests included
748 #:make-flags (list "CC=gcc" "HAVE_LIBBSD=1"
749 (string-append "PREFIX="
750 (assoc-ref %outputs "out")))
751 #:phases
752 (modify-phases %standard-phases
753 (delete 'configure)))) ; no configure script
754 (home-page "https://github.com/dimkr/loksh")
755 (synopsis "Korn Shell from OpenBSD")
756 (description
757 "loksh is a Linux port of OpenBSD's @command{ksh}. It is a small,
758 interactive POSIX shell targeted at resource-constrained systems.")
759 ;; The file 'LEGAL' says it is the public domain, and the 2
760 ;; exceptions which are listed are not included in this port.
761 (license public-domain)))
762
763 (define-public mksh
764 (package
765 (name "mksh")
766 (version "58")
767 (source
768 (origin
769 (method url-fetch)
770 (uri (string-append "https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R"
771 version ".tgz"))
772 (sha256
773 (base32 "1337zjvzh14yncg9igdry904a3ns52l8rnm1kcq262w7f5xyp2v0"))))
774 (build-system gnu-build-system)
775 (arguments
776 `(#:tests? #f ; tests require access to /dev/tty
777 #:phases
778 (modify-phases %standard-phases
779 (delete 'configure)
780 (replace 'build
781 (lambda _
782 (setenv "CC" "gcc")
783 (invoke (which "sh") "Build.sh")))
784 (replace 'install
785 (lambda* (#:key outputs #:allow-other-keys)
786 (let* ((out (assoc-ref outputs "out"))
787 (bin (string-append out "/bin"))
788 (man (string-append out "/share/man/man1")))
789 (install-file "mksh" bin)
790 (with-directory-excursion bin
791 (symlink "mksh" "ksh"))
792 (install-file "mksh.1" man)
793 #t))))))
794 (home-page "https://www.mirbsd.org/mksh.htm")
795 (synopsis "Korn Shell from MirBSD")
796 (description "mksh is an actively developed free implementation of the
797 Korn Shell programming language and a successor to the Public Domain Korn
798 Shell (pdksh).")
799 (license (list miros
800 isc)))) ; strlcpy.c
801
802 (define-public oil
803 (package
804 (name "oil")
805 ;; https://www.oilshell.org/blog/2020/04/release-0.8.pre4.html#comment-on-version-numbering
806 (version "0.8.pre6")
807 (source
808 (origin
809 (method url-fetch)
810 (uri (string-append "https://www.oilshell.org/download/oil-"
811 version ".tar.gz"))
812 (sha256
813 (base32 "11nfwn5b1w74hv78065jg2zm45mqzi59381b0f649j7n3g7yp3iq"))))
814 (build-system gnu-build-system)
815 (arguments
816 `(#:strip-binaries? #f ; strip breaks the binary
817 #:phases
818 (modify-phases %standard-phases
819 (replace 'configure
820 (lambda* (#:key outputs #:allow-other-keys)
821 (let ((out (assoc-ref outputs "out")))
822 (setenv "CC" "gcc")
823 (substitute* "configure"
824 ((" cc ") " $CC "))
825 (invoke "./configure" (string-append "--prefix=" out)
826 "--with-readline"))))
827 (replace 'check
828 ;; The tests are not distributed in the tarballs but upstream
829 ;; recommends running this smoke test.
830 ;; https://github.com/oilshell/oil/blob/release/0.8.pre6/INSTALL.txt#L38-L48
831 (lambda _
832 (let* ((oil "_bin/oil.ovm"))
833 (invoke/quiet oil "osh" "-c" "echo hi")
834 (invoke/quiet oil "osh" "-n" "configure")))))))
835 (inputs
836 `(("readline" ,readline)))
837 (home-page "https://www.oilshell.org")
838 (synopsis "Programming language and Bash-compatible Unix shell")
839 (description "Oil is a programming language with automatic translation for
840 Bash. It includes osh, a Unix/POSIX shell that runs unmodified Bash
841 scripts.")
842 (license (list psfl ; tarball includes python2.7
843 asl2.0))))
844
845 (define-public oil-shell
846 (deprecated-package "oil-shell" oil))
847
848 (define-public gash
849 (package
850 (name "gash")
851 (version "0.2.0")
852 (source
853 (origin (method url-fetch)
854 (uri (string-append "mirror://savannah/gash/gash-"
855 version ".tar.gz"))
856 (sha256
857 (base32
858 "13m0yz5h9nj3x40mr6wr5xcpq1lscndfwcicw3skrz801025hhgf"))
859 (modules '((guix build utils)))))
860 (build-system gnu-build-system)
861 (native-inputs
862 `(("pkg-config" ,pkg-config)))
863 (inputs
864 `(("guile" ,guile-2.2)))
865 (arguments
866 '(#:make-flags '("XFAIL_TESTS=tests/redirects.org")))
867 (home-page "https://savannah.nongnu.org/projects/gash/")
868 (synopsis "POSIX-compatible shell written in Guile Scheme")
869 (description "Gash is a POSIX-compatible shell written in Guile
870 Scheme. It provides both the shell interface, as well as a Guile
871 library for parsing shell scripts. Gash is designed to bootstrap Bash
872 as part of the Guix bootstrap process.")
873 (license gpl3+)))
874
875 (define-public gash-utils
876 (package
877 (name "gash-utils")
878 (version "0.1.0")
879 (source (origin
880 (method url-fetch)
881 (uri (string-append "mirror://savannah/gash/gash-utils-"
882 version ".tar.gz"))
883 (sha256
884 (base32
885 "0ib2p52qmbac5n0s5bys4fiwim461ps546976l1n7pwbs0avh7fk"))))
886 (build-system gnu-build-system)
887 (native-inputs
888 `(("pkg-config" ,pkg-config)))
889 (inputs
890 `(("guile" ,guile-2.2)
891 ("gash" ,gash)))
892 (home-page "https://savannah.nongnu.org/projects/gash/")
893 (synopsis "Core POSIX utilities written in Guile Scheme")
894 (description "Gash-Utils provides Scheme implementations of many
895 common POSIX utilities (there are about 40 of them, ranging in
896 complexity from @command{false} to @command{awk}). The utilities are
897 designed to be capable of bootstrapping their standard GNU counterparts.
898 Underpinning these utilities are many Scheme interfaces for manipulating
899 files and text.")
900 (license gpl3+)))
901