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