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