shells.scm 32 KB

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