gnu: bat: Fix build.
[jackhill/guix/guix.git] / gnu / packages / rust-apps.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2019, 2020 John Soo <jsoo1@asu.edu>
3 ;;; Copyright © 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
5 ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
6 ;;; Copyright © 2020 Leo Famulari <leo@famulari.name>
7 ;;; Copyright © 2020 Mark H Weaver <mhw@netris.org>
8 ;;; Copyright © 2020 Gabriel Arazas <foo.dogsquared@gmail.com>
9 ;;; Copyright © 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
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 rust-apps)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix build-system cargo)
29 #:use-module (guix download)
30 #:use-module (guix packages)
31 #:use-module (gnu packages compression)
32 #:use-module (gnu packages crates-io)
33 #:use-module (gnu packages crates-graphics)
34 #:use-module (gnu packages documentation)
35 #:use-module (gnu packages jemalloc)
36 #:use-module (gnu packages pcre)
37 #:use-module (gnu packages pkg-config)
38 #:use-module (gnu packages tls)
39 #:use-module (gnu packages version-control))
40
41 (define-public bat
42 (package
43 (name "bat")
44 (version "0.17.1")
45 (source
46 (origin
47 (method url-fetch)
48 (uri (crate-uri "bat" version))
49 (file-name (string-append name "-" version ".tar.gz"))
50 (sha256
51 (base32 "1ia12774prjnm3msiaja6qdpxkpyknxswqpgkmwzj0wn9nhkc7nz"))))
52 (build-system cargo-build-system)
53 (arguments
54 `(#:cargo-inputs
55 (("rust-ansi-colours" ,rust-ansi-colours-1)
56 ("rust-ansi-term" ,rust-ansi-term-0.12)
57 ("rust-atty" ,rust-atty-0.2)
58 ("rust-clap" ,rust-clap-2)
59 ("rust-console" ,rust-console-0.13)
60 ("rust-content-inspector" ,rust-content-inspector-0.2)
61 ("rust-dirs" ,rust-dirs-3)
62 ("rust-encoding" ,rust-encoding-0.2)
63 ("rust-error-chain" ,rust-error-chain-0.12)
64 ("rust-git2" ,rust-git2-0.13)
65 ("rust-globset" ,rust-globset-0.4)
66 ("rust-lazy-static" ,rust-lazy-static-1)
67 ("rust-path-abs" ,rust-path-abs-0.5)
68 ("rust-semver" ,rust-semver-0.11)
69 ("rust-serde" ,rust-serde-1)
70 ("rust-serde-yaml" ,rust-serde-yaml-0.8)
71 ("rust-shell-words" ,rust-shell-words-1)
72 ("rust-syntect" ,rust-syntect-4)
73 ("rust-unicode-width" ,rust-unicode-width-0.1)
74 ("rust-wild" ,rust-wild-2))
75 #:cargo-development-inputs
76 (("rust-assert-cmd" ,rust-assert-cmd-1)
77 ("rust-predicates" ,rust-predicates-1)
78 ("rust-tempdir" ,rust-tempdir-0.3))))
79 (native-inputs
80 `(("pkg-config" ,pkg-config)))
81 (inputs
82 `(("libgit2" ,libgit2)
83 ("zlib" ,zlib)))
84 (home-page "https://github.com/sharkdp/bat")
85 (synopsis "@command{cat} clone with syntax highlighting and git integration")
86 (description
87 "@command{bat} is a drop-in @command{cat} replacement featuring syntax
88 highlighting for a large number of languages, git integration, and automatic
89 paging.")
90 (license (list license:expat license:asl2.0))))
91
92 (define-public exa
93 (package
94 (name "exa")
95 (version "0.9.0")
96 (source
97 (origin
98 (method url-fetch)
99 (uri (crate-uri "exa" version))
100 (file-name
101 (string-append name "-" version ".tar.gz"))
102 (sha256
103 (base32
104 "1s902xgplz1167k0r7x235p914lprpsqy2if0kpa1mlb0fswqqq4"))))
105 (build-system cargo-build-system)
106 (arguments
107 `(#:cargo-inputs
108 (("rust-ansi-term" ,rust-ansi-term-0.12)
109 ("rust-datetime" ,rust-datetime-0.4)
110 ("rust-env-logger" ,rust-env-logger-0.6)
111 ("rust-git2" ,rust-git2-0.9)
112 ("rust-glob" ,rust-glob-0.3)
113 ("rust-lazy-static" ,rust-lazy-static-1)
114 ("rust-libc" ,rust-libc-0.2)
115 ("rust-locale" ,rust-locale-0.2)
116 ("rust-log" ,rust-log-0.4)
117 ("rust-natord" ,rust-natord-1.0)
118 ("rust-num-cpus" ,rust-num-cpus-1)
119 ("rust-number-prefix" ,rust-number-prefix-0.3)
120 ("rust-scoped-threadpool" ,rust-scoped-threadpool-0.1)
121 ("rust-term-grid" ,rust-term-grid-0.1)
122 ("rust-term-size" ,rust-term-size-0.3)
123 ("rust-unicode-width" ,rust-unicode-width-0.1)
124 ("rust-users" ,rust-users-0.9)
125 ("rust-zoneinfo-compiled" ,rust-zoneinfo-compiled-0.4))
126 #:cargo-development-inputs
127 (("rust-datetime" ,rust-datetime-0.4))
128 #:phases
129 (modify-phases %standard-phases
130 ;; Ignoring failing tests.
131 ;; Reported in https://github.com/ogham/exa/issues/318
132 (add-before 'check 'disable-failing-tests
133 (lambda _
134 (substitute* "src/options/mod.rs"
135 (("^.*fn oneline_across.*" oneline-across)
136 (string-append "#[ignore]\n" oneline-across)))
137
138 (substitute* "src/options/view.rs"
139 (("test!\\(across:.*") "")
140 (("test!\\(cr:.*") "")
141 (("test!\\(empty:.*") "")
142 (("test!\\(gracross:.*") "")
143 (("test!\\(grid:.*") "")
144 (("test!\\(icons:.*") "")
145 (("test!\\(just_binary:.*") "")
146 (("test!\\(just_blocks:.*") "")
147 (("test!\\(just_bytes:.*") "")
148 (("test!\\(just_git:.*") "")
149 (("test!\\(just_group:.*") "")
150 (("test!\\(just_header:.*") "")
151 (("test!\\(just_inode:.*") "")
152 (("test!\\(just_links:.*") "")
153 (("test!\\(leg:.*") "")
154 (("test!\\(lid:.*") "")
155 (("test!\\(original_g:.*") ""))
156 #t))
157 (add-after 'install 'install-extras
158 (lambda* (#:key outputs #:allow-other-keys)
159 (let* ((out (assoc-ref outputs "out"))
160 (share (string-append out "/share"))
161 (man1 (string-append share "/man/man1")))
162 (install-file "contrib/man/exa.1" man1)
163 (mkdir-p (string-append out "/etc/bash_completion.d"))
164 (mkdir-p (string-append share "/fish/vendor_completions.d"))
165 (mkdir-p (string-append share "/zsh/site-functions"))
166 (copy-file "contrib/completions.bash"
167 (string-append out "/etc/bash_completion.d/exa"))
168 (copy-file "contrib/completions.fish"
169 (string-append share "/fish/vendor_completions.d/exa.fish"))
170 (copy-file "contrib/completions.zsh"
171 (string-append share "/zsh/site-functions/_exa"))
172 #t))))))
173 (inputs
174 `(("libgit2" ,libgit2)
175 ("zlib" ,zlib)))
176 (native-inputs
177 `(("pkg-config" ,pkg-config)))
178 (home-page "https://the.exa.website/")
179 (synopsis "Modern replacement for ls")
180 (description "@code{exa} is a modern replacement for the command-line
181 program @code{ls}. It uses colours to distinguish file types and metadata. It
182 also knows about symlinks, extended attributes, and Git.")
183 (license license:expat)))
184
185 (define-public fd
186 (package
187 (name "fd")
188 (version "8.1.1")
189 (source
190 (origin
191 (method url-fetch)
192 (uri (crate-uri "fd-find" version))
193 (file-name
194 (string-append name "-" version ".tar.gz"))
195 (sha256
196 (base32
197 "124a5r8hpk2phs1288jybh34d48yxy44wr7gv5ggchs272gs2jam"))))
198 (build-system cargo-build-system)
199 (arguments
200 `(#:cargo-inputs
201 (("rust-ansi-term" ,rust-ansi-term-0.12)
202 ("rust-anyhow" ,rust-anyhow-1.0)
203 ("rust-atty" ,rust-atty-0.2)
204 ("rust-clap" ,rust-clap-2)
205 ("rust-ctrlc" ,rust-ctrlc-3.1)
206 ("rust-dirs" ,rust-dirs-2.0)
207 ("rust-globset" ,rust-globset-0.4)
208 ("rust-humantime" ,rust-humantime-2)
209 ("rust-ignore" ,rust-ignore-0.4)
210 ("rust-jemallocator" ,rust-jemallocator-0.3)
211 ("rust-lazy-static" ,rust-lazy-static-1)
212 ("rust-libc" ,rust-libc-0.2)
213 ("rust-lscolors" ,rust-lscolors-0.7)
214 ("rust-num-cpus" ,rust-num-cpus-1)
215 ("rust-regex" ,rust-regex-1)
216 ("rust-regex-syntax" ,rust-regex-syntax-0.6)
217 ("rust-users" ,rust-users-0.10)
218 ("rust-version-check" ,rust-version-check-0.9))
219 #:cargo-development-inputs
220 (("rust-diff" ,rust-diff-0.1)
221 ("rust-filetime" ,rust-filetime-0.2)
222 ("rust-tempdir" ,rust-tempdir-0.3))
223 #:phases
224 (modify-phases %standard-phases
225 (add-after 'unpack 'override-jemalloc
226 (lambda* (#:key inputs #:allow-other-keys)
227 (let ((jemalloc (assoc-ref inputs "jemalloc")))
228 (setenv "JEMALLOC_OVERRIDE"
229 (string-append jemalloc "/lib/libjemalloc.so")))
230 #t))
231 (add-after 'install 'install-extra
232 (lambda* (#:key outputs #:allow-other-keys)
233 (let* ((out (assoc-ref outputs "out"))
234 (install-completion
235 (lambda (completion out-dir)
236 (for-each
237 (lambda (f)
238 (install-file f (string-append out out-dir)))
239 (find-files "target/release/build/" completion)))))
240 ;; Manpages
241 (install-file "doc/fd.1" (string-append out "/share/man/man1"))
242 ;; Completions
243 (install-completion "^fd.bash$" "/etc/bash_completion.d")
244 (install-completion "^fd.fish$" "/share/fish/vendor_completions.d")
245 (install-completion "^_fd$" "/share/zsh/site-functions")
246 (rename-file (string-append out "/etc/bash_completion.d/fd.bash")
247 (string-append out "/etc/bash_completion.d/fd"))
248 #t))))))
249 (inputs `(("jemalloc" ,jemalloc)))
250 (home-page "https://github.com/sharkdp/fd")
251 (synopsis "Simple, fast and user-friendly alternative to find")
252 (description
253 "@code{fd} is a simple, fast and user-friendly alternative to @code{find}.
254 While it does not seek to mirror all of find's powerful functionality, it
255 provides defaults for 80% of the use cases.")
256 (license (list license:expat license:asl2.0))))
257
258 (define-public hexyl
259 (package
260 (name "hexyl")
261 (version "0.8.0")
262 (source
263 (origin
264 (method url-fetch)
265 (uri (crate-uri "hexyl" version))
266 (file-name
267 (string-append name "-" version ".tar.gz"))
268 (sha256
269 (base32
270 "0sipag77196467idbznbk5q5lwhqz85zw7y1pwg9b27jxqyk04rp"))))
271 (build-system cargo-build-system)
272 (arguments
273 `(#:cargo-inputs
274 (("rust-ansi-term" ,rust-ansi-term-0.12)
275 ("rust-atty" ,rust-atty-0.2)
276 ("rust-clap" ,rust-clap-2)
277 ("rust-libc" ,rust-libc-0.2))))
278 (home-page "https://github.com/sharkdp/hexyl")
279 (synopsis "Command-line hex viewer")
280 (description
281 "This package provides a command line hex viewer. It uses a colored output
282 for distinguishing different kinds of bytes such as NULL bytes, printable ASCII
283 characters, ASCII whitespace characters, other ASCII characters and non-ASCII.")
284 (license (list license:expat license:asl2.0))))
285
286 (define-public ripgrep
287 (package
288 (name "ripgrep")
289 (version "12.1.1")
290 (source
291 (origin
292 (method url-fetch)
293 (uri (crate-uri "ripgrep" version))
294 (file-name
295 (string-append name "-" version ".tar.gz"))
296 (sha256
297 (base32
298 "1grfi0j9zczzipipc21lkdbqmd2lvy2wlqy65fy4sckqvix5amdr"))))
299 (build-system cargo-build-system)
300 (arguments
301 `(#:cargo-inputs
302 (("rust-bstr" ,rust-bstr-0.2)
303 ("rust-clap" ,rust-clap-2)
304 ("rust-grep" ,rust-grep-0.2)
305 ("rust-ignore" ,rust-ignore-0.4)
306 ("rust-jemallocator" ,rust-jemallocator-0.3)
307 ("rust-lazy-static" ,rust-lazy-static-1)
308 ("rust-log" ,rust-log-0.4)
309 ("rust-num-cpus" ,rust-num-cpus-1)
310 ("rust-regex" ,rust-regex-1)
311 ("rust-serde-json" ,rust-serde-json-1)
312 ("rust-termcolor" ,rust-termcolor-1))
313 #:cargo-development-inputs
314 (("rust-serde" ,rust-serde-1)
315 ("rust-serde-derive" ,rust-serde-derive-1))
316 #:modules ((ice-9 match)
317 (guix build cargo-build-system)
318 (guix build utils))
319 #:phases
320 (modify-phases %standard-phases
321 (add-after 'build 'install-manpage
322 ;; NOTE: This is done before 'check so that there's only one output
323 ;; directory with the man page.
324 (lambda* (#:key outputs #:allow-other-keys)
325 (match (find-files "target" "^rg\\.1$")
326 ((manpage)
327 (install-file manpage (string-append
328 (assoc-ref outputs "out")
329 "/share/man/man1"))))
330 #t)))
331 #:features '("pcre2")))
332 (native-inputs
333 `(("asciidoc" ,asciidoc)
334 ("pcre2" ,pcre2)
335 ("pkg-config" ,pkg-config)))
336 (home-page "https://github.com/BurntSushi/ripgrep")
337 (synopsis "Line-oriented search tool")
338 (description
339 "ripgrep is a line-oriented search tool that recursively searches
340 your current directory for a regex pattern while respecting your
341 gitignore rules.")
342 (license (list license:unlicense license:expat))))
343
344 (define-public rust-cbindgen
345 (package
346 (name "rust-cbindgen")
347 (version "0.13.2")
348 (source
349 (origin
350 (method url-fetch)
351 (uri (crate-uri "cbindgen" version))
352 (file-name (string-append name "-" version ".crate"))
353 (sha256
354 (base32
355 "0673pq96hs7waavkv58v2pakpxpsfyjvbraa5kyl2b44phgdzcid"))))
356 (build-system cargo-build-system)
357 (arguments
358 `(#:cargo-inputs
359 (("clap" ,rust-clap-2)
360 ("log" ,rust-log-0.4)
361 ("proc-macro2" ,rust-proc-macro2-1)
362 ("quote" ,rust-quote-1)
363 ("serde" ,rust-serde-1)
364 ("serde-json" ,rust-serde-json-1)
365 ("syn" ,rust-syn-1)
366 ("tempfile" ,rust-tempfile-3)
367 ("toml" ,rust-toml-0.5))))
368 (home-page "https://github.com/eqrion/cbindgen/")
369 (synopsis "Tool for generating C bindings to Rust code")
370 (description
371 "This package provides a tool for generating C/C++ bindings to Rust code.")
372 (license license:mpl2.0)))
373
374 (define-public rust-cbindgen-0.14
375 (package
376 (inherit rust-cbindgen)
377 (name "rust-cbindgen")
378 (version "0.14.1")
379 (source
380 (origin
381 (method url-fetch)
382 (uri (crate-uri "cbindgen" version))
383 (file-name
384 (string-append name "-" version ".tar.gz"))
385 (sha256
386 (base32
387 "1ppwqbzydxlg9a24lynzfk60xrvqw4k31mpz1wrk6lbf88zf8nxi"))))))
388
389 (define-public rust-cbindgen-0.12
390 (package
391 (inherit rust-cbindgen)
392 (name "rust-cbindgen")
393 (version "0.12.2")
394 (source
395 (origin
396 (method url-fetch)
397 (uri (crate-uri "cbindgen" version))
398 (file-name
399 (string-append name "-" version ".tar.gz"))
400 (sha256
401 (base32
402 "13jzbmjz1bmmfr0i80hw6ar484mgabx3hbpb2ynhk0ddqi0yr58m"))))))
403
404 (define-public tokei
405 (package
406 (name "tokei")
407 (version "10.1.1")
408 (source
409 (origin
410 (method url-fetch)
411 (uri (crate-uri "tokei" version))
412 (file-name
413 (string-append name "-" version ".tar.gz"))
414 (sha256
415 (base32
416 "07f5laqw2k9l3k8wrg9h8p2m5d9hkfxngyacwrn3vs7mlnw8l81m"))))
417 (build-system cargo-build-system)
418 (arguments
419 `(#:cargo-inputs
420 (("rust-clap" ,rust-clap-2)
421 ("rust-crossbeam-channel" ,rust-crossbeam-channel-0.4)
422 ("rust-dirs" ,rust-dirs-2.0)
423 ("rust-encoding-rs-io" ,rust-encoding-rs-io-0.1)
424 ("rust-env-logger" ,rust-env-logger-0.7)
425 ("rust-grep-searcher" ,rust-grep-searcher-0.1)
426 ("rust-hex" ,rust-hex-0.4)
427 ("rust-ignore" ,rust-ignore-0.4)
428 ("rust-log" ,rust-log-0.4)
429 ("rust-rayon" ,rust-rayon-1)
430 ("rust-serde" ,rust-serde-1)
431 ("rust-serde-cbor" ,rust-serde-cbor-0.10)
432 ("rust-serde-derive" ,rust-serde-derive-1)
433 ("rust-serde-json" ,rust-serde-json-1)
434 ("rust-serde-yaml" ,rust-serde-yaml-0.8)
435 ("rust-term-size" ,rust-term-size-0.3)
436 ("rust-toml" ,rust-toml-0.5))
437 #:cargo-development-inputs
438 (("rust-git2" ,rust-git2-0.11)
439 ("rust-handlebars" ,rust-handlebars-2.0)
440 ("rust-ignore" ,rust-ignore-0.4)
441 ("rust-lazy-static" ,rust-lazy-static-1)
442 ("rust-regex" ,rust-regex-1)
443 ("rust-serde-json" ,rust-serde-json-1)
444 ("rust-tempfile" ,rust-tempfile-3))))
445 (native-inputs
446 `(("pkg-config" ,pkg-config)))
447 (inputs
448 `(("libgit2" ,libgit2)
449 ("openssl" ,openssl)
450 ("zlib" ,zlib)))
451 (home-page "https://tokei.rs")
452 (synopsis "Count code, quickly")
453 (description
454 "Tokei is a program that displays statistics about your code. Tokei will
455 show number of files, total lines within those files and code, comments, and
456 blanks grouped by language.")
457 (license (list license:expat license:asl2.0))))
458
459 (define-public watchexec
460 (package
461 (name "watchexec")
462 (version "1.14.0")
463 (source
464 (origin
465 (method url-fetch)
466 (uri (crate-uri "watchexec" version))
467 (file-name
468 (string-append name "-" version ".tar.gz"))
469 (sha256
470 (base32
471 "0bwgqb5fvyqbf2lf0005fxzpbpbwbszc7144g3kg2cmzy5cbrf0w"))))
472 (build-system cargo-build-system)
473 (arguments
474 `(#:phases
475 (modify-phases %standard-phases
476 (add-after 'install 'install-completions
477 (lambda* (#:key outputs #:allow-other-keys)
478 (let* ((out (assoc-ref outputs "out"))
479 (zsh (string-append out "/share/zsh/site-functions/_watchexec"))
480 (doc (string-append out "/share/doc/watchexec-" ,version)))
481 (mkdir-p (dirname zsh))
482 (copy-file "completions/zsh" zsh)
483 (install-file "README.md" doc)
484 #t))))
485 #:cargo-inputs
486 (("rust-clap" ,rust-clap-2)
487 ("rust-derive-builder" ,rust-derive-builder-0.9)
488 ("rust-env-logger" ,rust-env-logger-0.7)
489 ("rust-glob" ,rust-glob-0.3)
490 ("rust-globset" ,rust-globset-0.4)
491 ("rust-lazy-static" ,rust-lazy-static-1)
492 ("rust-log" ,rust-log-0.4)
493 ("rust-nix" ,rust-nix-0.17)
494 ("rust-notify" ,rust-notify-4)
495 ("rust-walkdir" ,rust-walkdir-2)
496 ("rust-winapi" ,rust-winapi-0.3))))
497 (home-page "https://github.com/watchexec/watchexec")
498 (synopsis "Executes commands in response to file modifications")
499 (description
500 "@command{watchexec} is a simple, standalone tool that watches a path and runs
501 a command whenever it detects modifications.
502
503 Example use cases:
504 @itemize @bullet
505 @item Automatically run unit tests
506 @item Run linters/syntax checkers
507 @end itemize
508
509 Features:
510 @itemize @bullet
511 @item Coalesces multiple file system events into one, for editors that
512 use swap/backup files during saving
513 @item By default, uses @code{.gitignore} and @code{.ignore} to determine which
514 files to ignore notifications for
515 @item Supports watching files with a specific extension
516 @item Supports filtering/ignoring events based on glob patterns
517 @item Launches child processes in a new process group
518 @item Sets environment variables that allow the executed program to learn
519 the details of how it was triggered.
520 @end itemize")
521 (license license:asl2.0)))
522
523 (define-public rust-cargo-c
524 (package
525 (name "rust-cargo-c")
526 (version "0.5.3")
527 (source
528 (origin
529 (method url-fetch)
530 (uri (crate-uri "cargo-c" version))
531 (file-name
532 (string-append name "-" version ".tar.gz"))
533 (sha256
534 (base32
535 "0hsag5g4qngm8alfil2dyvl5sagpqi5nb40c7bhwng2z8mv9r41k"))))
536 (build-system cargo-build-system)
537 (arguments
538 `(#:cargo-inputs
539 (("rust-cbindgen" ,rust-cbindgen)
540 ("rust-pretty-env-logger" ,rust-pretty-env-logger-0.4)
541 ("rust-structopt" ,rust-structopt-0.3)
542 ("rust-log" ,rust-log-0.4)
543 ("rust-toml" ,rust-toml-0.5)
544 ("rust-cargo-metadata" ,rust-cargo-metadata-0.9)
545 ("rust-serde" ,rust-serde-1)
546 ("rust-serde-derive" ,rust-serde-derive-1)
547 ("rust-regex" ,rust-regex-1))))
548 (home-page "https://github.com/lu-zero/cargo-c")
549 (synopsis "Build and install C-compatible libraries")
550 (description
551 "This package produces and installs a correct pkg-config file, a static
552 library and a dynamic library, and a C header to be used by any C (and
553 C-compatible) software.")
554 (license license:expat)))