projects/guix·blob bootstrap-team · refs

1100 lines · 46.1 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013 Cyril Roelandt <[email protected]>
3;;; Copyright © 2013, 2016 Ludovic Courtès <[email protected]>
4;;; Copyright © 2014, 2015 David Thompson <[email protected]>
5;;; Copyright © 2014 Kevin Lemonnier <[email protected]>
6;;; Copyright © 2015 Jeff Mickey <[email protected]>
7;;; Copyright © 2016–2021 Tobias Geerinckx-Rice <[email protected]>
8;;; Copyright © 2016 Stefan Reichör <[email protected]>
9;;; Copyright © 2017, 2018 Ricardo Wurmus <[email protected]>
10;;; Copyright © 2017, 2018 Nikita <[email protected]>
11;;; Copyright © 2017, 2018 Leo Famulari <[email protected]>
12;;; Copyright © 2017, 2021 Arun Isaac <[email protected]>
13;;; Copyright © 2019 Meiyo Peng <[email protected]>
14;;; Copyright © 2019 Timothy Sample <[email protected]>
15;;; Copyright © 2019 Mathieu Othacehe <[email protected]>
16;;; Copyright © 2019, 2020, 2023, 2025 Janneke Nieuwenhuizen <[email protected]>
17;;; Copyright © 2020 Brice Waegeneire <[email protected]>
18;;; Copyright © 2020 Ryan Prior <[email protected]>
19;;; Copyright © 2020, 2022, 2024 Efraim Flashner <[email protected]>
20;;; Copyright © 2020, 2022 Marius Bakke <[email protected]>
21;;; Copyright © 2021, 2022 Nicolas Goaziou <[email protected]>
22;;; Copyright © 2021, 2022 Felix Gruber <[email protected]>
23;;; Copyright © 2022 Andrew Tropin <[email protected]>
24;;; Copyright © 2023 Zheng Junjie <[email protected]>
25;;; Copyright © 2023 David Pflug <[email protected]>
26;;; Copyright © 2023 Jaeme Sifat <[email protected]>
27;;; Copyright © 2024 Tanguy Le Carrour <[email protected]>
28;;; Copyright © 2024 Vinicius Monego <[email protected]>
29;;; Copyright © 2024 Luís Henriques <[email protected]>
30;;; Copyright © 2024 Giacomo Leidi <[email protected]>
31;;;
32;;; This file is part of GNU Guix.
33;;;
34;;; GNU Guix is free software; you can redistribute it and/or modify it
35;;; under the terms of the GNU General Public License as published by
36;;; the Free Software Foundation; either version 3 of the License, or (at
37;;; your option) any later version.
38;;;
39;;; GNU Guix is distributed in the hope that it will be useful, but
40;;; WITHOUT ANY WARRANTY; without even the implied warranty of
41;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
42;;; GNU General Public License for more details.
43;;;
44;;; You should have received a copy of the GNU General Public License
45;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
46
47(define-module (gnu packages shells)
48 #:use-module (gnu packages)
49 #:use-module (gnu packages autotools)
50 #:use-module (gnu packages base)
51 #:use-module (gnu packages bash)
52 #:use-module (gnu packages bison)
53 #:use-module (gnu packages check)
54 #:use-module (gnu packages cmake)
55 #:use-module (gnu packages compression)
56 #:use-module (gnu packages crypto)
57 #:use-module (gnu packages curl)
58 #:use-module (gnu packages documentation)
59 #:use-module (gnu packages groff)
60 #:use-module (gnu packages guile)
61 #:use-module (gnu packages libbsd)
62 #:use-module (gnu packages libedit)
63 #:use-module (gnu packages linux)
64 #:use-module (gnu packages ncurses)
65 #:use-module (gnu packages pcre)
66 #:use-module (gnu packages perl)
67 #:use-module (gnu packages pkg-config)
68 #:use-module (gnu packages python)
69 #:use-module (gnu packages python-build)
70 #:use-module (gnu packages python-check)
71 #:use-module (gnu packages python-web)
72 #:use-module (gnu packages python-xyz)
73 #:use-module (gnu packages readline)
74 #:use-module (gnu packages rust)
75 #:use-module (gnu packages scheme)
76 #:use-module (gnu packages terminals)
77 #:use-module (gnu packages version-control)
78 #:use-module (gnu packages xdisorg)
79 #:use-module (gnu packages xorg)
80 #:use-module (gnu packages texinfo)
81 #:use-module (guix build-system cargo)
82 #:use-module (guix build-system cmake)
83 #:use-module (guix build-system gnu)
84 #:use-module (guix build-system meson)
85 #:use-module (guix build-system pyproject)
86 #:use-module (guix build-system python)
87 #:use-module (guix build-system trivial)
88 #:use-module (guix download)
89 #:use-module (guix git-download)
90 #:use-module (guix gexp)
91 #:use-module ((guix licenses) #:prefix license:)
92 #:use-module (guix packages)
93 #:use-module (guix utils))
94
95(define-public dash
96 (package
97 (name "dash")
98 (version "0.5.12")
99 (source
100 (origin
101 (method url-fetch)
102 (uri (string-append "http://gondor.apana.org.au/~herbert/dash/files/"
103 "dash-" version ".tar.gz"))
104 (sha256
105 (base32 "12pjm2j0q0q88nvqbcyqjwr8s1c29ilxyq2cdj8k42wbdv24liva"))
106 (modules '((guix build utils)))
107 (snippet
108 '(begin
109 ;; The man page hails from BSD, where (d)ash is the default shell.
110 ;; This isn't the case on Guix or indeed most other GNU systems.
111 (substitute* "src/dash.1"
112 (("the standard command interpreter for the system")
113 "a command interpreter based on the original Bourne shell"))))))
114 (build-system gnu-build-system)
115 (inputs
116 (list libedit))
117 (arguments
118 '(#:configure-flags '("--with-libedit")))
119 (home-page "http://gondor.apana.org.au/~herbert/dash")
120 (synopsis "POSIX-compliant shell optimised for size")
121 (description
122 "Dash is a POSIX-compliant @command{/bin/sh} implementation that aims to be
123as small as possible, often without sacrificing speed. It is faster than the
124GNU Bourne-Again Shell (@command{bash}) at most scripted tasks. Dash is a
125direct descendant of NetBSD's Almquist Shell (@command{ash}).")
126 (license (list license:bsd-3
127 license:gpl2+)) ; mksignames.c
128 (properties '((lint-hidden-cpe-vendors . ("plotly"))))))
129
130(define-public fish
131 (package
132 (name "fish")
133 (version "4.0.1")
134 (source
135 (origin
136 (method url-fetch)
137 (uri (string-append "https://github.com/fish-shell/fish-shell/"
138 "releases/download/" version "/"
139 "fish-" version ".tar.xz"))
140 (sha256
141 (base32 "1db2qxlls9f8n6sjcj4dz7j22113nhfz5i8zy9ff30vj41q3mmjf"))
142 ;; TODO: Unbundle corrosion.
143 (patches (search-patches "corrosion-honor-CARGO_BUILD_TARGET.patch"))))
144 (build-system cmake-build-system)
145 (inputs
146 (cons* fish-foreign-env
147 ncurses
148 pcre2
149 python ;for fish_config and manpage completions
150 (cargo-inputs 'fish)))
151 (native-inputs
152 (append
153 (list doxygen
154 groff ;for 'fish --help'
155 pkg-config
156 procps ;for the test suite
157 rust
158 `(,rust "cargo"))
159 (or (and=> (%current-target-system)
160 (compose list make-rust-sysroot))
161 '())))
162 (arguments
163 (list
164 #:out-of-source? #f
165 #:imported-modules
166 (append %cargo-build-system-modules
167 %cmake-build-system-modules)
168 #:modules
169 '(((guix build cargo-build-system) #:prefix cargo:)
170 (guix build cmake-build-system)
171 ((guix build gnu-build-system) #:prefix gnu:)
172 (guix build utils))
173 #:phases
174 (with-extensions (list (cargo-guile-json))
175 #~(modify-phases %standard-phases
176 (add-after 'unpack 'use-guix-vendored-dependencies
177 (lambda _
178 (substitute* "Cargo.toml"
179 (("git.*tag.*,")
180 "version = \"*\","))))
181 (add-after 'unpack 'prepare-cargo-build-system
182 (lambda args
183 (for-each
184 (lambda (phase)
185 (format #t "Running cargo phase: ~a~%" phase)
186 (apply (assoc-ref cargo:%standard-phases phase)
187 #:cargo-target #$(cargo-triplet)
188 args))
189 '(unpack-rust-crates
190 configure
191 check-for-pregenerated-files
192 patch-cargo-checksums))))
193 (add-after 'unpack 'set-env
194 (lambda _
195 ;; some tests write to $HOME
196 (setenv "HOME" (getcwd))
197 #t))
198 (add-after 'unpack 'patch-tests
199 (lambda* (#:key inputs native-inputs #:allow-other-keys)
200 (let ((coreutils (assoc-ref (or native-inputs inputs) "coreutils"))
201 (bash (assoc-ref (or native-inputs inputs) "bash")))
202 ;; This test sporadically fails in the build container
203 ;; because of leftover zombie processes, which are not
204 ;; reaped automatically:
205;; "Found existing zombie processes. Clean up zombies before running this test."
206 ;; Disabling parallel tests does not reliably prevent it.
207 (delete-file "tests/checks/jobs.fish")
208 ;; This test fails.
209 (delete-file "tests/checks/pipeline-pgroup.fish")
210 ;; This one tries to open a terminal & can't simply be deleted.
211 (substitute* "cmake/Tests.cmake"
212 ((".* interactive\\.fish.*") ""))
213 ;; This one needs to chdir successfully.
214 (substitute* "tests/checks/vars_as_commands.fish"
215 (("/usr/bin") "/tmp"))
216 ;; These contain absolute path references.
217 (substitute* '("src/builtins/tests/test_tests.rs"
218 "src/tests/highlight.rs")
219 (("/bin/echo" echo) (string-append coreutils echo))
220 (("/bin/ca" ca) (string-append coreutils ca))
221 (("\"(/bin/c)\"" _ c) (string-append "\"" coreutils c "\""))
222 (("/bin/ls_not_a_path" ls-not-a-path)
223 (string-append coreutils ls-not-a-path))
224 (("/bin/ls" ls) (string-append coreutils ls))
225 (("(/bin/)\"" _ bin) (string-append coreutils bin "\""))
226 (("/bin\", \"-" bin) (string-append coreutils bin))
227 ;; Not all mentions of /usr... need to exist, but these do.
228 (("\"/usr(|/lib)\"" _ subdirectory)
229 (string-append "\"/tmp" subdirectory "\"")))
230 (substitute* (find-files "tests")
231 (("/bin/pwd" pwd) (string-append coreutils pwd))
232 (("/bin/echo" echo) (string-append coreutils echo))
233 (("/bin/sh" sh) (string-append bash sh))
234 (("/bin/ls" ls) (string-append coreutils ls))
235 (("/test/root/bin") "")))))
236 ;; Source /etc/fish/config.fish from $__fish_sysconf_dir/config.fish.
237 (add-after 'patch-tests 'patch-fish-config
238 (lambda _
239 (let ((port (open-file "etc/config.fish" "a")))
240 (display (string-append
241 "\n\n"
242 "# Patched by Guix.\n"
243 "# Source /etc/fish/config.fish.\n"
244 "if test -f /etc/fish/config.fish\n"
245 " source /etc/fish/config.fish\n"
246 "end\n")
247 port)
248 (close-port port))
249 #t))
250 ;; Embed absolute paths.
251 (add-before 'install 'embed-absolute-paths
252 (lambda* (#:key inputs #:allow-other-keys)
253 (substitute* "share/functions/__fish_print_help.fish"
254 (("nroff") (search-input-file inputs "bin/nroff")))))
255 ;; Enable completions, functions and configurations in user's and
256 ;; system's guix profiles by adding them to __extra_* variables.
257 (add-before 'install 'patch-fish-extra-paths
258 (lambda _
259 (let ((port (open-file "share/__fish_build_paths.fish" "a")))
260 (display
261 (string-append
262 "\n\n"
263 "# Patched by Guix.\n"
264 "# Enable completions, functions and configurations in user's,"
265 " home's and system's guix profiles by adding them to __extra_*"
266 " variables.\n"
267 "set -l __guix_profile_paths ~/.guix-profile ~/.guix-home/profile"
268 " /run/current-system/profile\n"
269 "set __extra_completionsdir"
270 " $__guix_profile_paths\"/etc/fish/completions\""
271 " $__guix_profile_paths\"/share/fish/vendor_completions.d\""
272 " $__extra_completionsdir\n"
273 "set __extra_functionsdir"
274 " $__guix_profile_paths\"/etc/fish/functions\""
275 " $__guix_profile_paths\"/share/fish/vendor_functions.d\""
276 " $__extra_functionsdir\n"
277 "set __extra_confdir"
278 " $__guix_profile_paths\"/etc/fish/conf.d\""
279 " $__guix_profile_paths\"/share/fish/vendor_conf.d\""
280 " $__extra_confdir\n")
281 port)
282 (close-port port))
283 #t))
284 (replace 'check
285 (lambda* (#:rest args)
286 (apply (assoc-ref gnu:%standard-phases 'check)
287 #:test-target "test" args)))
288 ;; Use fish-foreign-env to source /etc/profile.
289 (add-before 'install 'source-etc-profile
290 (lambda* (#:key inputs #:allow-other-keys)
291 (let ((port (open-file "share/__fish_build_paths.fish" "a")))
292 (display
293 (string-append
294 "\n\n"
295 "# Patched by Guix.\n"
296 "# Use fish-foreign-env to source /etc/profile.\n"
297 "if status is-login\n"
298 " set fish_function_path "
299 (assoc-ref inputs "fish-foreign-env") "/share/fish/functions"
300 " $__fish_datadir/functions\n"
301 " fenv source /etc/profile\n"
302 " set -e fish_function_path\n"
303 "end\n")
304 port)
305 (close-port port))))))))
306 (synopsis "The friendly interactive shell")
307 (description
308 "Fish (friendly interactive shell) is a shell focused on interactive use,
309discoverability, and friendliness. Fish has very user-friendly and powerful
310tab-completion, including descriptions of every completion, completion of
311strings with wildcards, and many completions for specific commands. It also
312has extensive and discoverable help. A special @command{help} command gives
313access to all the fish documentation in your web browser. Other features
314include smart terminal handling based on terminfo, an easy to search history,
315and syntax highlighting.")
316 (home-page "https://fishshell.com/")
317 (license license:gpl2)))
318
319(define-public fish-foreign-env
320 (package
321 (name "fish-foreign-env")
322 (version "0.20230823")
323 (source
324 (origin
325 (method git-fetch)
326 (uri (git-reference
327 (url "https://github.com/oh-my-fish/plugin-foreign-env")
328 (commit "7f0cf099ae1e1e4ab38f46350ed6757d54471de7")))
329 (file-name (git-file-name name version))
330 (sha256
331 (base32 "0d16mdgjdwln41zk44qa5vcilmlia4w15r8z2rc3p49i5ankksg3"))))
332 (build-system trivial-build-system)
333 (arguments
334 '(#:modules ((guix build utils))
335 #:builder
336 (begin
337 (use-modules (guix build utils))
338 (let* ((source (assoc-ref %build-inputs "source"))
339 (out (assoc-ref %outputs "out"))
340 (func-path (string-append out "/share/fish/functions")))
341 (mkdir-p func-path)
342 (copy-recursively (string-append source "/functions")
343 func-path)
344
345 ;; Embed absolute paths.
346 (substitute* `(,(string-append func-path "/fenv.fish")
347 ,(string-append func-path "/fenv.main.fish"))
348 (("bash")
349 (search-input-file %build-inputs "/bin/bash"))
350 (("sed")
351 (search-input-file %build-inputs "/bin/sed"))
352 ((" tr ")
353 (string-append " "
354 (search-input-file %build-inputs "/bin/tr")
355 " ")))))))
356 (inputs
357 (list bash coreutils sed))
358 (home-page "https://github.com/oh-my-fish/plugin-foreign-env")
359 (synopsis "Foreign environment interface for fish shell")
360 (description "@code{fish-foreign-env} wraps bash script execution in a way
361that environment variables that are exported or modified get imported back
362into fish.")
363 (license license:expat)))
364
365(define-public rc
366 (package
367 (name "rc")
368 (version "1.7.4")
369 (source (origin
370 (method git-fetch)
371 (uri (git-reference
372 (url "https://github.com/rakitzis/rc")
373 (commit (string-append "v" version))))
374 (sha256
375 (base32
376 "0vj1h4pcg13vxsiydmmk87dr2sra9h4gwx0c4q6fjsiw4in78rrd"))
377 (file-name (git-file-name name version))))
378 (build-system gnu-build-system)
379 (arguments
380 `(#:configure-flags
381 '("--with-edit=gnu")
382 #:phases
383 (modify-phases %standard-phases
384 (add-before 'bootstrap 'patch-trip.rc
385 (lambda _
386 (substitute* "trip.rc"
387 (("/bin/pwd") (which "pwd"))
388 (("/bin/sh") (which "sh"))
389 (("/bin/rm") (which "rm"))
390 (("/bin\\)") (string-append (dirname (which "rm")) ")")))
391 #t)))))
392 (inputs (list readline perl))
393 (native-inputs (list autoconf automake libtool pkg-config))
394 (synopsis "Alternative implementation of the rc shell by Byron Rakitzis")
395 (description
396 "This is a reimplementation by Byron Rakitzis of the Plan 9 shell. It
397has a small feature set similar to a traditional Bourne shell.")
398 (home-page "https://github.com/rakitzis/rc")
399 (license license:zlib)))
400
401(define-public es
402 (package
403 (name "es")
404 (version "0.9.2")
405 (source
406 (origin
407 (method url-fetch/tarbomb)
408 (uri (string-append "https://github.com/wryun/es-shell/releases/"
409 "download/v" version "/es-" version ".tar.gz"))
410 (sha256
411 (base32 "1pgmqhsk14wyvl489sxdy7kdl2gwrsq1xvkip0z90kh888mlh9n9"))
412 (file-name (string-append name "-" version ".tar.gz"))))
413 (build-system gnu-build-system)
414 (arguments
415 (list #:test-target "test"))
416 (inputs
417 (list readline))
418 (native-inputs
419 (list bison))
420 (synopsis "Extensible shell with higher-order functions")
421 (description
422 "Es is an extensible shell. The language was derived from the Plan 9
423shell, rc, and was influenced by functional programming languages, such as
424Scheme, and the Tcl embeddable programming language. This implementation is
425derived from Byron Rakitzis's public domain implementation of rc, and was
426written by Paul Haahr and Byron Rakitzis.")
427 (home-page "https://wryun.github.io/es-shell/")
428 (license license:public-domain)))
429
430(define-public rush
431 (package
432 (name "rush")
433 (version "2.4")
434 (source (origin
435 (method url-fetch)
436 (uri (string-append "mirror://gnu/rush/rush-"
437 version ".tar.gz"))
438 (sha256
439 (base32
440 "1nqjjbamdn4lcysc2hji3i73jjl1ghivb24h12zh79xnka438vr6"))))
441 (build-system gnu-build-system)
442 (home-page "https://www.gnu.org/software/rush/")
443 (synopsis "Restricted user (login) shell")
444 (description
445 "GNU Rush is a restricted user shell, for systems on which users are to
446be provided with only limited functionality or resources. Administrators set
447user rights via a configuration file which can be used to limit, for example,
448the commands that can be executed, CPU time, or virtual memory usage.")
449 (license license:gpl3+)))
450
451(define-public tcsh
452 (package
453 (name "tcsh")
454 (version "6.24.15")
455 (source (origin
456 (method url-fetch)
457 ;; Old tarballs are moved to old/.
458 (uri (list (string-append "https://astron.com/pub/tcsh/"
459 "tcsh-" version ".tar.gz")
460 (string-append "https://astron.com/pub/tcsh/"
461 "old/tcsh-" version ".tar.gz")))
462 (sha256
463 (base32
464 "1z931m79hd7zp066s57mcifzig3byfg3ak7432jmf3rjvyjb5l6l"))
465 (patches (search-patches "tcsh-fix-autotest.patch"))
466 (patch-flags '("-p0"))))
467 (build-system gnu-build-system)
468 (native-inputs
469 (append (if (target-riscv64?)
470 (list config)
471 '())
472 (list autoconf perl)))
473 (inputs
474 (list libxcrypt ncurses))
475 (arguments
476 (list
477 #:phases
478 #~(modify-phases %standard-phases
479 #$@(if (%current-target-system)
480 #~((add-before 'configure 'set-cross-cc
481 (lambda _
482 (substitute* "configure"
483 (("CC_FOR_GETHOST=\"cc\"")
484 "CC_FOR_GETHOST=\"gcc\"")))))
485 #~())
486 #$@(if (system-hurd?)
487 #~((add-after 'unpack 'skip-tests
488 (lambda _
489 (substitute* "tests/testsuite.at"
490 (("m4_include\\(\\[subst.at\\]\\)" all)
491 (string-append "# " all))))))
492 #~())
493 (add-before 'check 'patch-test-scripts
494 (lambda _
495 ;; Take care of pwd
496 (substitute* '("tests/commands.at" "tests/variables.at")
497 (("/bin/pwd") (which "pwd")))
498 (substitute* "Makefile"
499 ;; Likewise for /usr/bin/env.
500 (("/usr/bin/env") "env")
501 ;; Don't reset the environment (PATH, etc).
502 (("\\$\\(ENVCMD\\) -") "$(ENVCMD)"))
503 ;; This test does not expect the home directory from
504 ;; /etc/passwd to be '/'.
505 (substitute* "tests/subst.at"
506 (("\\$\\(id -un\\)/foo")
507 "$(id -un)//foo"))
508 ;; The .at files create shell scripts without shebangs. Erk.
509 (substitute* "tests/commands.at"
510 (("./output.sh") "/bin/sh output.sh"))
511 (substitute* "tests/syntax.at"
512 (("; other_script.csh") "; /bin/sh other_script.csh"))
513 ;; Now, let's generate the test suite and patch it
514 (invoke "make" "tests/testsuite")
515
516 ;; This file is ISO-8859-1 encoded.
517 (with-fluids ((%default-port-encoding #f))
518 (substitute* "tests/testsuite"
519 (("/bin/sh") (which "sh"))))))
520 (add-after 'install 'post-install
521 (lambda _
522 (with-directory-excursion (string-append #$output "/bin")
523 (symlink "tcsh" "csh")))))))
524 (home-page "https://www.tcsh.org/")
525 (synopsis "Unix shell based on csh")
526 (description
527 "Tcsh is an enhanced, but completely compatible version of the Berkeley
528UNIX C shell (csh). It is a command language interpreter usable both as an
529interactive login shell and a shell script command processor. It includes a
530command-line editor, programmable word completion, spelling correction, a
531history mechanism, job control and a C-like syntax.")
532 (license license:bsd-4)))
533
534(define-public zsh
535 (package
536 (name "zsh")
537 (version "5.9")
538 (source (origin
539 (method url-fetch)
540 (uri (list (string-append
541 "https://www.zsh.org/pub/zsh-" version
542 ".tar.xz")
543 (string-append
544 "https://www.zsh.org/pub/old/zsh-" version
545 ".tar.xz")))
546 (sha256
547 (base32
548 "1mdc8lnq8qxq1ahxp8610n799pd7a9kqg3liy7xq2pjvvp71x3cv"))
549 (patches (search-patches "zsh-egrep-failing-test.patch"))))
550 (build-system gnu-build-system)
551 (arguments `(#:configure-flags
552 `(,(string-append "CFLAGS=-g -O2"
553 " -Wno-error=implicit-function-declaration"
554 " -Wno-error=implicit-int"
555 " -Wno-error=incompatible-pointer-types"
556 " -Wno-error=int-conversion")
557 "--with-tcsetpgrp"
558 "--enable-pcre"
559 "--enable-maildir-support"
560 ;; share/zsh/site-functions isn't populated
561 "--disable-site-fndir"
562 ,(string-append
563 "--enable-additional-fpath="
564 "/usr/local/share/zsh/site-functions," ; for foreign OS
565 "/run/current-system/profile/share/zsh/site-functions"))
566 #:phases
567 (modify-phases %standard-phases
568 (add-before 'configure 'fix-sh
569 (lambda _
570 ;; Some of the files are ISO-8859-1 encoded.
571 (with-fluids ((%default-port-encoding #f))
572 (substitute*
573 '("configure"
574 "configure.ac"
575 "Src/exec.c"
576 "Src/mkmakemod.sh"
577 "Config/installfns.sh"
578 "Config/defs.mk.in"
579 "Test/E01options.ztst"
580 "Test/A05execution.ztst"
581 "Test/A01grammar.ztst"
582 "Test/A06assign.ztst"
583 "Test/B02typeset.ztst"
584 "Completion/Unix/Command/_init_d"
585 "Util/preconfig")
586 (("/bin/sh") (which "sh"))))))
587 (add-before 'check 'patch-test
588 (lambda _
589 ;; In Zsh, `command -p` searches a predefined set of
590 ;; paths that don't exist in the build environment. See
591 ;; the assignment of 'path' in Src/init.c'
592 (substitute* "Test/A01grammar.ztst"
593 (("command -pv") "command -v")
594 (("command -p") "command ")
595 (("'command' -p") "'command' "))))
596 (add-after 'build 'make-info
597 (lambda _ (invoke "make" "info")))
598 (add-after 'build 'install-info
599 (lambda _ (invoke "make" "install.info"))))))
600 (native-inputs (list autoconf texinfo))
601 (inputs (list ncurses pcre perl))
602 (synopsis "Powerful shell for interactive use and scripting")
603 (description "The Z shell (zsh) is a Unix shell that can be used
604as an interactive login shell and as a powerful command interpreter
605for shell scripting. Zsh can be thought of as an extended Bourne shell
606with a large number of improvements, including some features of bash,
607ksh, and tcsh.")
608 (home-page "https://www.zsh.org/")
609
610 ;; The whole thing is under an MIT/X11-style license, but there's one
611 ;; command, 'Completion/Unix/Command/_darcs', which is under GPLv2+.
612 (license license:gpl2+)))
613
614(define-public xonsh
615 (package
616 (name "xonsh")
617 (version "0.19.9")
618 (source
619 (origin
620 (method url-fetch)
621 (uri (pypi-uri "xonsh" version))
622 (sha256
623 (base32
624 "0zf3fjjq0p9pngq48s8c14ywzv4b02y14vr9g93vgalqg96lrasc"))
625 (modules '((guix build utils)))
626 (snippet
627 #~(begin
628 (substitute* "pyproject.toml"
629 (("\"xonsh\\.parsers\\.ply\",") ""))
630 ;; Use our properly packaged PLY instead.
631 (substitute* (list "setup.py"
632 "tests/parsers/test_lexer.py"
633 "xonsh/parsers/base.py"
634 "xonsh/parsers/completion_context.py"
635 "xonsh/parsers/lexer.py"
636 "xonsh/parsers/v310.py"
637 "xonsh/xonfig.py")
638 (("from xonsh\\.parsers\\.ply") "from ply")
639 (("from xonsh\\.parsers import ply") "import ply"))
640 (delete-file-recursively "xonsh/parsers/ply")))))
641 (build-system pyproject-build-system)
642 (arguments
643 ;; Some tests are failing for reasons like not accessing parent directory
644 ;; with os.getcwd(), not activating virtual environments, not finding
645 ;; some commands (man, echo), and not running subprocesses.
646 (list #:test-flags
647 #~(list "-k"
648 (string-append
649 "not "
650 (string-join
651 (list "test_aliases_print"
652 "test_argv0"
653 "test_bash_and_is_alias_is_only_functional_alias"
654 "test_bash_completer"
655 "test_bash_completer_empty_prefix"
656 "test_callable_alias_no_bad_file_descriptor"
657 "test_complete_command"
658 "test_complete_dots"
659 "test_dirty_working_directory"
660 "test_equal_sign_arg"
661 "test_man_completion"
662 "test_parser_show"
663 "test_printfile"
664 "test_printname"
665 "test_ptk_prompt"
666 "test_quote_handling"
667 "test_script"
668 "test_shebang_cr"
669 "test_skipper_command"
670 "test_sourcefile"
671 "test_spec_decorator_alias_output_format"
672 "test_spec_modifier_alias_output_format"
673 "test_trace_in_script"
674 "test_vc_get_branch"
675 "test_xonsh_activator"
676 "test_xonsh_lexer")
677 " and not ")))
678 #:phases
679 #~(modify-phases %standard-phases
680 ;; Some tests run os.mkdir().
681 (add-before 'check 'writable-home
682 (lambda _
683 (setenv "HOME" "/tmp"))))))
684 (native-inputs
685 (list git-minimal
686 python-pip
687 python-pyte
688 python-pytest
689 python-pytest-mock
690 python-pytest-rerunfailures
691 python-pytest-subprocess
692 python-pytest-timeout
693 python-requests
694 python-setuptools))
695 (inputs
696 (list python-distro
697 python-ply
698 python-prompt-toolkit
699 python-pygments
700 python-pyperclip
701 python-setproctitle))
702 (home-page "https://xon.sh/")
703 (synopsis "Python-ish shell")
704 (description
705 "Xonsh is a Python-ish, BASHwards-looking shell language and command
706prompt. The language is a superset of Python 3.4+ with additional shell
707primitives that you are used to from Bash and IPython. It works on all major
708systems including Linux, Mac OSX, and Windows. Xonsh is meant for the daily
709use of experts and novices alike.")
710 (license license:bsd-2)))
711
712(define-public scsh
713 (let ((commit "4acf6e4ed7b65b46186ef0c9c2a1e10bef8dc052")
714 (revision "0"))
715 (package
716 (name "scsh")
717 (version (git-version "0.7" revision commit))
718 (source
719 (origin
720 (method git-fetch)
721 (uri (git-reference
722 (url "https://github.com/scheme/scsh")
723 (commit commit)))
724 (file-name (git-file-name name version))
725 (sha256
726 (base32
727 "1czrp808v5gs0ci5lmkp3wr3gfkrb3vd5b2iw2hz1bpqgaf6bxpv"))
728 (patches (search-patches "scsh-nonstring-search-path.patch"))))
729 (build-system gnu-build-system)
730 (arguments
731 (list
732 #:test-target "test"
733 #:phases
734 #~(modify-phases %standard-phases
735 (add-before 'configure 'replace-rx
736 (lambda _
737 (let ((rxpath (string-append #$scheme48-rx
738 "/share/scheme48-"
739 #$(package-version scheme48)
740 "/rx")))
741 (delete-file-recursively "rx")
742 (symlink rxpath "rx"))))
743 (add-after 'replace-rx 'patch-source
744 (lambda _
745 (substitute* "Makefile.in"
746 (("SCHEME48VERSION = 1.9.2")
747 (string-append "SCHEME48VERSION = " #$(package-version scheme48))))
748 (with-directory-excursion "c"
749 (substitute* "syscalls.c"
750 (("#include <stdlib.h>" all)
751 (string-append all "\n#include <time.h>")))
752 (substitute* "tty.c"
753 (("#include <termios.h>" all)
754 (string-append all "\n#include <pty.h>")))))))))
755 (inputs
756 (list scheme48 scheme48-rx))
757 (native-inputs
758 (list autoconf automake))
759 (native-search-paths
760 (list (search-path-specification
761 (variable "SCSH_LIB_DIRS")
762 (separator " ")
763 (files '("share/scsh-0.7")))))
764 (home-page "https://github.com/scheme/scsh")
765 (synopsis "Unix shell embedded in Scheme")
766 (description
767 "Scsh is a Unix shell embedded in Scheme. Scsh has two main
768components: a process notation for running programs and setting up pipelines
769and redirections, and a complete syscall library for low-level access to the
770operating system.")
771 (license license:bsd-3))))
772
773(define-public linenoise
774 (let ((commit "e26268de5e56bfaad773786471844578fe9f7f4b")
775 (revision "3"))
776 (package
777 (name "linenoise")
778 (version (string-append "1.0-" revision "." (string-take commit 7)))
779 (source
780 (origin
781 (method git-fetch)
782 (uri (git-reference
783 (url "https://github.com/antirez/linenoise")
784 (commit commit)))
785 (file-name (string-append name "-" version "-checkout"))
786 (sha256
787 (base32
788 "1pwil7pv6zqmy5l0r0hcr5gw25d8vrlh2sc9n5bv8vj3abg64zqs"))))
789 (build-system gnu-build-system)
790 (arguments
791 `(#:tests? #f ; no tests are included
792 #:make-flags
793 (list ,(string-append "CC=" (cc-for-target)))
794 #:phases
795 (modify-phases %standard-phases
796 (delete 'configure)
797 (replace 'install
798 (lambda* (#:key outputs #:allow-other-keys)
799 ;; At the moment there is no 'make install' in upstream.
800 (let* ((out (assoc-ref outputs "out")))
801 (install-file "linenoise.h"
802 (string-append out "/include/linenoise"))
803 (install-file "linenoise.c"
804 (string-append out "/include/linenoise"))
805 #t))))))
806 (home-page "https://github.com/antirez/linenoise")
807 (synopsis "Minimal zero-config readline replacement")
808 (description
809 "Linenoise is a minimal, zero-config, readline replacement.
810Its features include:
811
812@enumerate
813@item Single and multi line editing mode with the usual key bindings
814@item History handling
815@item Completion
816@item Hints (suggestions at the right of the prompt as you type)
817@item A subset of VT100 escapes, ANSI.SYS compatible
818@end enumerate\n")
819 (license license:bsd-2))))
820
821(define-public s-shell
822 (let ((commit "da2e5c20c0c5f477ec3426dc2584889a789b1659")
823 (revision "2"))
824 (package
825 (name "s-shell")
826 (version (git-version "0.0.0" revision commit))
827 (source
828 (origin
829 (method git-fetch)
830 (uri (git-reference
831 (url "https://github.com/rain-1/s")
832 (commit commit)))
833 (file-name (string-append name "-" version "-checkout"))
834 (sha256
835 (base32
836 "0qiny71ww5nhzy4mnc8652hn0mlxyb67h333gbdxp4j4qxsi13q4"))))
837 (build-system gnu-build-system)
838 (inputs
839 (list linenoise))
840 (arguments
841 `(#:tests? #f
842 #:make-flags (list "CC=gcc"
843 (string-append "PREFIX="
844 (assoc-ref %outputs "out")))
845 #:phases
846 (modify-phases %standard-phases
847 (add-after 'unpack 'install-directory-fix
848 (lambda* (#:key outputs #:allow-other-keys)
849 (let* ((out (assoc-ref outputs "out"))
850 (bin (string-append out "/bin")))
851 (substitute* "Makefile"
852 (("out") bin))
853 #t)))
854 (add-after 'install 'manpage
855 (lambda* (#:key outputs #:allow-other-keys)
856 (install-file "s.1" (string-append (assoc-ref outputs "out")
857 "/share/man/man1"))))
858 (replace 'configure
859 (lambda* (#:key inputs outputs #:allow-other-keys)
860 ;; At this point linenoise is meant to be included,
861 ;; so we have to really copy it into the working directory
862 ;; of s.
863 (let* ((linenoise (assoc-ref inputs "linenoise"))
864 (noisepath (string-append linenoise "/include/linenoise"))
865 (out (assoc-ref outputs "out")))
866 (copy-recursively noisepath "linenoise")
867 (substitute* "s.c"
868 (("/bin/s") (string-append out "/bin/s")))
869 #t))))))
870 (home-page "https://github.com/rain-1/s")
871 (synopsis "Extremely minimal shell with the simplest syntax possible")
872 (description
873 "S is a new shell that aims to be extremely simple. It does not
874implement the POSIX shell standard.
875
876There are no globs or \"splatting\" where a variable $FOO turns into multiple
877command line arguments. One token stays one token forever.
878This is a \"no surprises\" straightforward approach.
879
880There are no redirection operators > in the shell language, they are added as
881extra programs. > is just another unix command, < is essentially cat(1).
882A @code{andglob} program is also provided along with s.")
883 (license license:bsd-3))))
884
885(define-public oksh
886 (package
887 (name "oksh")
888 (version "7.5")
889 (source
890 (origin
891 (method url-fetch)
892 (uri (string-append
893 "https://github.com/ibara/oksh/releases/download/oksh-"
894 version "/oksh-" version ".tar.gz"))
895 (sha256
896 (base32
897 "0pgdxvy8jgydsyzk7vcc93pm09bihqvrn3i35gz1ncg9z31rbf20"))))
898 (build-system gnu-build-system)
899 (arguments
900 `(#:tests? #f ; there are no tests available
901 #:license-file-regexp "LEGAL"))
902 (home-page "https://github.com/ibara/oksh")
903 (synopsis "Portable OpenBSD Korn Shell")
904 (description
905 "Oksh is a portable OpenBSD ksh. Not an official OpenBSD project.
906Unlike other ports of OpenBSD ksh, this port is entirely self-contained
907and aims to be maximally portable across operating systems and C compilers.")
908 (license (list license:public-domain
909 ;; asprintf.c, issetugid.c, reallocarray.c, sh.1,
910 ;; strlcat.c, strlcpy.c, strtonum.c
911 license:isc
912 ;; confstr.c, siglist.c, signame.c, sys-queue.h, unvis.c,
913 ;; vis.c, vis.h
914 license:bsd-3))))
915
916(define-public loksh
917 (package
918 (name "loksh")
919 (version "7.8")
920 (source (origin
921 (method git-fetch)
922 (uri (git-reference
923 (url "https://github.com/dimkr/loksh")
924 (commit version)
925 ;; Include the ‘lolibc’ submodule, a static compatibility library
926 ;; created for and currently used only by loksh.
927 (recursive? #t)))
928 (file-name (git-file-name name version))
929 (sha256
930 (base32
931 "1x5kg01r0k7g825ia71f8an6585azba8x5khwdvq4dmnib11vakm"))))
932 (build-system meson-build-system)
933 (inputs (list ncurses))
934 (native-inputs (list pkg-config))
935 (arguments
936 `(#:tests? #f)) ;no tests included
937 (home-page "https://github.com/dimkr/loksh")
938 (synopsis "Korn Shell from OpenBSD")
939 (description
940 "loksh is a Linux port of OpenBSD's @command{ksh}. It is a small,
941interactive POSIX shell targeted at resource-constrained systems.")
942 ;; The file 'LEGAL' says it is the public domain, and the 2
943 ;; exceptions which are listed are not included in this port.
944 (license license:public-domain)))
945
946(define-public mksh
947 (package
948 (name "mksh")
949 (version "59c")
950 (source
951 (origin
952 (method url-fetch)
953 (uri (string-append "https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R"
954 version ".tgz"))
955 (sha256
956 (base32 "01n5ggw33bw4jv4d3148wlw9n4aj7vdn3ffnc66c9w9pldjidbkp"))))
957 (build-system gnu-build-system)
958 (arguments
959 `(#:tests? #f ; tests require access to /dev/tty
960 #:phases
961 (modify-phases %standard-phases
962 (delete 'configure)
963 (replace 'build
964 (lambda _
965 (setenv "CC" "gcc")
966 (invoke (which "sh") "Build.sh")))
967 (replace 'install
968 (lambda* (#:key outputs #:allow-other-keys)
969 (let* ((out (assoc-ref outputs "out"))
970 (bin (string-append out "/bin"))
971 (man (string-append out "/share/man/man1")))
972 (install-file "mksh" bin)
973 (with-directory-excursion bin
974 (symlink "mksh" "ksh"))
975 (install-file "mksh.1" man)))))))
976 (home-page "https://www.mirbsd.org/mksh.htm")
977 (synopsis "Korn Shell from MirBSD")
978 (description "mksh is an actively developed free implementation of the
979Korn Shell programming language and a successor to the Public Domain Korn
980Shell (pdksh).")
981 (license (list license:miros
982 license:isc)))) ; strlcpy.c
983
984(define-public oils
985 (package
986 (name "oils")
987 (version "0.22.0")
988 (source
989 (origin
990 (method url-fetch)
991 (uri (string-append "https://www.oilshell.org/download/oils-for-unix-"
992 version ".tar.gz"))
993 (sha256
994 (base32 "0pylgbxbnp683g51lcbmmd0y149jm7q7vh8g67yviagsa7clmmks"))))
995 (build-system gnu-build-system)
996 (arguments
997 (list #:phases
998 #~(modify-phases %standard-phases
999 (replace 'configure
1000 (lambda _
1001 (setenv "CC" #$(cc-for-target))
1002 (substitute* "configure"
1003 ((" cc ") " $CC "))
1004 (invoke "./configure" (string-append "--prefix=" #$output)
1005 "--with-readline")))
1006 (replace 'build
1007 (lambda _
1008 (invoke "_build/oils.sh")))
1009 (replace 'install
1010 (lambda _
1011 (setenv "PREFIX" #$output)
1012 (invoke "./install")))
1013 (replace 'check
1014 ;; The tests are not distributed in the tarballs but upstream
1015 ;; recommends running this smoke test.
1016 ;; https://github.com/oilshell/oil/blob/release/0.22.0/INSTALL.txt#L30-L50
1017 (lambda* (#:key tests? #:allow-other-keys)
1018 (when tests?
1019 (let ((osh "_bin/cxx-opt-sh/osh")
1020 (ysh "_bin/cxx-opt-sh/ysh"))
1021 (invoke/quiet osh "-c" "echo hi")
1022 (invoke/quiet osh "-n" "configure")
1023 (invoke/quiet ysh "-c" "echo hi")
1024 (invoke/quiet ysh "-c"
1025 "json write ({x: 42})"))))))))
1026 (inputs
1027 (list readline))
1028 (home-page "https://www.oilshell.org")
1029 (synopsis "Programming language and Bash-compatible Unix shell")
1030 (description "Oils is a programming language with automatic translation for
1031Bash. It includes OSH, a Unix/POSIX shell that runs unmodified Bash
1032scripts and YSH is a legacy-free shell, with structured data for Python and
1033JavaScript users who avoid shell.")
1034 (license (list license:asl2.0))))
1035
1036;; Since release 0.16.0 the former Oil project has been renamed to Oils:
1037;; <https://www.oilshell.org/blog/2023/03/rename.html>.
1038(define-deprecated-package oil
1039 oils)
1040
1041(define-public gash
1042 (package
1043 (name "gash")
1044 (version "0.3.1")
1045 (source
1046 ;; Use a copy built from the unofficial 'EBADF-fixes' branch,
1047 ;; <https://codeberg.org/civodul/gash/commit/7c9bf2110cfe85424fba0cd14445d5f0926c3fbd>.
1048 ;; See <https://issues.guix.gnu.org/75658>.
1049 (origin (method url-fetch)
1050 (uri (string-append "mirror://gnu/guix/mirror/gash-"
1051 version ".tar.gz"))
1052 (sha256
1053 (base32
1054 "069wizkfkkifij9n0r6fkwbgcnjyr6xvnjid11ckppx0waixc0s7"))))
1055 (build-system gnu-build-system)
1056 (native-inputs
1057 (list pkg-config))
1058 (inputs
1059 (list guile-3.0))
1060 (home-page "https://savannah.nongnu.org/projects/gash/")
1061 (synopsis "POSIX-compatible shell written in Guile Scheme")
1062 (description "Gash is a POSIX-compatible shell written in Guile
1063Scheme. It provides both the shell interface, as well as a Guile
1064library for parsing shell scripts. Gash is designed to bootstrap Bash
1065as part of the Guix bootstrap process.")
1066 (license license:gpl3+)))
1067
1068(define-public gash-utils
1069 (package
1070 (name "gash-utils")
1071 (version "0.2.0")
1072 (source (origin
1073 (method url-fetch)
1074 (uri (string-append "mirror://savannah/gash/gash-utils-"
1075 version ".tar.gz"))
1076 (sha256
1077 (base32
1078 "18ylb54l9lmaynapbncc1zhbsirhihznrxihhxgqrpqgyjkfbap6"))))
1079 (build-system gnu-build-system)
1080 (arguments
1081 (list
1082 #:phases #~(modify-phases %standard-phases
1083 (add-after 'unpack 'skip-failing-tests
1084 (lambda _
1085 (substitute* "Makefile.am"
1086 (("tests/sort\\.org") ""))
1087 (for-each delete-file '("configure" "Makefile.in")))))))
1088 (native-inputs
1089 (list autoconf automake pkg-config))
1090 (inputs
1091 (list guile-3.0 gash))
1092 (home-page "https://savannah.nongnu.org/projects/gash/")
1093 (synopsis "Core POSIX utilities written in Guile Scheme")
1094 (description "Gash-Utils provides Scheme implementations of many
1095common POSIX utilities (there are about 40 of them, ranging in
1096complexity from @command{false} to @command{awk}). The utilities are
1097designed to be capable of bootstrapping their standard GNU counterparts.
1098Underpinning these utilities are many Scheme interfaces for manipulating
1099files and text.")
1100 (license license:gpl3+)))