Merge branch 'master' into staging
[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.11)
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 "7.4.0")
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 "147m872zff0srwq9vaxkkbab06g3fkklbk1g2lx90vdhgs37f5xj"))))
147 (build-system cargo-build-system)
148 (arguments
149 `(#:cargo-inputs
150 (("rust-ansi-term" ,rust-ansi-term-0.12)
151 ("rust-atty" ,rust-atty-0.2)
152 ("rust-clap" ,rust-clap-2)
153 ("rust-ctrlc" ,rust-ctrlc-3.1)
154 ("rust-globset" ,rust-globset-0.4)
155 ("rust-humantime" ,rust-humantime-1.3)
156 ("rust-ignore" ,rust-ignore-0.4)
157 ("rust-jemallocator" ,rust-jemallocator-0.3)
158 ("rust-lazy-static" ,rust-lazy-static-1)
159 ("rust-libc" ,rust-libc-0.2)
160 ("rust-lscolors" ,rust-lscolors-0.6)
161 ("rust-num-cpus" ,rust-num-cpus-1.10)
162 ("rust-regex" ,rust-regex-1.3)
163 ("rust-regex-syntax" ,rust-regex-syntax-0.6)
164 ("rust-version-check" ,rust-version-check-0.9))
165 #:cargo-development-inputs
166 (("rust-diff" ,rust-diff-0.1)
167 ("rust-filetime" ,rust-filetime-0.2)
168 ("rust-tempdir" ,rust-tempdir-0.3))
169 #:phases
170 (modify-phases %standard-phases
171 (add-after 'unpack 'override-jemalloc
172 (lambda* (#:key inputs #:allow-other-keys)
173 (let ((jemalloc (assoc-ref inputs "jemalloc")))
174 (setenv "JEMALLOC_OVERRIDE"
175 (string-append jemalloc "/lib/libjemalloc.so")))
176 #t))
177 (add-after 'install 'install-extra
178 (lambda* (#:key outputs #:allow-other-keys)
179 (let* ((out (assoc-ref outputs "out"))
180 (install-completion
181 (lambda (completion out-dir)
182 (for-each
183 (lambda (f)
184 (install-file f (string-append out out-dir)))
185 (find-files "target/release/build/" completion)))))
186 ;; Manpages
187 (install-file "doc/fd.1" (string-append out "/share/man/man1"))
188 ;; Completions
189 (install-completion "^fd.bash$" "/etc/bash_completion.d")
190 (install-completion "^fd.fish$" "/share/fish/vendor_completions.d")
191 (install-completion "^_fd$" "/share/zsh/site-functions")
192 (rename-file (string-append out "/etc/bash_completion.d/fd.bash")
193 (string-append out "/etc/bash_completion.d/fd"))
194 #t))))))
195 (inputs `(("jemalloc" ,jemalloc)))
196 (home-page "https://github.com/sharkdp/fd")
197 (synopsis "Simple, fast and user-friendly alternative to find")
198 (description
199 "@code{fd} is a simple, fast and user-friendly alternative to @code{find}.
200 While it does not seek to mirror all of find's powerful functionality, it
201 provides defaults for 80% of the use cases.")
202 (license (list license:expat license:asl2.0))))
203
204 (define-public ripgrep
205 (package
206 (name "ripgrep")
207 (version "11.0.2")
208 (source
209 (origin
210 (method url-fetch)
211 (uri (crate-uri "ripgrep" version))
212 (file-name
213 (string-append name "-" version ".tar.gz"))
214 (sha256
215 (base32
216 "0vqjr96s2rs45715hzf0g0wjahig4zjyiqfijmzzg4jyh9ni80yr"))))
217 (build-system cargo-build-system)
218 (arguments
219 `(#:cargo-inputs
220 (("rust-bstr" ,rust-bstr-0.2)
221 ("rust-clap" ,rust-clap-2)
222 ("rust-grep" ,rust-grep-0.2)
223 ("rust-ignore" ,rust-ignore-0.4)
224 ("rust-jemallocator" ,rust-jemallocator-0.3)
225 ("rust-lazy-static" ,rust-lazy-static-1)
226 ("rust-log" ,rust-log-0.4)
227 ("rust-num-cpus" ,rust-num-cpus-1.10)
228 ("rust-regex" ,rust-regex-1.1)
229 ("rust-serde-json" ,rust-serde-json-1.0)
230 ("rust-termcolor" ,rust-termcolor-1.0))
231 #:cargo-development-inputs
232 (("rust-serde" ,rust-serde-1.0)
233 ("rust-serde-derive" ,rust-serde-derive-1.0))
234 #:modules ((ice-9 match)
235 (guix build cargo-build-system)
236 (guix build utils))
237 #:phases
238 (modify-phases %standard-phases
239 (add-after 'build 'install-manpage
240 ;; NOTE: This is done before 'check so that there's only one output
241 ;; directory with the man page.
242 (lambda* (#:key outputs #:allow-other-keys)
243 (match (find-files "target" "^rg\\.1$")
244 ((manpage)
245 (install-file manpage (string-append
246 (assoc-ref outputs "out")
247 "/share/man/man1"))))
248 #t)))
249 #:features '("pcre2")))
250 (native-inputs
251 `(("asciidoc" ,asciidoc)
252 ("pcre2" ,pcre2)
253 ("pkg-config" ,pkg-config)))
254 (home-page "https://github.com/BurntSushi/ripgrep")
255 (synopsis "Line-oriented search tool")
256 (description
257 "ripgrep is a line-oriented search tool that recursively searches
258 your current directory for a regex pattern while respecting your
259 gitignore rules.")
260 (license (list license:unlicense license:expat))))
261
262 (define-public rust-cbindgen
263 (package
264 (name "rust-cbindgen")
265 (version "0.13.1")
266 (source
267 (origin
268 (method url-fetch)
269 (uri (crate-uri "cbindgen" version))
270 (file-name (string-append name "-" version ".crate"))
271 (sha256
272 (base32
273 "0w70bnwwqyf9fr6z3rcs7m7ad791fmfmhxy828va0dkfwvamp59c"))))
274 (build-system cargo-build-system)
275 (arguments
276 `(#:cargo-inputs
277 (("clap" ,rust-clap-2)
278 ("log" ,rust-log-0.4)
279 ("proc-macro2" ,rust-proc-macro2-1.0)
280 ("quote" ,rust-quote-1.0)
281 ("serde" ,rust-serde-1.0)
282 ("serde-json" ,rust-serde-json-1.0)
283 ("syn" ,rust-syn-1.0)
284 ("tempfile" ,rust-tempfile-3.1)
285 ("toml" ,rust-toml-0.5))))
286 (home-page "https://github.com/eqrion/cbindgen/")
287 (synopsis "Tool for generating C bindings to Rust code")
288 (description
289 "This package provides a tool for generating C/C++ bindings to Rust code.")
290 (license license:mpl2.0)))
291
292 (define-public rust-cbindgen-0.12
293 (package
294 (inherit rust-cbindgen)
295 (name "rust-cbindgen")
296 (version "0.12.2")
297 (source
298 (origin
299 (method url-fetch)
300 (uri (crate-uri "cbindgen" version))
301 (file-name
302 (string-append name "-" version ".tar.gz"))
303 (sha256
304 (base32
305 "13jzbmjz1bmmfr0i80hw6ar484mgabx3hbpb2ynhk0ddqi0yr58m"))))))
306
307 (define-public tokei
308 (package
309 (name "tokei")
310 (version "10.1.1")
311 (source
312 (origin
313 (method url-fetch)
314 (uri (crate-uri "tokei" version))
315 (file-name
316 (string-append name "-" version ".tar.gz"))
317 (sha256
318 (base32
319 "07f5laqw2k9l3k8wrg9h8p2m5d9hkfxngyacwrn3vs7mlnw8l81m"))))
320 (build-system cargo-build-system)
321 (arguments
322 `(#:cargo-inputs
323 (("rust-clap" ,rust-clap-2)
324 ("rust-crossbeam-channel" ,rust-crossbeam-channel-0.4)
325 ("rust-dirs" ,rust-dirs-2.0)
326 ("rust-encoding-rs-io" ,rust-encoding-rs-io-0.1)
327 ("rust-env-logger" ,rust-env-logger-0.7)
328 ("rust-grep-searcher" ,rust-grep-searcher-0.1)
329 ("rust-hex" ,rust-hex-0.4)
330 ("rust-ignore" ,rust-ignore-0.4)
331 ("rust-log" ,rust-log-0.4)
332 ("rust-rayon" ,rust-rayon-1.3)
333 ("rust-serde" ,rust-serde-1.0)
334 ("rust-serde-cbor" ,rust-serde-cbor-0.10)
335 ("rust-serde-derive" ,rust-serde-derive-1.0)
336 ("rust-serde-json" ,rust-serde-json-1.0)
337 ("rust-serde-yaml" ,rust-serde-yaml-0.8)
338 ("rust-term-size" ,rust-term-size-0.3)
339 ("rust-toml" ,rust-toml-0.5))
340 #:cargo-development-inputs
341 (("rust-git2" ,rust-git2-0.11)
342 ("rust-handlebars" ,rust-handlebars-2.0)
343 ("rust-ignore" ,rust-ignore-0.4)
344 ("rust-lazy-static" ,rust-lazy-static-1)
345 ("rust-regex" ,rust-regex-1.3)
346 ("rust-serde-json" ,rust-serde-json-1.0)
347 ("rust-tempfile" ,rust-tempfile-3.0))
348 #:phases
349 (modify-phases %standard-phases
350 (add-after 'configure 'unvendor-libraries-from-crates
351 (lambda* (#:key inputs #:allow-other-keys)
352 (let ((openssl (assoc-ref inputs "openssl")))
353 (setenv "OPENSSL_DIR" openssl))
354 #t)))))
355 (native-inputs
356 `(("libgit2" ,libgit2)
357 ("openssl" ,openssl)
358 ("pkg-config" ,pkg-config)
359 ("zlib" ,zlib)))
360 (home-page "https://tokei.rs")
361 (synopsis "Count code, quickly")
362 (description
363 "Tokei is a program that displays statistics about your code. Tokei will
364 show number of files, total lines within those files and code, comments, and
365 blanks grouped by language.")
366 (license (list license:expat license:asl2.0))))
367
368 (define-public rust-cargo-c
369 (package
370 (name "rust-cargo-c")
371 (version "0.5.2")
372 (source
373 (origin
374 (method url-fetch)
375 (uri (crate-uri "cargo-c" version))
376 (file-name
377 (string-append name "-" version ".tar.gz"))
378 (sha256
379 (base32
380 "1is72jm0r73pqx2g3h1n6lvrcirwd91mmajsmb3jjg4jnayfkp0w"))))
381 (build-system cargo-build-system)
382 (arguments
383 `(#:cargo-inputs
384 (("rust-cbindgen" ,rust-cbindgen-0.12)
385 ("rust-pretty-env-logger" ,rust-pretty-env-logger-0.3)
386 ("rust-structopt" ,rust-structopt-0.3)
387 ("rust-log" ,rust-log-0.4)
388 ("rust-toml" ,rust-toml-0.5)
389 ("rust-cargo-metadata" ,rust-cargo-metadata-0.9)
390 ("rust-serde" ,rust-serde-1.0)
391 ("rust-serde-derive" ,rust-serde-derive-1.0)
392 ("rust-regex" ,rust-regex-1.3))))
393 (home-page "https://github.com/lu-zero/cargo-c")
394 (synopsis "Build and install C-compatible libraries")
395 (description
396 "This package produces and installs a correct pkg-config file, a static
397 library and a dynamic library, and a C header to be used by any C (and
398 C-compatible) software.")
399 (license license:expat)))