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