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