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