Commit | Line | Data |
---|---|---|
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> |
9e225670 JS |
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) | |
c40e3d0b EF |
28 | #:use-module (gnu packages compression) |
29 | #:use-module (gnu packages crates-io) | |
6e18b41e | 30 | #:use-module (gnu packages documentation) |
0f7720d1 | 31 | #:use-module (gnu packages jemalloc) |
d883e791 | 32 | #:use-module (gnu packages pcre) |
c40e3d0b EF |
33 | #:use-module (gnu packages pkg-config) |
34 | #:use-module (gnu packages tls) | |
35 | #:use-module (gnu packages version-control)) | |
9e225670 | 36 | |
d42cbbba JS |
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) | |
21c8ec75 | 58 | ("rust-lazy-static" ,rust-lazy-static-1) |
d42cbbba JS |
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:.*") "")) | |
b76473ec EF |
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)))))) | |
d42cbbba JS |
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 | ||
0f7720d1 JS |
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) | |
21c8ec75 | 158 | ("rust-lazy-static" ,rust-lazy-static-1) |
0f7720d1 JS |
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 | |
9eed0a74 | 189 | (install-completion "^fd.bash$" "/etc/bash_completion.d") |
0f7720d1 JS |
190 | (install-completion "^fd.fish$" "/share/fish/vendor_completions.d") |
191 | (install-completion "^_fd$" "/share/zsh/site-functions") | |
9eed0a74 MR |
192 | (rename-file (string-append out "/etc/bash_completion.d/fd.bash") |
193 | (string-append out "/etc/bash_completion.d/fd")) | |
0f7720d1 JS |
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 | ||
9e225670 JS |
204 | (define-public ripgrep |
205 | (package | |
206 | (name "ripgrep") | |
16ffc3b6 | 207 | (version "11.0.2") |
9e225670 JS |
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 | |
16ffc3b6 | 216 | "0vqjr96s2rs45715hzf0g0wjahig4zjyiqfijmzzg4jyh9ni80yr")))) |
9e225670 JS |
217 | (build-system cargo-build-system) |
218 | (arguments | |
219 | `(#:cargo-inputs | |
16ffc3b6 | 220 | (("rust-bstr" ,rust-bstr-0.2) |
9e225670 JS |
221 | ("rust-clap" ,rust-clap-2) |
222 | ("rust-grep" ,rust-grep-0.2) | |
223 | ("rust-ignore" ,rust-ignore-0.4) | |
16ffc3b6 | 224 | ("rust-jemallocator" ,rust-jemallocator-0.3) |
21c8ec75 | 225 | ("rust-lazy-static" ,rust-lazy-static-1) |
9e225670 JS |
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 | |
16ffc3b6 | 232 | (("rust-serde" ,rust-serde-1.0) |
6e18b41e JK |
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")))) | |
d883e791 JK |
248 | #t)) |
249 | (replace 'install | |
250 | ;; Adapted from (guix build cargo-build-system). The flags need to | |
251 | ;; be passed to `cargo install' too, as otherwise it will build | |
252 | ;; another binary, without the features. | |
253 | (lambda* (#:key outputs #:allow-other-keys) | |
254 | (let ((out (assoc-ref outputs "out"))) | |
255 | (mkdir-p out) | |
256 | (setenv "CARGO_TARGET_DIR" "./target") | |
257 | (invoke "cargo" "install" "--path" "." "--root" out | |
258 | "--features" "pcre2"))))) | |
259 | #:cargo-build-flags '("--release" "--features" "pcre2"))) | |
6e18b41e | 260 | (native-inputs |
d883e791 JK |
261 | `(("asciidoc" ,asciidoc) |
262 | ("pcre2" ,pcre2) | |
263 | ("pkg-config" ,pkg-config))) | |
9e225670 JS |
264 | (home-page "https://github.com/BurntSushi/ripgrep") |
265 | (synopsis "Line-oriented search tool") | |
266 | (description | |
267 | "ripgrep is a line-oriented search tool that recursively searches | |
268 | your current directory for a regex pattern while respecting your | |
269 | gitignore rules.") | |
270 | (license (list license:unlicense license:expat)))) | |
c5c48761 EF |
271 | |
272 | (define-public rust-cbindgen | |
273 | (package | |
274 | (name "rust-cbindgen") | |
eab07e78 | 275 | (version "0.13.1") |
c5c48761 EF |
276 | (source |
277 | (origin | |
278 | (method url-fetch) | |
279 | (uri (crate-uri "cbindgen" version)) | |
280 | (file-name (string-append name "-" version ".crate")) | |
281 | (sha256 | |
282 | (base32 | |
eab07e78 | 283 | "0w70bnwwqyf9fr6z3rcs7m7ad791fmfmhxy828va0dkfwvamp59c")))) |
c5c48761 EF |
284 | (build-system cargo-build-system) |
285 | (arguments | |
286 | `(#:cargo-inputs | |
287 | (("clap" ,rust-clap-2) | |
288 | ("log" ,rust-log-0.4) | |
289 | ("proc-macro2" ,rust-proc-macro2-1.0) | |
290 | ("quote" ,rust-quote-1.0) | |
291 | ("serde" ,rust-serde-1.0) | |
292 | ("serde-json" ,rust-serde-json-1.0) | |
293 | ("syn" ,rust-syn-1.0) | |
ca4b5588 | 294 | ("tempfile" ,rust-tempfile-3.1) |
ef3827da | 295 | ("toml" ,rust-toml-0.5)))) |
c5c48761 EF |
296 | (home-page "https://github.com/eqrion/cbindgen/") |
297 | (synopsis "Tool for generating C bindings to Rust code") | |
298 | (description | |
299 | "This package provides a tool for generating C/C++ bindings to Rust code.") | |
300 | (license license:mpl2.0))) | |
e29315b2 | 301 | |
ca4b5588 LF |
302 | (define-public rust-cbindgen-0.12 |
303 | (package | |
304 | (inherit rust-cbindgen) | |
305 | (name "rust-cbindgen") | |
306 | (version "0.12.2") | |
307 | (source | |
308 | (origin | |
309 | (method url-fetch) | |
310 | (uri (crate-uri "cbindgen" version)) | |
311 | (file-name | |
312 | (string-append name "-" version ".tar.gz")) | |
313 | (sha256 | |
314 | (base32 | |
315 | "13jzbmjz1bmmfr0i80hw6ar484mgabx3hbpb2ynhk0ddqi0yr58m")))))) | |
316 | ||
e29315b2 JS |
317 | (define-public tokei |
318 | (package | |
319 | (name "tokei") | |
320 | (version "10.1.1") | |
321 | (source | |
322 | (origin | |
323 | (method url-fetch) | |
324 | (uri (crate-uri "tokei" version)) | |
325 | (file-name | |
326 | (string-append name "-" version ".tar.gz")) | |
327 | (sha256 | |
328 | (base32 | |
329 | "07f5laqw2k9l3k8wrg9h8p2m5d9hkfxngyacwrn3vs7mlnw8l81m")))) | |
330 | (build-system cargo-build-system) | |
331 | (arguments | |
332 | `(#:cargo-inputs | |
333 | (("rust-clap" ,rust-clap-2) | |
334 | ("rust-crossbeam-channel" ,rust-crossbeam-channel-0.4) | |
335 | ("rust-dirs" ,rust-dirs-2.0) | |
336 | ("rust-encoding-rs-io" ,rust-encoding-rs-io-0.1) | |
337 | ("rust-env-logger" ,rust-env-logger-0.7) | |
338 | ("rust-grep-searcher" ,rust-grep-searcher-0.1) | |
339 | ("rust-hex" ,rust-hex-0.4) | |
340 | ("rust-ignore" ,rust-ignore-0.4) | |
341 | ("rust-log" ,rust-log-0.4) | |
342 | ("rust-rayon" ,rust-rayon-1.3) | |
343 | ("rust-serde" ,rust-serde-1.0) | |
344 | ("rust-serde-cbor" ,rust-serde-cbor-0.10) | |
345 | ("rust-serde-derive" ,rust-serde-derive-1.0) | |
346 | ("rust-serde-json" ,rust-serde-json-1.0) | |
347 | ("rust-serde-yaml" ,rust-serde-yaml-0.8) | |
348 | ("rust-term-size" ,rust-term-size-0.3) | |
c40e3d0b | 349 | ("rust-toml" ,rust-toml-0.5)) |
e29315b2 JS |
350 | #:cargo-development-inputs |
351 | (("rust-git2" ,rust-git2-0.11) | |
352 | ("rust-handlebars" ,rust-handlebars-2.0) | |
353 | ("rust-ignore" ,rust-ignore-0.4) | |
21c8ec75 | 354 | ("rust-lazy-static" ,rust-lazy-static-1) |
e29315b2 JS |
355 | ("rust-regex" ,rust-regex-1.3) |
356 | ("rust-serde-json" ,rust-serde-json-1.0) | |
c40e3d0b EF |
357 | ("rust-tempfile" ,rust-tempfile-3.0)) |
358 | #:phases | |
359 | (modify-phases %standard-phases | |
360 | (add-after 'configure 'unvendor-libraries-from-crates | |
361 | (lambda* (#:key inputs #:allow-other-keys) | |
362 | (let ((openssl (assoc-ref inputs "openssl"))) | |
61b95c15 | 363 | (setenv "OPENSSL_DIR" openssl)) |
c40e3d0b EF |
364 | #t))))) |
365 | (native-inputs | |
366 | `(("libgit2" ,libgit2) | |
367 | ("openssl" ,openssl) | |
368 | ("pkg-config" ,pkg-config) | |
369 | ("zlib" ,zlib))) | |
e29315b2 JS |
370 | (home-page "https://tokei.rs") |
371 | (synopsis "Count code, quickly") | |
372 | (description | |
373 | "Tokei is a program that displays statistics about your code. Tokei will | |
374 | show number of files, total lines within those files and code, comments, and | |
375 | blanks grouped by language.") | |
376 | (license (list license:expat license:asl2.0)))) | |
ca4b5588 LF |
377 | |
378 | (define-public rust-cargo-c | |
379 | (package | |
380 | (name "rust-cargo-c") | |
381 | (version "0.5.2") | |
382 | (source | |
383 | (origin | |
384 | (method url-fetch) | |
385 | (uri (crate-uri "cargo-c" version)) | |
386 | (file-name | |
387 | (string-append name "-" version ".tar.gz")) | |
388 | (sha256 | |
389 | (base32 | |
390 | "1is72jm0r73pqx2g3h1n6lvrcirwd91mmajsmb3jjg4jnayfkp0w")))) | |
391 | (build-system cargo-build-system) | |
392 | (arguments | |
393 | `(#:cargo-inputs | |
394 | (("rust-cbindgen" ,rust-cbindgen-0.12) | |
395 | ("rust-pretty-env-logger" ,rust-pretty-env-logger-0.3) | |
396 | ("rust-structopt" ,rust-structopt-0.3) | |
397 | ("rust-log" ,rust-log-0.4) | |
398 | ("rust-toml" ,rust-toml-0.5) | |
399 | ("rust-cargo-metadata" ,rust-cargo-metadata-0.9) | |
400 | ("rust-serde" ,rust-serde-1.0) | |
401 | ("rust-serde-derive" ,rust-serde-derive-1.0) | |
402 | ("rust-regex" ,rust-regex-1.3)))) | |
403 | (home-page "https://github.com/lu-zero/cargo-c") | |
404 | (synopsis "Build and install C-compatible libraries") | |
405 | (description | |
406 | "This package produces and installs a correct pkg-config file, a static | |
407 | library and a dynamic library, and a C header to be used by any C (and | |
408 | C-compatible) software.") | |
409 | (license license:expat))) |