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> |
9e225670 JS |
5 | ;;; |
6 | ;;; This file is part of GNU Guix. | |
7 | ;;; | |
8 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
9 | ;;; under the terms of the GNU General Public License as published by | |
10 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
11 | ;;; your option) any later version. | |
12 | ;;; | |
13 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
14 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | ;;; GNU General Public License for more details. | |
17 | ;;; | |
18 | ;;; You should have received a copy of the GNU General Public License | |
19 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
20 | ||
21 | (define-module (gnu packages rust-apps) | |
22 | #:use-module ((guix licenses) #:prefix license:) | |
23 | #:use-module (guix build-system cargo) | |
24 | #:use-module (guix download) | |
25 | #:use-module (guix packages) | |
c40e3d0b EF |
26 | #:use-module (gnu packages compression) |
27 | #:use-module (gnu packages crates-io) | |
6e18b41e | 28 | #:use-module (gnu packages documentation) |
0f7720d1 | 29 | #:use-module (gnu packages jemalloc) |
d883e791 | 30 | #:use-module (gnu packages pcre) |
c40e3d0b EF |
31 | #:use-module (gnu packages pkg-config) |
32 | #:use-module (gnu packages tls) | |
33 | #:use-module (gnu packages version-control)) | |
9e225670 | 34 | |
d42cbbba JS |
35 | (define-public exa |
36 | (package | |
37 | (name "exa") | |
38 | (version "0.9.0") | |
39 | (source | |
40 | (origin | |
41 | (method url-fetch) | |
42 | (uri (crate-uri "exa" version)) | |
43 | (file-name | |
44 | (string-append name "-" version ".tar.gz")) | |
45 | (sha256 | |
46 | (base32 | |
47 | "1s902xgplz1167k0r7x235p914lprpsqy2if0kpa1mlb0fswqqq4")))) | |
48 | (build-system cargo-build-system) | |
49 | (arguments | |
50 | `(#:cargo-inputs | |
51 | (("rust-ansi-term" ,rust-ansi-term-0.12) | |
52 | ("rust-datetime" ,rust-datetime-0.4) | |
53 | ("rust-env-logger" ,rust-env-logger-0.6) | |
54 | ("rust-git2" ,rust-git2-0.9) | |
55 | ("rust-glob" ,rust-glob-0.3) | |
21c8ec75 | 56 | ("rust-lazy-static" ,rust-lazy-static-1) |
d42cbbba JS |
57 | ("rust-libc" ,rust-libc-0.2) |
58 | ("rust-locale" ,rust-locale-0.2) | |
59 | ("rust-log" ,rust-log-0.4) | |
60 | ("rust-natord" ,rust-natord-1.0) | |
61 | ("rust-num-cpus" ,rust-num-cpus-1.11) | |
62 | ("rust-number-prefix" ,rust-number-prefix-0.3) | |
63 | ("rust-scoped-threadpool" ,rust-scoped-threadpool-0.1) | |
64 | ("rust-term-grid" ,rust-term-grid-0.1) | |
65 | ("rust-term-size" ,rust-term-size-0.3) | |
66 | ("rust-unicode-width" ,rust-unicode-width-0.1) | |
67 | ("rust-users" ,rust-users-0.9) | |
68 | ("rust-zoneinfo-compiled" ,rust-zoneinfo-compiled-0.4)) | |
69 | #:cargo-development-inputs | |
70 | (("rust-datetime" ,rust-datetime-0.4)) | |
71 | #:phases | |
72 | (modify-phases %standard-phases | |
73 | (add-after 'configure 'dont-vendor-sources | |
74 | (lambda* (#:key inputs #:allow-other-keys) | |
75 | (let ((openssl (assoc-ref inputs "openssl"))) | |
76 | (setenv "OPENSSL_DIR" openssl)) | |
77 | #t)) | |
78 | ;; Ignoring failing tests. | |
79 | ;; Reported in https://github.com/ogham/exa/issues/318 | |
80 | (add-before 'check 'disable-failing-tests | |
81 | (lambda _ | |
82 | (substitute* "src/options/mod.rs" | |
83 | (("^.*fn oneline_across.*" oneline-across) | |
84 | (string-append "#[ignore]\n" oneline-across))) | |
85 | ||
86 | (substitute* "src/options/view.rs" | |
87 | (("test!\\(across:.*") "") | |
88 | (("test!\\(empty:.*") "") | |
89 | (("test!\\(gracross:.*") "") | |
90 | (("test!\\(grid:.*") "") | |
91 | (("test!\\(icons:.*") "") | |
92 | (("test!\\(just_binary:.*") "") | |
93 | (("test!\\(just_blocks:.*") "") | |
94 | (("test!\\(just_bytes:.*") "") | |
95 | (("test!\\(just_git:.*") "") | |
96 | (("test!\\(just_group:.*") "") | |
97 | (("test!\\(just_header:.*") "") | |
98 | (("test!\\(just_inode:.*") "") | |
99 | (("test!\\(just_links:.*") "") | |
100 | (("test!\\(leg:.*") "") | |
101 | (("test!\\(lid:.*") "") | |
102 | (("test!\\(original_g:.*") "")) | |
b76473ec EF |
103 | #t)) |
104 | (add-after 'install 'install-extras | |
105 | (lambda* (#:key outputs #:allow-other-keys) | |
106 | (let* ((out (assoc-ref outputs "out")) | |
107 | (share (string-append out "/share")) | |
108 | (man1 (string-append share "/man/man1"))) | |
109 | (install-file "contrib/man/exa.1" man1) | |
110 | (mkdir-p (string-append out "/etc/bash_completion.d")) | |
111 | (mkdir-p (string-append share "/fish/vendor_completions.d")) | |
112 | (mkdir-p (string-append share "/zsh/site-functions")) | |
113 | (copy-file "contrib/completions.bash" | |
114 | (string-append out "/etc/bash_completion.d/exa")) | |
115 | (copy-file "contrib/completions.fish" | |
116 | (string-append share "/fish/vendor_completions.d/exa.fish")) | |
117 | (copy-file "contrib/completions.zsh" | |
118 | (string-append share "/zsh/site-functions/_exa")) | |
119 | #t)))))) | |
d42cbbba JS |
120 | (inputs |
121 | `(("libgit2" ,libgit2) | |
122 | ("zlib" ,zlib))) | |
123 | (native-inputs | |
124 | `(("pkg-config" ,pkg-config))) | |
125 | (home-page "https://the.exa.website/") | |
126 | (synopsis "Modern replacement for ls") | |
127 | (description "@code{exa} is a modern replacement for the command-line | |
128 | program @code{ls}. It uses colours to distinguish file types and metadata. It | |
129 | also knows about symlinks, extended attributes, and Git.") | |
130 | (license license:expat))) | |
131 | ||
0f7720d1 JS |
132 | (define-public fd |
133 | (package | |
134 | (name "fd") | |
135 | (version "7.4.0") | |
136 | (source | |
137 | (origin | |
138 | (method url-fetch) | |
139 | (uri (crate-uri "fd-find" version)) | |
140 | (file-name | |
141 | (string-append name "-" version ".tar.gz")) | |
142 | (sha256 | |
143 | (base32 | |
144 | "147m872zff0srwq9vaxkkbab06g3fkklbk1g2lx90vdhgs37f5xj")))) | |
145 | (build-system cargo-build-system) | |
146 | (arguments | |
147 | `(#:cargo-inputs | |
148 | (("rust-ansi-term" ,rust-ansi-term-0.12) | |
149 | ("rust-atty" ,rust-atty-0.2) | |
150 | ("rust-clap" ,rust-clap-2) | |
151 | ("rust-ctrlc" ,rust-ctrlc-3.1) | |
152 | ("rust-globset" ,rust-globset-0.4) | |
153 | ("rust-humantime" ,rust-humantime-1.3) | |
154 | ("rust-ignore" ,rust-ignore-0.4) | |
155 | ("rust-jemallocator" ,rust-jemallocator-0.3) | |
21c8ec75 | 156 | ("rust-lazy-static" ,rust-lazy-static-1) |
0f7720d1 JS |
157 | ("rust-libc" ,rust-libc-0.2) |
158 | ("rust-lscolors" ,rust-lscolors-0.6) | |
159 | ("rust-num-cpus" ,rust-num-cpus-1.10) | |
160 | ("rust-regex" ,rust-regex-1.3) | |
161 | ("rust-regex-syntax" ,rust-regex-syntax-0.6) | |
162 | ("rust-version-check" ,rust-version-check-0.9)) | |
163 | #:cargo-development-inputs | |
164 | (("rust-diff" ,rust-diff-0.1) | |
165 | ("rust-filetime" ,rust-filetime-0.2) | |
166 | ("rust-tempdir" ,rust-tempdir-0.3)) | |
167 | #:phases | |
168 | (modify-phases %standard-phases | |
169 | (add-after 'unpack 'override-jemalloc | |
170 | (lambda* (#:key inputs #:allow-other-keys) | |
171 | (let ((jemalloc (assoc-ref inputs "jemalloc"))) | |
172 | (setenv "JEMALLOC_OVERRIDE" | |
173 | (string-append jemalloc "/lib/libjemalloc.so"))) | |
174 | #t)) | |
175 | (add-after 'install 'install-extra | |
176 | (lambda* (#:key outputs #:allow-other-keys) | |
177 | (let* ((out (assoc-ref outputs "out")) | |
178 | (install-completion | |
179 | (lambda (completion out-dir) | |
180 | (for-each | |
181 | (lambda (f) | |
182 | (install-file f (string-append out out-dir))) | |
183 | (find-files "target/release/build/" completion))))) | |
184 | ;; Manpages | |
185 | (install-file "doc/fd.1" (string-append out "/share/man/man1")) | |
186 | ;; Completions | |
187 | (install-completion "^fd.bash$" "/etc/bash-completion.d") | |
188 | (install-completion "^fd.fish$" "/share/fish/vendor_completions.d") | |
189 | (install-completion "^_fd$" "/share/zsh/site-functions") | |
190 | (rename-file (string-append out "/etc/bash-completion.d/fd.bash") | |
191 | (string-append out "/etc/bash-completion.d/fd")) | |
192 | #t)))))) | |
193 | (inputs `(("jemalloc" ,jemalloc))) | |
194 | (home-page "https://github.com/sharkdp/fd") | |
195 | (synopsis "Simple, fast and user-friendly alternative to find") | |
196 | (description | |
197 | "@code{fd} is a simple, fast and user-friendly alternative to @code{find}. | |
198 | While it does not seek to mirror all of find's powerful functionality, it | |
199 | provides defaults for 80% of the use cases.") | |
200 | (license (list license:expat license:asl2.0)))) | |
201 | ||
9e225670 JS |
202 | (define-public ripgrep |
203 | (package | |
204 | (name "ripgrep") | |
16ffc3b6 | 205 | (version "11.0.2") |
9e225670 JS |
206 | (source |
207 | (origin | |
208 | (method url-fetch) | |
209 | (uri (crate-uri "ripgrep" version)) | |
210 | (file-name | |
211 | (string-append name "-" version ".tar.gz")) | |
212 | (sha256 | |
213 | (base32 | |
16ffc3b6 | 214 | "0vqjr96s2rs45715hzf0g0wjahig4zjyiqfijmzzg4jyh9ni80yr")))) |
9e225670 JS |
215 | (build-system cargo-build-system) |
216 | (arguments | |
217 | `(#:cargo-inputs | |
16ffc3b6 | 218 | (("rust-bstr" ,rust-bstr-0.2) |
9e225670 JS |
219 | ("rust-clap" ,rust-clap-2) |
220 | ("rust-grep" ,rust-grep-0.2) | |
221 | ("rust-ignore" ,rust-ignore-0.4) | |
16ffc3b6 | 222 | ("rust-jemallocator" ,rust-jemallocator-0.3) |
21c8ec75 | 223 | ("rust-lazy-static" ,rust-lazy-static-1) |
9e225670 JS |
224 | ("rust-log" ,rust-log-0.4) |
225 | ("rust-num-cpus" ,rust-num-cpus-1.10) | |
226 | ("rust-regex" ,rust-regex-1.1) | |
227 | ("rust-serde-json" ,rust-serde-json-1.0) | |
228 | ("rust-termcolor" ,rust-termcolor-1.0)) | |
229 | #:cargo-development-inputs | |
16ffc3b6 | 230 | (("rust-serde" ,rust-serde-1.0) |
6e18b41e JK |
231 | ("rust-serde-derive" ,rust-serde-derive-1.0)) |
232 | #:modules ((ice-9 match) | |
233 | (guix build cargo-build-system) | |
234 | (guix build utils)) | |
235 | #:phases | |
236 | (modify-phases %standard-phases | |
237 | (add-after 'build 'install-manpage | |
238 | ;; NOTE: This is done before 'check so that there's only one output | |
239 | ;; directory with the man page. | |
240 | (lambda* (#:key outputs #:allow-other-keys) | |
241 | (match (find-files "target" "^rg\\.1$") | |
242 | ((manpage) | |
243 | (install-file manpage (string-append | |
244 | (assoc-ref outputs "out") | |
245 | "/share/man/man1")))) | |
d883e791 JK |
246 | #t)) |
247 | (replace 'install | |
248 | ;; Adapted from (guix build cargo-build-system). The flags need to | |
249 | ;; be passed to `cargo install' too, as otherwise it will build | |
250 | ;; another binary, without the features. | |
251 | (lambda* (#:key outputs #:allow-other-keys) | |
252 | (let ((out (assoc-ref outputs "out"))) | |
253 | (mkdir-p out) | |
254 | (setenv "CARGO_TARGET_DIR" "./target") | |
255 | (invoke "cargo" "install" "--path" "." "--root" out | |
256 | "--features" "pcre2"))))) | |
257 | #:cargo-build-flags '("--release" "--features" "pcre2"))) | |
6e18b41e | 258 | (native-inputs |
d883e791 JK |
259 | `(("asciidoc" ,asciidoc) |
260 | ("pcre2" ,pcre2) | |
261 | ("pkg-config" ,pkg-config))) | |
9e225670 JS |
262 | (home-page "https://github.com/BurntSushi/ripgrep") |
263 | (synopsis "Line-oriented search tool") | |
264 | (description | |
265 | "ripgrep is a line-oriented search tool that recursively searches | |
266 | your current directory for a regex pattern while respecting your | |
267 | gitignore rules.") | |
268 | (license (list license:unlicense license:expat)))) | |
c5c48761 EF |
269 | |
270 | (define-public rust-cbindgen | |
271 | (package | |
272 | (name "rust-cbindgen") | |
eab07e78 | 273 | (version "0.13.1") |
c5c48761 EF |
274 | (source |
275 | (origin | |
276 | (method url-fetch) | |
277 | (uri (crate-uri "cbindgen" version)) | |
278 | (file-name (string-append name "-" version ".crate")) | |
279 | (sha256 | |
280 | (base32 | |
eab07e78 | 281 | "0w70bnwwqyf9fr6z3rcs7m7ad791fmfmhxy828va0dkfwvamp59c")))) |
c5c48761 EF |
282 | (build-system cargo-build-system) |
283 | (arguments | |
284 | `(#:cargo-inputs | |
285 | (("clap" ,rust-clap-2) | |
286 | ("log" ,rust-log-0.4) | |
287 | ("proc-macro2" ,rust-proc-macro2-1.0) | |
288 | ("quote" ,rust-quote-1.0) | |
289 | ("serde" ,rust-serde-1.0) | |
290 | ("serde-json" ,rust-serde-json-1.0) | |
291 | ("syn" ,rust-syn-1.0) | |
292 | ("tempfile" ,rust-tempfile-3.0) | |
ef3827da | 293 | ("toml" ,rust-toml-0.5)))) |
c5c48761 EF |
294 | (home-page "https://github.com/eqrion/cbindgen/") |
295 | (synopsis "Tool for generating C bindings to Rust code") | |
296 | (description | |
297 | "This package provides a tool for generating C/C++ bindings to Rust code.") | |
298 | (license license:mpl2.0))) | |
e29315b2 JS |
299 | |
300 | (define-public tokei | |
301 | (package | |
302 | (name "tokei") | |
303 | (version "10.1.1") | |
304 | (source | |
305 | (origin | |
306 | (method url-fetch) | |
307 | (uri (crate-uri "tokei" version)) | |
308 | (file-name | |
309 | (string-append name "-" version ".tar.gz")) | |
310 | (sha256 | |
311 | (base32 | |
312 | "07f5laqw2k9l3k8wrg9h8p2m5d9hkfxngyacwrn3vs7mlnw8l81m")))) | |
313 | (build-system cargo-build-system) | |
314 | (arguments | |
315 | `(#:cargo-inputs | |
316 | (("rust-clap" ,rust-clap-2) | |
317 | ("rust-crossbeam-channel" ,rust-crossbeam-channel-0.4) | |
318 | ("rust-dirs" ,rust-dirs-2.0) | |
319 | ("rust-encoding-rs-io" ,rust-encoding-rs-io-0.1) | |
320 | ("rust-env-logger" ,rust-env-logger-0.7) | |
321 | ("rust-grep-searcher" ,rust-grep-searcher-0.1) | |
322 | ("rust-hex" ,rust-hex-0.4) | |
323 | ("rust-ignore" ,rust-ignore-0.4) | |
324 | ("rust-log" ,rust-log-0.4) | |
325 | ("rust-rayon" ,rust-rayon-1.3) | |
326 | ("rust-serde" ,rust-serde-1.0) | |
327 | ("rust-serde-cbor" ,rust-serde-cbor-0.10) | |
328 | ("rust-serde-derive" ,rust-serde-derive-1.0) | |
329 | ("rust-serde-json" ,rust-serde-json-1.0) | |
330 | ("rust-serde-yaml" ,rust-serde-yaml-0.8) | |
331 | ("rust-term-size" ,rust-term-size-0.3) | |
c40e3d0b | 332 | ("rust-toml" ,rust-toml-0.5)) |
e29315b2 JS |
333 | #:cargo-development-inputs |
334 | (("rust-git2" ,rust-git2-0.11) | |
335 | ("rust-handlebars" ,rust-handlebars-2.0) | |
336 | ("rust-ignore" ,rust-ignore-0.4) | |
21c8ec75 | 337 | ("rust-lazy-static" ,rust-lazy-static-1) |
e29315b2 JS |
338 | ("rust-regex" ,rust-regex-1.3) |
339 | ("rust-serde-json" ,rust-serde-json-1.0) | |
c40e3d0b EF |
340 | ("rust-tempfile" ,rust-tempfile-3.0)) |
341 | #:phases | |
342 | (modify-phases %standard-phases | |
343 | (add-after 'configure 'unvendor-libraries-from-crates | |
344 | (lambda* (#:key inputs #:allow-other-keys) | |
345 | (let ((openssl (assoc-ref inputs "openssl"))) | |
61b95c15 | 346 | (setenv "OPENSSL_DIR" openssl)) |
c40e3d0b EF |
347 | #t))))) |
348 | (native-inputs | |
349 | `(("libgit2" ,libgit2) | |
350 | ("openssl" ,openssl) | |
351 | ("pkg-config" ,pkg-config) | |
352 | ("zlib" ,zlib))) | |
e29315b2 JS |
353 | (home-page "https://tokei.rs") |
354 | (synopsis "Count code, quickly") | |
355 | (description | |
356 | "Tokei is a program that displays statistics about your code. Tokei will | |
357 | show number of files, total lines within those files and code, comments, and | |
358 | blanks grouped by language.") | |
359 | (license (list license:expat license:asl2.0)))) |