gnu: calibre: Wrap QTWEBENGINEPROCESS_PATH.
[jackhill/guix/guix.git] / gnu / packages / shellutils.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 Matthew Jordan <matthewjordandevops@yandex.com>
3 ;;; Copyright © 2016, 2017 Alex Griffin <a@ajgrf.com>
4 ;;; Copyright © 2016 Christopher Baines <mail@cbaines.net>
5 ;;; Copyright © 2017 Stefan Reichör <stefan@xsteve.at>
6 ;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2018 Benjamin Slade <slade@jnanam.net>
8 ;;; Copyright © 2019 Collin J. Doering <collin@rekahsoft.ca>
9 ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
10 ;;;
11 ;;; This file is part of GNU Guix.
12 ;;;
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
17 ;;;
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
22 ;;;
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26 (define-module (gnu packages shellutils)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix utils)
29 #:use-module (guix packages)
30 #:use-module (guix download)
31 #:use-module (guix git-download)
32 #:use-module (guix build-system gnu)
33 #:use-module (guix build-system go)
34 #:use-module (guix build-system python)
35 #:use-module (gnu packages autotools)
36 #:use-module (gnu packages base)
37 #:use-module (gnu packages golang)
38 #:use-module (gnu packages ncurses)
39 #:use-module (gnu packages pkg-config)
40 #:use-module (gnu packages python)
41 #:use-module (gnu packages readline)
42 #:use-module (gnu packages ruby)
43 #:use-module (gnu packages shells)
44 #:use-module (gnu packages tmux))
45
46 (define-public zsh-autosuggestions
47 (package
48 (name "zsh-autosuggestions")
49 (version "0.6.4")
50 (source (origin
51 (method git-fetch)
52 (uri (git-reference
53 (url "https://github.com/zsh-users/zsh-autosuggestions")
54 (commit (string-append "v" version))))
55 (file-name (git-file-name name version))
56 (sha256
57 (base32
58 "0h52p2waggzfshvy1wvhj4hf06fmzd44bv6j18k3l9rcx6aixzn6"))))
59 (build-system gnu-build-system)
60 (native-inputs
61 `(("ruby" ,ruby)
62 ("ruby-byebug" ,ruby-byebug)
63 ("ruby-pry" ,ruby-pry)
64 ("ruby-rspec" ,ruby-rspec)
65 ("ruby-rspec-wait" ,ruby-rspec-wait)
66 ("tmux" ,tmux)
67 ("zsh" ,zsh)))
68 (arguments
69 '(#:phases
70 (modify-phases %standard-phases
71 (delete 'configure)
72 (replace 'check ; Tests use ruby's bundler; instead execute rspec directly.
73 (lambda _
74 (setenv "TMUX_TMPDIR" (getenv "TMPDIR"))
75 (setenv "SHELL" (which "zsh"))
76 (invoke "rspec")))
77 (replace 'install
78 (lambda* (#:key outputs #:allow-other-keys)
79 (let* ((out (assoc-ref outputs "out"))
80 (zsh-plugins
81 (string-append out "/share/zsh/plugins/zsh-autosuggestions")))
82 (invoke "make" "all")
83 (install-file "zsh-autosuggestions.zsh" zsh-plugins)
84 #t))))))
85 (home-page "https://github.com/zsh-users/zsh-autosuggestions")
86 (synopsis "Fish-like autosuggestions for zsh")
87 (description
88 "Fish-like fast/unobtrusive autosuggestions for zsh. It suggests commands
89 as you type.")
90 (license license:expat)))
91
92 (define-public sh-z
93 (package
94 (name "sh-z")
95 (version "1.11")
96 (source (origin
97 (method git-fetch)
98 (uri (git-reference
99 (url "https://github.com/rupa/z")
100 (commit (string-append "v" version))))
101 (file-name (git-file-name name version))
102 (sha256
103 (base32
104 "13zbgkj6y0qhvn5jpkrqbd4jjxjr789k228iwma5hjfh1nx7ghyb"))))
105 (build-system gnu-build-system)
106 (arguments
107 `(#:tests? #f ; No tests provided
108 #:phases
109 (modify-phases %standard-phases
110 (delete 'configure)
111 (delete 'build)
112 (replace 'install
113 (lambda* (#:key outputs #:allow-other-keys)
114 (let* ((out (assoc-ref outputs "out"))
115 (man (string-append out "/share/man/man1"))
116 (bin (string-append out "/bin")))
117 (install-file "z.sh" bin)
118 (chmod (string-append bin "/z.sh") #o755)
119 (install-file "z.1" man)
120 #t))))))
121 (synopsis "Jump about directories")
122 (description
123 "Tracks your most used directories, based on ``frecency''. After a short
124 learning phase, z will take you to the most ``frecent'' directory that matches
125 all of the regexes given on the command line in order.")
126 (home-page "https://github.com/rupa/z")
127 (license license:expat)))
128
129 (define-public envstore
130 (package
131 (name "envstore")
132 (version "2.1")
133 (source
134 (origin
135 (method url-fetch)
136 (uri (string-append "https://finalrewind.org/projects/"
137 name "/" name "-" version ".tar.bz2"))
138 (sha256
139 (base32 "1x97lxad80m5blhdfanl5v2qzjwcgbij2i23701bn8mpyxsrqszi"))))
140 (build-system gnu-build-system)
141 (arguments
142 `(#:test-target "test"
143 #:make-flags (list "CC=gcc"
144 (string-append "PREFIX=" (assoc-ref %outputs "out")))
145 #:phases
146 (modify-phases %standard-phases
147 (delete 'configure))))
148 (home-page "https://finalrewind.org/projects/envstore/")
149 (synopsis "Save and restore environment variables")
150 (description "Envstore is a program for sharing environment variables
151 between various shells or commands.")
152 (license license:wtfpl2)))
153
154 (define-public trash-cli
155 (package
156 (name "trash-cli")
157 (version "0.17.1.14")
158 (source
159 (origin
160 (method url-fetch)
161 (uri (pypi-uri "trash-cli" version))
162 (sha256
163 (base32
164 "01q0cl04ljf214z6s3g256gsxx3pqsgaf6ac1zh0vrq5bnhnr85h"))))
165 (build-system python-build-system)
166 (arguments
167 `(#:python ,python-2
168 #:tests? #f ; no tests
169 #:phases
170 (modify-phases %standard-phases
171 (add-before 'build 'patch-path-constants
172 (lambda* (#:key inputs #:allow-other-keys)
173 (let ((libc (assoc-ref inputs "libc"))
174 (coreutils (assoc-ref inputs "coreutils")))
175 (substitute* "trashcli/list_mount_points.py"
176 (("\"/lib/libc.so.6\".*")
177 (string-append "\"" libc "/lib/libc.so.6\"\n"))
178 (("\"df\"")
179 (string-append "\"" coreutils "/bin/df\"")))))))))
180 (inputs `(("coreutils" ,coreutils)))
181 (home-page "https://github.com/andreafrancia/trash-cli")
182 (synopsis "Trash can management tool")
183 (description
184 "trash-cli is a command line utility for interacting with the
185 FreeDesktop.org trash can used by GNOME, KDE, XFCE, and other common desktop
186 environments. It can move files to the trash, and remove or list files that
187 are already there.")
188 (license license:gpl2+)))
189
190 (define-public direnv
191 (package
192 (name "direnv")
193 (version "2.15.2")
194 (source
195 (origin (method git-fetch)
196 (uri (git-reference
197 (url "https://github.com/direnv/direnv")
198 (commit (string-append "v" version))))
199 (file-name (git-file-name name version))
200 (sha256
201 (base32
202 "1y18619pmhfl0vrf4w0h75ybkkwgi9wcb7d9kv4n8drg1xp4aw4w"))))
203 (build-system go-build-system)
204 (arguments
205 '(#:import-path "github.com/direnv/direnv"
206 #:phases
207 (modify-phases %standard-phases
208 (add-after 'unpack 'delete-vendor
209 (lambda _
210 ;; Using a snippet causes issues with the name of the directory,
211 ;; so delete the extra source code here.
212 (delete-file-recursively "src/github.com/direnv/direnv/vendor")
213 #t))
214 (replace 'check
215 (lambda* (#:key tests? #:allow-other-keys)
216 (when tests?
217 (setenv "HOME" "/tmp")
218 (with-directory-excursion "src/github.com/direnv/direnv"
219 ;; The following file needs to be writable so it can be
220 ;; modified by the testsuite.
221 (make-file-writable "test/scenarios/base/.envrc")
222 (invoke "make" "test")
223 ;; Clean up from the tests, especially so that the extra
224 ;; direnv executable that's generated is removed.
225 (invoke "make" "clean")))
226 #t)))))
227 (native-inputs
228 `(("go-github-com-burntsushi-toml" ,go-github-com-burntsushi-toml)
229 ("go-github-com-direnv-go-dotenv" ,go-github-com-direnv-go-dotenv)
230 ("which" ,which)))
231 (home-page "https://direnv.net/")
232 (synopsis "Environment switcher for the shell")
233 (description
234 "direnv can hook into the bash, zsh, tcsh, and fish shells to load
235 or unload environment variables depending on the current directory. This
236 allows project-specific environment variables without using @file{~/.profile}.
237
238 Before each prompt, direnv checks for the existence of a @file{.envrc} file in
239 the current and parent directories. This file is then used to alter the
240 environment variables of the current shell.")
241 (license license:expat)))
242
243 (define-public fzy
244 (package
245 (name "fzy")
246 (version "1.0")
247 (source
248 (origin
249 (method git-fetch)
250 (uri (git-reference
251 (url "https://github.com/jhawthorn/fzy")
252 (commit version)))
253 (file-name (git-file-name name version))
254 (sha256
255 (base32
256 "1gkzdvj73f71388jvym47075l9zw61v6l8wdv2lnc0mns6dxig0k"))))
257 (build-system gnu-build-system)
258 (arguments
259 '(#:make-flags (list "CC=gcc"
260 (string-append "PREFIX=" (assoc-ref %outputs "out")))
261 #:phases
262 (modify-phases %standard-phases
263 (delete 'configure))))
264 (home-page "https://github.com/jhawthorn/fzy")
265 (synopsis "Fast fuzzy text selector for the terminal with an advanced
266 scoring algorithm")
267 (description
268 "Most other fuzzy matchers sort based on the length of a match. fzy tries
269 to find the result the user intended. It does this by favouring matches on
270 consecutive letters and starts of words. This allows matching using acronyms
271 or different parts of the path.
272
273 fzy is designed to be used both as an editor plugin and on the command
274 line. Rather than clearing the screen, fzy displays its interface directly
275 below the current cursor position, scrolling the screen if necessary.")
276 (license license:expat)))
277
278 (define-public hstr
279 (package
280 (name "hstr")
281 (version "2.2")
282 (source (origin
283 (method git-fetch)
284 (uri (git-reference
285 (url "https://github.com/dvorka/hstr")
286 (commit version)))
287 (file-name (git-file-name name version))
288 (sha256
289 (base32
290 "07fkilqlkpygvf9kvxyvl58g3lfq0bwwdp3wczy4hk8qlbhmgihn"))))
291 (build-system gnu-build-system)
292 (arguments
293 `(#:phases
294 (modify-phases %standard-phases
295 (add-before 'build 'adjust-ncurses-includes
296 (lambda* (#:key make-flags outputs #:allow-other-keys)
297 (let ((out (assoc-ref outputs "out")))
298 (substitute* "src/include/hstr_curses.h"
299 (("ncursesw\\/curses.h") "ncurses.h"))
300 (substitute* "src/include/hstr.h"
301 (("ncursesw\\/curses.h") "ncurses.h")))
302 #t)))))
303 (native-inputs
304 `(("autoconf" ,autoconf)
305 ("automake" ,automake)
306 ("pkg-config" ,pkg-config)))
307 (inputs
308 `(("ncurses" ,ncurses)
309 ("readline" ,readline)))
310 (synopsis "Navigate and search command history with shell history suggest box")
311 (description "HSTR (HiSToRy) is a command-line utility that brings
312 improved Bash and Zsh command completion from the history. It aims to make
313 completion easier and more efficient than with @kbd{Ctrl-R}. It allows you to
314 easily view, navigate, and search your command history with suggestion boxes.
315 HSTR can also manage your command history (for instance you can remove
316 commands that are obsolete or contain a piece of sensitive information) or
317 bookmark your favourite commands.")
318 (home-page "http://me.mindforger.com/projects/hh.html")
319 (license license:asl2.0)))
320
321 (define-public shell-functools
322 (package
323 (name "shell-functools")
324 (version "0.3.0")
325 (source (origin
326 (method git-fetch)
327 (uri (git-reference
328 (url "https://github.com/sharkdp/shell-functools")
329 (commit (string-append "v" version))))
330 (file-name (git-file-name name version))
331 (sha256
332 (base32
333 "0d6zzg7cxfrzwzh1wmpj7q85kz33sak6ac59ncsm6dlbin12h0hi"))))
334 (build-system python-build-system)
335 (home-page "https://github.com/sharkdp/shell-functools/")
336 (synopsis "Functional programming tools for the shell")
337 (description "This package provides higher order functions like map,
338 filter, foldl, sort_by and take_while as simple command-line tools. Following
339 the UNIX philosophy, these commands are designed to be composed via pipes. A
340 large collection of functions such as basename, replace, contains or is_dir
341 are provided as arguments to these commands.")
342 (license license:expat)))