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