projects/guix·blob ruby-team · refs

1583 lines · 66.0 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2025 Hilton Chain <[email protected]>
3;;; Copyright © 2023-2025 Efraim Flashner <[email protected]>
4;;; Copyright © 2025 Noé Lopez <[email protected]>
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-sources)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (guix gexp)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix git-download)
27 #:use-module (guix search-paths)
28 #:use-module (guix build-system cargo)
29 #:use-module ((guix config) #:select (%storedir))
30 #:use-module (guix utils)
31 #:use-module (gnu packages)
32 #:use-module (gnu packages assembly)
33 #:use-module (gnu packages base)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages llvm)
36 #:use-module (gnu packages golang)
37 #:use-module (gnu packages perl)
38 #:use-module (gnu packages pkg-config)
39 #:use-module (gnu packages python)
40 #:use-module (gnu packages regex)
41 #:use-module (gnu packages rust)
42 #:use-module (gnu packages statistics)
43 #:use-module (gnu packages virtualization))
44
45;;;
46;;; Cargo workspaces and Rust libraries requiring external inputs to unbundle.
47;;; These packages are hidden, as they are not interesting to users.
48;;;
49
50(define gemoji-source-for-rust-deunicode-1
51 (let ((version "4.1.0"))
52 (origin
53 (method git-fetch)
54 (uri (git-reference
55 (url "https://github.com/github/gemoji")
56 (commit (string-append "v" version))))
57 (file-name "gemoji-checkout")
58 (sha256
59 (base32
60 "1yhs9lj9gnzbvimv0y5f1a4my0slbvygkcjjkaxd4wkkyfvfbkxy")))))
61
62;; Workspace dependency of zed.
63;;
64;; Cargo side: Cargo unifies dependency versions across zed's
65;; workspace, including this package's transitive dependencies,
66;; and records them in zed's Cargo.lock.
67;;
68;; Guix side: zed's cargo-inputs entry (generated from zed's
69;; Cargo.lock) already contains all of this package's transitive
70;; dependencies, so this package reuses zed's cargo-inputs.
71(define-public rust-alacritty-0.25.1.9d9640d
72 (hidden-package
73 (package
74 (name "rust-alacritty")
75 (version "0.25.1")
76 (source
77 (origin
78 (method git-fetch)
79 (uri
80 (git-reference
81 (url "https://github.com/zed-industries/alacritty")
82 (commit "9d9640d4e56d67a09d049f9c0a300aae08d4f61e")))
83 (file-name
84 (git-file-name "rust-alacritty" "0.25.1.9d9640d"))
85 (sha256
86 (base32 "16g4jdbwdhqihc2x403fdaxf6m9gcj44cm53dyk68b3wl7chh29s"))))
87 (build-system cargo-build-system)
88 (arguments
89 (list #:skip-build? #t
90 #:install-source? #t
91 #:cargo-package-crates ''("alacritty_terminal")
92 #:cargo-package-flags ''("--no-metadata" "--no-verify"
93 "--exclude-lockfile")))
94 (inputs (cargo-inputs 'rust-alacritty-0.25.1.9d9640d))
95 (home-page "https://github.com/zed-industries/alacritty")
96 (synopsis "Terminal emulator library")
97 (description
98 "This package provides a terminal emulator library.")
99 (license license:asl2.0))))
100
101(define-public rust-bbqueue-for-meilisearch
102 (let ((commit "e8af4a4bccc8eb36b2b0442c4a9c5cb839d1cea2")
103 (revision "0"))
104 (hidden-package
105 (package
106 (name "rust-bbqueue")
107 (version (git-version "0.5.1" revision commit))
108 (source
109 (origin
110 (method git-fetch)
111 (uri
112 (git-reference
113 (url "https://github.com/meilisearch/bbqueue")
114 (commit commit)))
115 (file-name
116 (git-file-name name version))
117 (sha256
118 (base32 "1hzpfjykvpgxsjdaak1bkb4mgg2yim4db9ph5bzx6p1s4b3001sg"))))
119 (build-system cargo-build-system)
120 (arguments
121 (list #:skip-build? #t
122 #:install-source? #t
123 #:cargo-package-crates ''("bbqueue")))
124 (inputs (cargo-inputs 'rust-bbqueue-for-meilisearch))
125 (home-page "https://github.com/meilisearch/bbqueue")
126 (synopsis "Single Producer Single Consumer, lockless, no_std,
127thread safe, queue, based on BipBuffers")
128 (description
129 "This package provides a Single Producer Single Consumer,
130lockless, no_std, thread safe, queue, based on BipBuffers.")
131 (license license:asl2.0)))))
132
133;; Workspace dependency of zed.
134;;
135;; Cargo side: Cargo unifies dependency versions across zed's
136;; workspace, including this package's transitive dependencies,
137;; and records them in zed's Cargo.lock.
138;;
139;; Guix side: zed's cargo-inputs entry (generated from zed's
140;; Cargo.lock) already contains all of this package's transitive
141;; dependencies, so this package reuses zed's cargo-inputs.
142(define-public rust-candle-0.9.1.724d75e
143 (hidden-package
144 (package
145 (name "rust-candle")
146 (version "0.9.1")
147 (source
148 (origin
149 (method git-fetch)
150 (uri
151 (git-reference
152 (url "https://github.com/zed-industries/candle")
153 (commit "724d75eb3deebefe83f2a7381a45d4fac6eda383")))
154 (file-name
155 (git-file-name "rust-candle" "0.9.1.724d75e"))
156 (sha256
157 (base32 "1n9g84g0ikldw42f0j3ad975vjvx6ildwqh8dw3zi3rps518hx14"))
158 (patches
159 (search-patches
160 "rust-candle-0.9.1-add-candle-onnx-to-workspace.patch"))))
161 (build-system cargo-build-system)
162 (arguments
163 (list #:skip-build? #t
164 #:install-source? #t
165 #:cargo-package-crates ''("candle-core"
166 "candle-nn"
167 "candle-onnx")
168 #:cargo-package-flags ''("--no-metadata" "--no-verify"
169 "--exclude-lockfile")))
170 (inputs (cargo-inputs 'rust-candle-0.9.1.724d75e))
171 (home-page "https://github.com/huggingface/candle")
172 (synopsis "Minimalist ML framework for Rust")
173 (description
174 "This package provides a minimalist ML framework for Rust.")
175 (license (list license:asl2.0 license:expat)))))
176
177;; Workspace dependency of zed.
178;;
179;; Cargo side: Cargo unifies dependency versions across zed's
180;; workspace, including this package's transitive dependencies,
181;; and records them in zed's Cargo.lock.
182;;
183;; Guix side: zed's cargo-inputs entry (generated from zed's
184;; Cargo.lock) already contains all of this package's transitive
185;; dependencies, so this package reuses zed's cargo-inputs.
186(define-public rust-dap-types-0.0.1.1b461b3
187 (hidden-package
188 (package
189 (name "rust-dap-types")
190 (version "0.0.1")
191 (source
192 (origin
193 (method git-fetch)
194 (uri
195 (git-reference
196 (url "https://github.com/zed-industries/dap-types")
197 (commit "1b461b310481d01e02b2603c16d7144b926339f8")))
198 (file-name
199 (git-file-name "rust-dap-types" "0.0.1.1b461b3"))
200 (sha256
201 (base32 "0snc05ia4jvykajavsvyxcyn24s2jxbw7k9wmby23r1aqxf31i0z"))))
202 (build-system cargo-build-system)
203 (arguments
204 (list #:skip-build? #t
205 #:install-source? #t
206 #:cargo-package-crates ''("dap-types")
207 #:cargo-package-flags ''("--no-metadata" "--no-verify"
208 "--exclude-lockfile")))
209 (inputs (cargo-inputs 'rust-dap-types-0.0.1.1b461b3))
210 (home-page "https://github.com/zed-industries/dap-types")
211 (synopsis "Rust types for the Debug Adapter Protocol")
212 (description
213 "This package provides Rust types for the Debug Adapter Protocol.")
214 (license (list license:asl2.0 license:expat)))))
215
216(define-public rust-icicle-emu-0.1.0.4d7ed93
217 (let ((commit "4d7ed93254a20b7e5c16bd7b0c6b46db49e1c72e")
218 (revision "0"))
219 (package
220 (name "rust-icicle-emu")
221 (version (git-version "0.1.0" revision commit))
222 (source
223 (origin
224 (method git-fetch)
225 (uri (git-reference
226 (url "https://github.com/icicle-emu/icicle-emu.git")
227 (commit commit)))
228 (file-name (git-file-name name version))
229 (sha256
230 (base32 "09g5gp4v18r8f5blzpmgxy7kmgx016zjph2affa5zlxm07d866gk"))))
231 (build-system cargo-build-system)
232 (arguments
233 (list
234 #:skip-build? #t
235 #:cargo-package-crates ''("pcode" "sleigh-parse"
236 "sleigh-runtime"
237 "sleigh-compile"
238 "icicle-mem"
239 "icicle-cpu"
240 "icicle-linux"
241 "icicle-jit"
242 "icicle-vm"
243 "icicle-fuzzing")
244 #:phases
245 #~(modify-phases %standard-phases
246 (add-after 'unpack 'use-guix-vendored-dependencies
247 (lambda _
248 (for-each (lambda (file)
249 (substitute* file
250 (("^pcode = \\{ ([^}]+) \\}" all opts)
251 (format #f "pcode = { ~a, version = \"*\" }~%" opts))
252 (("^sleigh-parse = \\{ ([^}]+) \\}" all opts)
253 (format #f "sleigh-parse = { ~a, version = \"*\" }~%" opts))
254 (("^sleigh-compile = \\{ ([^}]+) \\}" all opts)
255 (format #f "sleigh-compile = { ~a, version = \"*\" }~%" opts))
256 (("^sleigh-runtime = \\{ ([^}]+) \\}" all opts)
257 (format #f "sleigh-runtime = { ~a, version = \"*\" }~%" opts))
258 (("^icicle-([a-z]+).*$" all pkg)
259 (format #f "icicle-~a = { version = \"*\" }\n" pkg))))
260 (find-files "." "Cargo.toml")))))))
261 (inputs (cargo-inputs 'rust-icicle-emu-0.1.0.4d7ed93))
262 (home-page "https://github.com/icicle-emu/icicle-emu")
263 (synopsis "Core emulator components for Icicle")
264 (description
265 "Experimental fuzzing-specific, multi-architecture emulation framework.")
266 (license (list license:asl2.0 license:expat)))))
267
268(define-public rust-deunicode-1
269 (hidden-package
270 (package
271 (name "rust-deunicode")
272 (version "1.6.1")
273 (source (origin
274 (method git-fetch)
275 (uri (git-reference
276 (url "https://github.com/kornelski/deunicode")
277 (commit (string-append "v" version))))
278 (file-name (git-file-name name version))
279 (sha256
280 (base32
281 "0bhbkfhh5qd4ygx47jj7j6h722i1skmkwashmj5wlh648f5gdmx4"))
282 (modules '((guix build utils)))
283 (snippet
284 '(for-each delete-file-recursively
285 '("scripts/gemoji"
286 "src/mapping.txt"
287 "src/pointers.bin")))))
288 (build-system cargo-build-system)
289 (arguments
290 (list #:skip-build? #t
291 #:cargo-package-crates ''("deunicode")
292 #:phases
293 #~(modify-phases %standard-phases
294 (add-before 'build 'compress-data
295 (lambda _
296 (with-directory-excursion "scripts"
297 (copy-recursively
298 #+(this-package-native-input "gemoji-checkout")
299 "gemoji")
300 (invoke "cargo" "run")))))))
301 (native-inputs (list gemoji-source-for-rust-deunicode-1))
302 ;; scripts/Cargo.toml
303 (inputs (cargo-inputs 'rust-deunicode-1))
304 (home-page "https://lib.rs/crates/deunicode")
305 (synopsis "Convert Unicode strings to pure ASCII")
306 (description
307 "This package converts Unicode strings to pure ASCII by intelligently
308transliterating them. It supports Emoji and Chinese.")
309 (license license:bsd-3))))
310
311(define-public rust-deunicode-1.6.2.cfb8552
312 (let ((commit "cfb8552fbbdf6d1f3f996ee4f2e78ec5e482bcef"))
313 (hidden-package
314 (package
315 (inherit rust-deunicode-1)
316 (version "1.6.2")
317 (source (origin
318 (inherit (package-source rust-deunicode-1))
319 (uri (git-reference
320 (url "https://github.com/kornelski/deunicode")
321 (commit commit)))
322 (file-name (git-file-name "rust-deunicode" version))
323 ;; scripts/Cargo.toml now depends on the local deunicode
324 ;; crate, so keep the shipped generated data long enough for
325 ;; the generator to build before it overwrites them.
326 (snippet '(delete-file-recursively "scripts/gemoji"))
327 (sha256
328 (base32
329 "1khwjqx1qplwf9g1n6vgh2wk3j02j5gils95xx2kc4absbv20wdc"))))
330 ;; scripts/Cargo.toml now includes a local path dependency on the
331 ;; deunicode crate itself. That self-dependency is resolved from the
332 ;; checkout and does not need a cargo input.
333 (inputs (cargo-inputs 'rust-deunicode-1.6.2.cfb8552))))))
334
335;; Workspace dependency of r-pizzarr.
336(define-public rust-extendr-0.8.1.93d7244
337 (let ((commit "93d7244e3145d94186bc2f35258ad0ef25a28908")
338 (revision "1"))
339 (hidden-package
340 (package
341 (name "rust-extendr")
342 (version (git-version "0.8.1" revision commit))
343 (source (origin
344 (method git-fetch)
345 (uri (git-reference
346 (url "https://github.com/extendr/extendr")
347 (commit commit)))
348 (file-name (git-file-name name version))
349 (sha256
350 (base32
351 "03d16y7f1r0y1s8gwzw7wzn5yhcqr1wn0vga9dvdjxpbga372vx7"))))
352 (build-system cargo-build-system)
353 (arguments
354 (list
355 #:cargo-package-crates
356 ;; Note that the order matters!
357 '(list "extendr-ffi"
358 "extendr-macros"
359 "extendr-api"
360 "extendr-engine")
361 #:phases
362 #~(modify-phases %standard-phases
363 (add-after 'unpack 'set-R_HOME
364 (lambda _
365 (delete-file-recursively ".cargo")
366 (setenv "R_HOME"
367 (string-append
368 #$(this-package-input "r-minimal")
369 "/lib/R")))))))
370 (inputs (cons r-minimal (cargo-inputs 'extendr)))
371 (home-page "https://extendr.rs/")
372 (synopsis "R extension library for Rust")
373 (description "This library allows you to extend R with Rust. It can be
374used to write R packages that link with Rust libraries.")
375 (license license:expat)))))
376
377;; Workspace dependency of zed.
378;;
379;; Cargo side: Cargo unifies dependency versions across zed's
380;; workspace, including this package's transitive dependencies,
381;; and records them in zed's Cargo.lock.
382;;
383;; Guix side: zed's cargo-inputs entry (generated from zed's
384;; Cargo.lock) already contains all of this package's transitive
385;; dependencies, so this package reuses zed's cargo-inputs.
386(define-public rust-gh-workflow-0.8.0.c9eac0e
387 (hidden-package
388 (package
389 (name "rust-gh-workflow")
390 (version "0.8.0")
391 (source
392 (origin
393 (method git-fetch)
394 (uri
395 (git-reference
396 (url "https://github.com/zed-industries/gh-workflow")
397 (commit "c9eac0ed361583e1072860d96776fa52775b82ac")))
398 (file-name
399 (git-file-name "rust-gh-workflow" "0.8.0.c9eac0e"))
400 (sha256
401 (base32 "172bn9b16f7qj3mn0h8r8bwiiiw2awgqlzj5n6f2gjcgk5nmh1hp"))))
402 (build-system cargo-build-system)
403 (arguments
404 (list #:skip-build? #t
405 #:install-source? #t
406 #:cargo-package-crates ''("gh-workflow-macros"
407 "gh-workflow")
408 #:cargo-package-flags ''("--no-metadata" "--no-verify"
409 "--exclude-lockfile")))
410 (inputs (cargo-inputs 'rust-gh-workflow-0.8.0.c9eac0e))
411 (home-page "https://github.com/tailcallhq/gh-workflow")
412 (synopsis "Type-safe GitHub Actions workflow generation")
413 (description
414 "This package provides type-safe GitHub Actions workflow generation.")
415 (license license:expat))))
416
417(define-public rust-hypher-0.1
418 (hidden-package
419 (package
420 (name "rust-hypher")
421 (version "0.1.7")
422 (source
423 (origin
424 (method git-fetch)
425 (uri (git-reference
426 (url "https://github.com/typst/hypher")
427 (commit (string-append "v" version))))
428 (file-name (git-file-name name version))
429 (sha256
430 (base32 "0nqwrk9fi9d9rn4sj081k1v5zhls8xg6rsmrrickv362p8zw0mlj"))
431 (modules '((guix build utils)))
432 ;; Pre-generated.
433 (snippet '(for-each delete-file (find-files "tries")))))
434 (build-system cargo-build-system)
435 (arguments
436 (list
437 #:skip-build? #t
438 #:cargo-package-crates ''("hypher")
439 #:phases
440 #~(modify-phases %standard-phases
441 (add-after 'unpack 'regenerate
442 (lambda _
443 ;; Stop the attempted dependency retrieval for a bench-marking
444 ;; tool.
445 (substitute* "Cargo.toml" (("^members.+$") ""))
446 ;; --no-default-features lets us avoid using the upstream
447 ;; source's pre-generated tries when running the
448 ;; trie-regenerating "generate" test. We are throwing library
449 ;; binary away, anyways, because we only want the source.
450 ;; See also: <https://github.com/typst/hypher/issues/19>.
451 (false-if-exception
452 (invoke "cargo" "test" "--test" "generate"
453 "--no-default-features"))
454 (delete-file-recursively "target"))))))
455 (home-page "https://github.com/typst/hypher")
456 (synopsis "Separate words into syllables")
457 (description "@code{hypher} is a Rust library for syllabification.")
458 (license (list license:expat license:asl2.0)))))
459
460(define-public rust-opentelemetry-for-stalwart
461 (let ((commit "274b4d324794280ce6f4def095a3428197a9e6e3")
462 (revision "0"))
463 (hidden-package
464 (package
465 (name "rust-opentelemetry")
466 (version (git-version "0.31.0" revision commit))
467 (source
468 (origin
469 (method git-fetch)
470 (uri (git-reference
471 (url "https://github.com/stalwartlabs/opentelemetry-rust")
472 (commit commit)))
473 (file-name (git-file-name name version))
474 (sha256
475 (base32 "1k6mkvzbznnjzf38rl5xvzvdgp9kvd1xyk0zykwjzmh1hzcfgpws"))))
476 (build-system cargo-build-system)
477 (arguments (list #:skip-build? #t
478 #:cargo-package-crates
479 ''("opentelemetry"
480 "opentelemetry-http"
481 "opentelemetry_sdk"
482 "opentelemetry-proto"
483 "opentelemetry-otlp"
484 "opentelemetry-jaeger-propagator"
485 "opentelemetry-semantic-conventions")))
486
487 (inputs (cargo-inputs 'rust-opentelemetry-for-stalwart))
488 (home-page "https://github.com/stalwartlabs/opentelemetry-rust")
489 (synopsis "The Rust OpenTelemetry implementation")
490 (description "This package provides a Rust OpenTelemetry implementation.")
491 (license license:asl2.0)))))
492
493;; Workspace dependency of zed.
494;;
495;; Cargo side: Cargo unifies dependency versions across zed's
496;; workspace, including this package's transitive dependencies,
497;; and records them in zed's Cargo.lock.
498;;
499;; Guix side: zed's cargo-inputs entry (generated from zed's
500;; Cargo.lock) already contains all of this package's transitive
501;; dependencies, so this package reuses zed's cargo-inputs.
502;;
503;; Only livekit-protocol, livekit-runtime, and livekit-api are
504;; packaged. The libwebrtc, webrtc-sys, and livekit crates are
505;; disabled on Linux by our zed-use-mock-livekit-on-linux patch
506;; (which adds target_os = "linux" to the cfg gate), but their
507;; Cargo.toml files must remain for workspace resolution; their
508;; source is replaced with empty stubs. The snippet also deletes
509;; unused workspace members (livekit-ffi, soxr-sys, yuv-sys,
510;; imgproc, examples) and the 1.6 MiB generated livekit.serde.rs
511;; (guarded by a nonexistent "serde" feature, so never compiled).
512;;
513;; TODO: Regenerate livekit-protocol/src/livekit.rs (5650 lines)
514;; from the .proto source in the livekit-protocol/protocol
515;; submodule (github.com/livekit/protocol) using prost-build and
516;; pbjson-build as native-inputs, then delete the shipped copy.
517(define-public rust-livekit-0.7.8.5f04705
518 (hidden-package
519 (package
520 (name "rust-livekit")
521 (version "0.7.8")
522 (source
523 (origin
524 (method git-fetch)
525 (uri
526 (git-reference
527 (url "https://github.com/zed-industries/livekit-rust-sdks")
528 (commit "5f04705ac3f356350ae31534ffbc476abc9ea83d")))
529 (file-name
530 (git-file-name "rust-livekit" "0.7.8.5f04705"))
531 (sha256
532 (base32 "1irnw9dax0nl8rl7jxdxs5vw6hg166jj4gf1s5cza6igvmrkl6y9"))
533 (modules '((guix build utils)))
534 (snippet
535 '(begin
536 (for-each delete-file-recursively
537 '(".github" "examples" "imgproc"
538 "livekit-ffi" "soxr-sys" "yuv-sys"
539 ;; Keep Cargo.toml for workspace resolution
540 ;; but replace source with stubs.
541 "libwebrtc/src"
542 "livekit/src"
543 "webrtc-sys/src"
544 "webrtc-sys/include"
545 "webrtc-sys/libwebrtc"))
546 (for-each (lambda (f)
547 (mkdir-p (dirname f))
548 (call-with-output-file f (const #t)))
549 '("libwebrtc/src/lib.rs"
550 "livekit/src/lib.rs"
551 "webrtc-sys/src/lib.rs"))
552 (delete-file
553 "livekit-protocol/src/livekit.serde.rs")
554 (substitute* "Cargo.toml"
555 (("\"livekit-ffi\",") "")
556 (("\"soxr-sys\",") "")
557 (("\"yuv-sys\",") "")
558 (("\"imgproc\",") ""))))))
559 (build-system cargo-build-system)
560 (arguments
561 (list #:skip-build? #t
562 #:install-source? #t
563 #:cargo-package-crates ''("livekit-protocol"
564 "livekit-runtime"
565 "livekit-api"
566 "webrtc-sys-build"
567 "webrtc-sys"
568 "libwebrtc"
569 "livekit")
570 #:cargo-package-flags ''("--no-metadata" "--no-verify"
571 "--exclude-lockfile")
572 #:phases
573 #~(modify-phases %standard-phases
574 (replace 'package
575 (lambda* (#:key source (cargo-package-crates '())
576 (cargo-package-flags '("--no-metadata" "--no-verify"))
577 (vendor-dir "guix-vendor")
578 #:allow-other-keys)
579 (use-modules (ice-9 ftw))
580 ;; Same as the standard package phase, but deletes
581 ;; cargo's target/package/tmp-crate/ scratch directory
582 ;; between the packaging loop and the repacking step.
583 ;; Cargo copies .crate files there during packaging and
584 ;; does not clean up. The repacking step's recursive
585 ;; find-files picks them up, and scandir confuses the
586 ;; tmp-crate directory with an extracted crate when
587 ;; names sort after "tmp-crate" alphabetically.
588 (when (file-exists? "Cargo.toml.orig")
589 (delete-file "Cargo.toml.orig"))
590 (for-each
591 (lambda (pkg)
592 (apply invoke "cargo" "package" "--offline"
593 "--package" pkg cargo-package-flags)
594 (for-each
595 (lambda (crate)
596 (invoke "tar" "xzf" crate "-C" vendor-dir))
597 (find-files "target/package" "\\.crate$"))
598 ((assoc-ref %standard-phases 'patch-cargo-checksums)
599 #:vendor-dir vendor-dir))
600 cargo-package-crates)
601 ;; Delete cargo's scratch directory.
602 (when (file-exists? "target/package/tmp-crate")
603 (delete-file-recursively "target/package/tmp-crate"))
604 ;; Repack crates with deterministic timestamps.
605 (with-directory-excursion "target/package"
606 (for-each
607 (lambda (crate)
608 (invoke "tar" "xf" crate)
609 (delete-file crate)
610 (let ((dir
611 (car (scandir
612 "."
613 (lambda (file)
614 (and (not (member file '("." "..")))
615 (not (string-suffix?
616 ".crate" file))))))))
617 (for-each
618 (lambda (file)
619 (let ((s (lstat file)))
620 (unless (eq? (stat:type s) 'symlink)
621 (utime file 0 0 0 0))))
622 (find-files dir #:directories? #t))
623 (apply invoke "tar" "czf"
624 (string-append dir ".crate")
625 "--sort=name" "--mtime=@0"
626 "--owner=root:0" "--group=root:0"
627 (find-files dir #:directories? #t))
628 (delete-file-recursively dir)))
629 (find-files "." "\\.crate$"))))))))
630 (inputs (cargo-inputs 'rust-livekit-0.7.8.5f04705))
631 (home-page "https://github.com/livekit/rust-sdks")
632 (synopsis "LiveKit real-time communication SDK for Rust")
633 (description
634 "This package provides a LiveKit real-time communication SDK for Rust.")
635 (license license:asl2.0))))
636
637;; Workspace dependency of zed.
638;;
639;; Cargo side: Cargo unifies dependency versions across zed's
640;; workspace, including this package's transitive dependencies,
641;; and records them in zed's Cargo.lock.
642;;
643;; Guix side: zed's cargo-inputs entry (generated from zed's
644;; Cargo.lock) already contains all of this package's transitive
645;; dependencies, so this package reuses zed's cargo-inputs.
646(define-public rust-notify-8.2.0.ce58c24
647 (hidden-package
648 (package
649 (name "rust-notify")
650 (version "8.2.0")
651 (source
652 (origin
653 (method git-fetch)
654 (uri
655 (git-reference
656 (url "https://github.com/zed-industries/notify.git")
657 (commit "ce58c24cad542c28e04ced02e20325a4ec28a31d")))
658 (file-name
659 (git-file-name "rust-notify" "8.2.0.ce58c24"))
660 (sha256
661 (base32 "09zn3ll1vlsblgrdacyw3zx58xzdxlab8ba7h22bbb57n76dmkl0"))))
662 (build-system cargo-build-system)
663 (arguments
664 (list #:skip-build? #t
665 #:install-source? #t
666 #:cargo-package-crates ''("notify-types"
667 "notify")
668 #:cargo-package-flags ''("--no-metadata" "--no-verify"
669 "--exclude-lockfile")))
670 (inputs (cargo-inputs 'rust-notify-8.2.0.ce58c24))
671 (home-page "https://github.com/notify-rs/notify")
672 (synopsis "Cross-platform filesystem notification library")
673 (description
674 "This package provides a cross-platform filesystem notification library
675for Rust.")
676 (license (list license:asl2.0 license:expat)))))
677
678(define-public rust-pcre2-utf32-0.2
679 (hidden-package
680 (package
681 (name "rust-pcre2-utf32")
682 (version "0.2.9")
683 (source (origin
684 (method git-fetch)
685 (uri (git-reference
686 (url "https://github.com/fish-shell/rust-pcre2")
687 (commit (string-append version "-utf32"))))
688 (file-name (git-file-name name version))
689 (sha256
690 (base32
691 "0mhjw7fvrzxb3fd0c534a17qgy6svz0z8269d2fs6q8aw11610mr"))
692 (modules '((guix build utils)))
693 (snippet '(delete-file-recursively "pcre2-sys/upstream"))))
694 (build-system cargo-build-system)
695 (arguments
696 (list #:skip-build? #t
697 #:cargo-package-crates
698 ''("pcre2-sys" "pcre2")))
699 (inputs (cargo-inputs 'rust-pcre2-utf32-0.2))
700 (home-page "https://github.com/fish-shell/rust-pcre2")
701 (synopsis "High level wrapper library for PCRE2")
702 (description
703 "This package provides @code{fish} shell's fork of @code{rust-pcre2} with
704UTF-32 support.")
705 (license (list license:expat license:unlicense)))))
706
707;; Workspace dependency of zed.
708;;
709;; Cargo side: Cargo unifies dependency versions across zed's
710;; workspace, including this package's transitive dependencies,
711;; and records them in zed's Cargo.lock.
712;;
713;; Guix side: zed's cargo-inputs entry (generated from zed's
714;; Cargo.lock) already contains all of this package's transitive
715;; dependencies, so this package reuses zed's cargo-inputs.
716(define-public rust-pet-0.1.0.d5b5bb0
717 (hidden-package
718 (package
719 (name "rust-pet")
720 (version "0.1.0")
721 (source
722 (origin
723 (method git-fetch)
724 (uri
725 (git-reference
726 (url "https://github.com/microsoft/python-environment-tools.git")
727 (commit "d5b5bb0c4558a51d8cc76b514bc870fd1c042f16")))
728 (file-name
729 (git-file-name "rust-pet" "0.1.0.d5b5bb0"))
730 (sha256
731 (base32 "01djr1761l7c889v9lng7igjqxiz208r2vrwij661cn2fy5xcm5f"))))
732 (build-system cargo-build-system)
733 (arguments
734 (list #:skip-build? #t
735 #:install-source? #t
736 #:cargo-package-crates ''("pet-fs"
737 "pet-core"
738 "pet-python-utils"
739 "pet-jsonrpc"
740 "pet-reporter"
741 "pet-conda"
742 "pet-virtualenv"
743 "pet-virtualenvwrapper"
744 "pet-env-var-path"
745 "pet-global-virtualenvs"
746 "pet-homebrew"
747 "pet-linux-global-python"
748 "pet-mac-commandlinetools"
749 "pet-mac-python-org"
750 "pet-mac-xcode"
751 "pet-pipenv"
752 "pet-pixi"
753 "pet-poetry"
754 "pet-pyenv"
755 "pet-telemetry"
756 "pet-uv"
757 "pet-venv"
758 "pet-windows-store"
759 "pet-windows-registry"
760 "pet")
761 #:cargo-package-flags ''("--no-metadata" "--no-verify"
762 "--exclude-lockfile")
763 #:phases
764 #~(modify-phases %standard-phases
765 (add-after 'unpack 'fix-versions
766 (lambda _
767 (let ((version #$(package-version this-package)))
768 (substitute* (find-files "." "^Cargo[.]toml$")
769 (("^(pet-[a-z-]*) = [{] path = \"([^\"]*)\" [}]" x pkg path)
770 (string-append pkg " = { version = \"" version "\", path = \"" path "\" }")))))))))
771 (inputs (cargo-inputs 'rust-pet-0.1.0.d5b5bb0))
772 (home-page "https://github.com/microsoft/python-environment-tools")
773 (synopsis "Python environment tools")
774 (description
775 "This package provides Python environment tools.")
776 (license license:expat))))
777
778(define-public rust-ring-0.17
779 (hidden-package
780 (package
781 (name "rust-ring")
782 (version "0.17.8") ;Not tagged.
783 (source (origin
784 (method git-fetch)
785 (uri (git-reference
786 (url "https://github.com/briansmith/ring")
787 (commit "fa98b490bcbc99a01ff150896ec74c1813242d7f")))
788 (file-name (git-file-name "rust-ring" version))
789 (sha256
790 (base32 "0rqfal81bf4l3dja98cajfjq2jbz1rcx7xdp2r33cxrm5y5psr28"))
791 (patches (search-patches "rust-ring-0.17-ring-core.patch"))
792 (modules '((guix build utils)))
793 (snippet
794 #~(begin
795 ;; It turns out Guix's nasm works just fine here.
796 (substitute* "build.rs"
797 (("./target/tools/windows/nasm/nasm") "nasm"))
798 ;; These files are pregenerated:
799 (delete-file "crypto/curve25519/curve25519_tables.h")
800 (delete-file "crypto/fipsmodule/ec/p256-nistz-table.h")
801 (delete-file "crypto/fipsmodule/ec/p256_table.h")
802 ;; As seen in git between 0.17.0 and 0.17.1.
803 (substitute* "crypto/curve25519/make_curve25519_tables.py"
804 (("static const uint8_t k25519Precomp")
805 "const uint8_t k25519Precomp"))
806 ;; This file causes problems during the 'package phase and
807 ;; is not distributed with the packaged crate.
808 (delete-file-recursively "bench")
809 (substitute* "Cargo.toml"
810 (("\"bench\",") ""))))))
811 (build-system cargo-build-system)
812 (arguments
813 (list
814 #:skip-build? #t
815 #:cargo-package-crates ''("ring")
816 #:phases
817 #~(modify-phases %standard-phases
818 (add-after 'unpack 'regenerate
819 (lambda _
820 (setenv "HOME" (getcwd))
821 (with-directory-excursion "crypto/curve25519"
822 (with-output-to-file "curve25519_tables.h"
823 (lambda _ (invoke "python3" "make_curve25519_tables.py"))))
824 (with-directory-excursion "crypto/fipsmodule/ec"
825 (invoke "go" "run" "make_tables.go")
826 (invoke "go" "run" "make_ec_scalar_base_mult_tests.go"))
827 (format #t "Generating the pregenerated files ...~%")
828 (force-output)
829 (mkdir-p "pregenerated/tmp/ring_core_generated")
830
831 ;; We generate all the files which upstream would normally be
832 ;; generate by using 'RING_PREGENERATE_ASM=1 cargo build
833 ;; --target-dir=target/pregenerate_asm' in order to not include
834 ;; a dependency on cargo when generating the sources.
835 (define (prefix script)
836 (string-append
837 "pregenerated/"
838 (string-drop-right
839 (string-drop script
840 (string-index-right script #\/)) 3)))
841
842 (for-each
843 (lambda (script)
844 (invoke "perl" script "ios64"
845 (string-append (prefix script) "-ios64.S"))
846 (invoke "perl" script "linux64"
847 (string-append (prefix script) "-linux64.S"))
848 (invoke "perl" script "win64"
849 (string-append (prefix script) "-win64.S")))
850 '("crypto/fipsmodule/aes/asm/aesv8-armx.pl"
851 "crypto/fipsmodule/modes/asm/ghashv8-armx.pl"
852 "crypto/chacha/asm/chacha-armv8.pl"
853 "crypto/cipher_extra/asm/chacha20_poly1305_armv8.pl"
854 "crypto/fipsmodule/aes/asm/vpaes-armv8.pl"
855 "crypto/fipsmodule/bn/asm/armv8-mont.pl"
856 "crypto/fipsmodule/ec/asm/p256-armv8-asm.pl"
857 "crypto/fipsmodule/modes/asm/ghash-neon-armv8.pl"
858 "crypto/fipsmodule/modes/asm/aesv8-gcm-armv8.pl"
859 "crypto/fipsmodule/sha/asm/sha512-armv8.pl"))
860
861 (for-each
862 (lambda (arch)
863 (invoke "perl" "crypto/fipsmodule/sha/asm/sha512-armv8.pl"
864 arch (string-append
865 "pregenerated/sha256-armv8-" arch ".S")))
866 '("ios64" "linux64" "win64"))
867
868 (for-each
869 (lambda (script)
870 (invoke "perl" script "linux32"
871 (string-append (prefix script) "-linux32.S")))
872 '("crypto/fipsmodule/aes/asm/aesv8-armx.pl"
873 "crypto/fipsmodule/modes/asm/ghashv8-armx.pl"
874 "crypto/fipsmodule/aes/asm/bsaes-armv7.pl"
875 "crypto/fipsmodule/aes/asm/vpaes-armv7.pl"
876 "crypto/fipsmodule/bn/asm/armv4-mont.pl"
877 "crypto/chacha/asm/chacha-armv4.pl"
878 "crypto/fipsmodule/modes/asm/ghash-armv4.pl"
879 "crypto/fipsmodule/sha/asm/sha256-armv4.pl"
880 "crypto/fipsmodule/sha/asm/sha512-armv4.pl"))
881
882 (for-each
883 (lambda (script)
884 (invoke "perl" script "elf"
885 "-fPIC" "-DOPENSSL_IA32_SSE2"
886 (string-append (prefix script) "-elf.S"))
887 (invoke "perl" script "win32n"
888 "-fPIC" "-DOPENSSL_IA32_SSE2"
889 (string-append
890 "pregenerated/tmp/"
891 (string-drop (prefix script) 13) "-win32n.asm")))
892 '("crypto/fipsmodule/aes/asm/aesni-x86.pl"
893 "crypto/fipsmodule/aes/asm/vpaes-x86.pl"
894 "crypto/fipsmodule/bn/asm/x86-mont.pl"
895 "crypto/chacha/asm/chacha-x86.pl"
896 "crypto/fipsmodule/modes/asm/ghash-x86.pl"))
897
898 (for-each
899 (lambda (script)
900 (invoke "perl" script "elf"
901 (string-append (prefix script) "-elf.S"))
902 (invoke "perl" script "macosx"
903 (string-append (prefix script) "-macosx.S"))
904 (invoke "perl" script "nasm"
905 (string-append
906 "pregenerated/tmp/"
907 (string-drop (prefix script) 13) "-nasm.asm")))
908 '("crypto/chacha/asm/chacha-x86_64.pl"
909 "crypto/fipsmodule/aes/asm/aesni-x86_64.pl"
910 "crypto/fipsmodule/aes/asm/vpaes-x86_64.pl"
911 "crypto/fipsmodule/bn/asm/x86_64-mont.pl"
912 "crypto/fipsmodule/bn/asm/x86_64-mont5.pl"
913 "crypto/fipsmodule/ec/asm/p256-x86_64-asm.pl"
914 "crypto/fipsmodule/modes/asm/aesni-gcm-x86_64.pl"
915 "crypto/fipsmodule/modes/asm/ghash-x86_64.pl"
916 "crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
917 "crypto/cipher_extra/asm/chacha20_poly1305_x86_64.pl"))
918
919 (invoke "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
920 "elf" "pregenerated/sha256-x86_64-elf.S")
921
922 (invoke "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
923 "macosx" "pregenerated/sha256-x86_64-macosx.S")
924
925 (invoke "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
926 "nasm" "pregenerated/tmp/sha256-x86_64-nasm.asm")
927
928 ;; TODO: Extract ring_core_generated/prefix_symbols_nasm.inc
929 ;; and ring_core_generated/prefix_symbols_asm.h from build.rs.
930
931 (for-each
932 (lambda (script)
933 (invoke "nasm" "-o" (string-append (prefix script) "o")
934 "-f" "win32" "-i" "include/" "-i" "pregenerated/tmp/"
935 "-Xgnu" "-gcv8" script))
936 (find-files "pregenerated/tmp" "win32n\\.asm"))
937
938 (for-each
939 (lambda (script)
940 (invoke "nasm" "-o" (string-append (prefix script) "o")
941 "-f" "win64" "-i" "include/" "-i" "pregenerated/tmp/"
942 "-Xgnu" "-gcv8" script))
943 (find-files "pregenerated/tmp" "nasm\\.asm")))))))
944 (native-inputs (list clang-13 go gzip nasm perl python-minimal tar))
945 (propagated-inputs (cargo-inputs 'rust-ring-0.17))
946 (home-page "https://github.com/briansmith/ring")
947 (synopsis "Safe, fast, small crypto using Rust")
948 (description "This package provided safe, fast, small crypto using Rust.")
949 (license (list license:isc license:openssl)))))
950
951(define-public rust-ring-0.17.14
952 (hidden-package
953 (package
954 (inherit rust-ring-0.17)
955 (version "0.17.14")
956 (source
957 (origin
958 (method url-fetch)
959 (uri (crate-uri "ring" version))
960 (file-name (string-append "rust-ring-" version ".tar.gz"))
961 (sha256
962 (base32 "1dw32gv19ccq4hsx3ribhpdzri1vnrlcfqb2vj41xn4l49n9ws54"))))
963 (arguments
964 (list #:skip-build? #t
965 #:cargo-package-crates ''("ring"))))))
966
967(define-public rust-rust-sdks-0.0.0.e2d1d1d
968 (let ((commit "e2d1d1d230c6fc9df171ccb181423f957bb3c1f0")
969 (revision "0"))
970 (hidden-package
971 (package
972 (name "rust-sdks")
973 (version (git-version "0.0.0" revision commit))
974 (source
975 (origin
976 (method git-fetch)
977 (uri (git-reference
978 (url "https://github.com/juberti-oai/rust-sdks.git")
979 (commit commit)))
980 (file-name (git-file-name name version))
981 (sha256
982 (base32 "00xwa6w00kdv9nd4a2206wyz3aw61al914xd1g8kj4gx9bmdhic2"))))
983 (build-system cargo-build-system)
984 (arguments
985 (list #:skip-build? #t
986 #:install-source? #t
987 ;; rust-codex patches out the libwebrtc git dependency, so only
988 ;; the remaining workspace members are currently needed here.
989 #:cargo-package-crates ''("livekit-runtime"
990 "livekit-protocol")
991 #:cargo-package-flags ''("--no-metadata" "--no-verify"
992 "--exclude-lockfile")))
993 (inputs (cargo-inputs 'rust-rust-sdks-0.0.0.e2d1d1d))
994 (home-page "https://github.com/juberti-oai/rust-sdks")
995 (synopsis "Workspace crates from rust-sdks")
996 (description
997 "This package provides the rust-sdks workspace crates used by Codex.")
998 (license license:asl2.0)))))
999
1000(define-public rust-rustc-demangle-capi-0.1
1001 (hidden-package
1002 (package
1003 (name "rust-rustc-demangle-capi")
1004 (version "0.1.0")
1005 (source
1006 (origin
1007 (method url-fetch)
1008 (uri (crate-uri "rustc-demangle-capi" version))
1009 (file-name (string-append name "-" version ".tar.gz"))
1010 (sha256
1011 (base32 "1s2g4z1yrh1sxl4qkmpd19ss3x2lr9115vbir7pnhgy63r1d63yv"))))
1012 (build-system cargo-build-system)
1013 (arguments
1014 (list
1015 #:phases
1016 #~(modify-phases %standard-phases
1017 (add-after 'install 'install-c-library
1018 (lambda _
1019 (install-file
1020 (car (find-files "." "^rustc_demangle\\.h$"))
1021 (string-append #$output "/include"))
1022 (install-file
1023 (car (find-files "." "^librustc_demangle.so$"))
1024 (string-append #$output "/lib")))))))
1025 (inputs (cargo-inputs 'rust-rustc-demangle-capi-0.1))
1026 (home-page "https://github.com/alexcrichton/rustc-demangle")
1027 (synopsis "C API for the @code{rustc-demangle} crate")
1028 (description "This package provides a C API library for the
1029@code{rustc-demangle} crate.")
1030 (license (list license:expat license:asl2.0)))))
1031
1032(define-public rust-salsa-0.23.0.3713cd7
1033 (let ((commit "3713cd7eb30821c0c086591832dd6f59f2af7fe7")
1034 (revision "0"))
1035 (package
1036 (name "rust-salsa")
1037 (version (git-version "0.23.0" revision commit))
1038 (source
1039 (origin
1040 (method git-fetch)
1041 (uri (git-reference
1042 (url "https://github.com/salsa-rs/salsa.git")
1043 (commit commit)))
1044 (file-name (git-file-name name version))
1045 (sha256
1046 (base32 "1c90zkhy9hvwqlk5is0nrs4wlpj9qzaga1z4jcdlyrdl343n7qlz"))))
1047 (build-system cargo-build-system)
1048 (arguments
1049 (list #:skip-build? #t
1050 #:cargo-package-crates
1051 ''("salsa-macro-rules" "salsa-macros" "salsa")))
1052 (inputs (cargo-inputs 'rust-salsa-0.23.0.3713cd7))
1053 (home-page "https://github.com/salsa-rs/salsa")
1054 (synopsis "Framework for incrementalized computation")
1055 (description "This package provides a generic framework for on-demand,
1056incrementalized computation (experimental).")
1057 (license (list license:asl2.0 license:expat)))))
1058
1059(define-public rust-smithay-0.7.0.ff5fa7d
1060 (let ((commit "ff5fa7df392cecfba049ffed55cdaa4e98a8e7ef"))
1061 (hidden-package
1062 (package
1063 (name "rust-smithay")
1064 (version (git-version "0.7.0" "0" commit))
1065 (source
1066 (origin
1067 (method git-fetch)
1068 (uri (git-reference
1069 (url "https://github.com/Smithay/smithay")
1070 (commit commit)))
1071 (file-name (git-file-name name version))
1072 (sha256
1073 (base32
1074 "1dfksva7hizx675vh128ibrbf6ggjh2a01jm41qgb0dgyi6wcpsd"))))
1075 (build-system cargo-build-system)
1076 (arguments
1077 (list #:skip-build? #t
1078 #:cargo-package-crates ''("smithay" "smithay-drm-extras")))
1079 (inputs (cargo-inputs 'rust-smithay-0.7.0.ff5fa7d))
1080 (home-page "https://github.com/Smithay/smithay")
1081 (synopsis "Smithy for Rust Wayland compositors")
1082 (description
1083 "Smithay aims to provide building blocks to create wayland compositors
1084in Rust. While not being a full-blown compositor, it'll provide objects and
1085interfaces implementing common functionalities that pretty much any compositor
1086will need, in a generic fashion.
1087
1088It supports the @code{wayland}, @code{wayland-protocols}, and some external
1089extensions, such as @code{wlr-protocols} and @code{plasma-wayland-protocols}.")
1090 (license license:expat)))))
1091
1092(define inspired-github-color-scheme-for-rust-syntect-5
1093 (let ((version "1.3.0"))
1094 (origin
1095 (method git-fetch)
1096 (uri (git-reference
1097 (url "https://github.com/sethlopez/InspiredGitHub.tmtheme")
1098 (commit (string-append "v" version))))
1099 (file-name "inspired-github-color-scheme-checkout")
1100 (sha256
1101 (base32
1102 "0w2sswa2kid1jwqy28xqvjav17xzkza32i9vvyj67m1kfm3dd6ww")))))
1103
1104(define solarized-for-rust-syntect-5
1105 (let ((version "1.5.11"))
1106 (origin
1107 (method git-fetch)
1108 (uri (git-reference
1109 (url "https://github.com/braver/Solarized")
1110 (commit version)))
1111 (file-name "solarized-checkout")
1112 (sha256
1113 (base32
1114 "05n8wq7zahydrnx36k7awqjz8svn13xsxcazyj0909h4akbsglj1")))))
1115
1116(define spacegray-for-rust-syntect-5
1117 (let ((commit "2703e93f559e212ef3895edd10d861a4383ce93d"))
1118 (origin
1119 (method git-fetch)
1120 (uri (git-reference
1121 (url "https://github.com/SublimeText/Spacegray")
1122 (commit commit)))
1123 (file-name "spacegray-checkout")
1124 (sha256
1125 (base32
1126 "0vzs9i3sdh6f1b25vdbxwyphmxzbqixrnjlgws56fzfngy4my9dj")))))
1127
1128(define-public rust-syntect-5.3
1129 (hidden-package
1130 (package
1131 (name "rust-syntect")
1132 (version "5.3.0")
1133 (source (origin
1134 (method git-fetch)
1135 (uri (git-reference
1136 (url "https://github.com/trishume/syntect")
1137 (commit (string-append "v" version))))
1138 (file-name (git-file-name name version))
1139 (sha256
1140 (base32
1141 "095yvdd4lpzfywcg5zr7pq28fm9iarx6a85mpgdc0g6d1waydp68"))
1142 (modules '((guix build utils)))
1143 (snippet
1144 '(begin
1145 (delete-file-recursively "scripts")
1146 (for-each
1147 (lambda (file)
1148 (delete-file file)
1149 (with-output-to-file file
1150 (const (display "\n"))))
1151 (find-files "assets" "dump$"))))))
1152 (build-system cargo-build-system)
1153 (arguments
1154 (list #:skip-build? #t
1155 #:cargo-package-crates ''("syntect")
1156 #:phases
1157 #~(modify-phases %standard-phases
1158 (replace 'build
1159 (lambda _
1160 (substitute* "Makefile"
1161 (("git submodule.*") ""))
1162 (with-directory-excursion "testdata"
1163 (rmdir "InspiredGitHub.tmtheme")
1164 (copy-recursively
1165 #+(this-package-native-input
1166 "inspired-github-color-scheme-checkout")
1167 "InspiredGitHub.tmtheme")
1168 (rmdir "Solarized")
1169 (copy-recursively
1170 #+(this-package-native-input "solarized-checkout")
1171 "Solarized")
1172 (rmdir "spacegray")
1173 (copy-recursively
1174 #+(this-package-native-input "solarized-checkout")
1175 "spacegray"))
1176 (invoke "make" "assets"))))))
1177 (native-inputs
1178 (list pkg-config
1179 inspired-github-color-scheme-for-rust-syntect-5
1180 solarized-for-rust-syntect-5
1181 spacegray-for-rust-syntect-5))
1182 (inputs (cons oniguruma (cargo-inputs 'rust-syntect-5.3)))
1183 (home-page "https://github.com/trishume/syntect")
1184 (synopsis "Library for syntax highlighting and code intelligence")
1185 (description
1186 "This package provides a library for syntax highlighting and code
1187intelligence.")
1188 (license license:expat))))
1189
1190;; Workspace dependency of zed.
1191;;
1192;; Cargo side: Cargo unifies dependency versions across zed's
1193;; workspace, including this package's transitive dependencies,
1194;; and records them in zed's Cargo.lock.
1195;;
1196;; Guix side: zed's cargo-inputs entry (generated from zed's
1197;; Cargo.lock) already contains all of this package's transitive
1198;; dependencies, so this package reuses zed's cargo-inputs.
1199(define-public rust-tiktoken-rs-0.9.1.2570c43
1200 (hidden-package
1201 (package
1202 (name "rust-tiktoken-rs")
1203 (version "0.9.1")
1204 (source
1205 (origin
1206 (method git-fetch)
1207 (uri
1208 (git-reference
1209 (url "https://github.com/zed-industries/tiktoken-rs")
1210 (commit "2570c4387a8505fb8f1d3f3557454b474f1e8271")))
1211 (file-name
1212 (git-file-name "rust-tiktoken-rs" "0.9.1.2570c43"))
1213 (sha256
1214 (base32 "0yki1whx16xqgsrnr6gjsxakj6qzyvz958g6c9h15xp154kw6573"))))
1215 (build-system cargo-build-system)
1216 (arguments
1217 (list #:skip-build? #t
1218 #:install-source? #t
1219 #:cargo-package-crates ''("tiktoken-rs")
1220 #:cargo-package-flags ''("--no-metadata" "--no-verify"
1221 "--exclude-lockfile")))
1222 (inputs (cargo-inputs 'rust-tiktoken-rs-0.9.1.2570c43))
1223 (home-page "https://github.com/zurawiki/tiktoken-rs")
1224 (synopsis "Rust library for OpenAI's BPE tokenizer")
1225 (description
1226 "This package provides Rust bindings for OpenAI's @acronym{BPE, byte
1227pair encoding} tokenizer, used to count and manage tokens for OpenAI
1228language models.")
1229 (license license:expat))))
1230
1231(define-public rust-tikv-jemallocator-for-polars
1232 (let ((commit "c7991e5bb6b3e9f79db6b0f48dcda67c5c3d2936")
1233 (revision "0"))
1234 (hidden-package
1235 (package
1236 (name "rust-tikv-jemallocator")
1237 (version (git-version "0.6.0" revision commit))
1238 (source (origin
1239 (method git-fetch)
1240 (uri (git-reference
1241 (url "https://github.com/pola-rs/jemallocator")
1242 (commit commit)))
1243 (file-name (git-file-name name version))
1244 (sha256
1245 (base32
1246 "0wwdw0f3a9vgck3x10gxq80606b2wam31vglhjw2fabdvq2wmxcy"))))
1247 (build-system cargo-build-system)
1248 (arguments
1249 (list #:skip-build? #t
1250 #:cargo-package-crates
1251 ''("tikv-jemalloc-sys"
1252 "tikv-jemallocator")
1253 #:phases
1254 #~(modify-phases %standard-phases
1255 (add-after 'unpack 'remove-workspace-members
1256 (lambda _
1257 ; Avoid dev dependency, that is excluded from workspace
1258 (substitute* "jemallocator/Cargo.toml"
1259 (("^tikv-jemalloc-ctl.*$") "")))))))
1260 (inputs (cargo-inputs 'rust-tikv-jemallocator-for-polars))
1261 (home-page "https://github.com/pola-rs/jemallocator")
1262 (synopsis "Rust allocator backed by jemalloc")
1263 (description "This package provides a Rust allocator backed by jemalloc.")
1264 (license (list license:expat license:asl2.0))))))
1265
1266(define-public rust-typst-dev-assets
1267 (hidden-package
1268 (package
1269 (name "rust-typst-dev-assets")
1270 (version "0.15.0")
1271 (source
1272 (origin
1273 (method git-fetch)
1274 (uri (git-reference
1275 (url "https://github.com/typst/typst-dev-assets")
1276 (commit (string-append "v" version))))
1277 (file-name (git-file-name name version))
1278 (sha256
1279 (base32 "0il0rb7qj8qd1k34vxbvj3lqql1jbgn2q2m451mqz7xkibmn5drf"))))
1280 (build-system cargo-build-system)
1281 (arguments
1282 (list
1283 #:skip-build? #t
1284 #:cargo-package-crates ''("typst-dev-assets")))
1285 (home-page "https://typst.app/")
1286 (synopsis "Assets for testing the typst compiler")
1287 (description
1288 "This package provides assets needed for testing the typst package.")
1289 (license license:asl2.0))))
1290
1291(define-public rust-codex-0.117.0
1292 (hidden-package
1293 (package
1294 (name "rust-codex")
1295 (version "0.117.0")
1296 (source
1297 (origin
1298 (method git-fetch)
1299 (uri (git-reference
1300 (url "https://github.com/openai/codex")
1301 (commit "4c70bff480af37b1bf1a9b352b8341060fe55755")))
1302 (file-name (git-file-name name version))
1303 (sha256
1304 (base32 "0xnszwd3xhh4j64zxlk611kcphvrw4ihky1f517y4m8cl4lpqdqk"))
1305 (patches (search-patches
1306 "rust-codex-0.117.0-core-remove-self-dep.patch"
1307 "codex-acp-0.11.1-disable-code-mode.patch"))))
1308 (build-system cargo-build-system)
1309 (arguments
1310 (list
1311 #:skip-build? #t
1312 #:cargo-package-crates
1313 ;; All workspace crates from openai/codex 0.117.0.
1314 ;; Order matters: dependencies must come before packages that need them.
1315 ''(;; Topologically sorted by internal dependency order.
1316 "codex-utils-absolute-path"
1317 "codex-git-utils"
1318 "codex-experimental-api-macros"
1319 "codex-execpolicy"
1320 "codex-utils-cache"
1321 "codex-utils-image"
1322 "codex-utils-string"
1323 "codex-protocol"
1324 "codex-utils-cargo-bin"
1325 "codex-app-server-protocol"
1326 "codex-utils-rustls-provider"
1327 "codex-client"
1328 "codex-config"
1329 "codex-keyring-store"
1330 "codex-terminal-detection"
1331 "codex-login"
1332 "codex-utils-plugins"
1333 "codex-plugin"
1334 "codex-analytics"
1335 "codex-ansi-escape"
1336 "codex-api"
1337 "codex-apply-patch"
1338 "codex-async-utils"
1339 "codex-code-mode"
1340 "codex-connectors"
1341 "codex-instructions"
1342 "codex-otel"
1343 "codex-skills"
1344 "codex-core-skills"
1345 "codex-utils-pty"
1346 "codex-exec-server"
1347 "codex-features"
1348 "codex-hooks"
1349 "codex-utils-home-dir"
1350 "codex-network-proxy"
1351 "codex-rmcp-client"
1352 "codex-file-search"
1353 "codex-state"
1354 "codex-utils-path"
1355 "codex-rollout"
1356 "codex-sandboxing"
1357 "codex-secrets"
1358 "codex-shell-command"
1359 "codex-shell-escalation"
1360 "codex-utils-output-truncation"
1361 "codex-utils-readiness"
1362 "codex-utils-stream-parser"
1363 "codex-utils-template"
1364 "codex-windows-sandbox"
1365 "codex-core"
1366 "codex-linux-sandbox"
1367 "codex-arg0"
1368 "codex-backend-openapi-models"
1369 "codex-backend-client"
1370 "codex-utils-cli"
1371 "codex-chatgpt"
1372 "codex-cloud-requirements"
1373 "codex-feedback"
1374 "codex-utils-json-to-toml"
1375 "codex-app-server"
1376 "codex-app-server-client"
1377 "codex-app-server-test-client"
1378 "codex-cloud-tasks-client"
1379 "codex-utils-approval-presets"
1380 "codex-utils-elapsed"
1381 "codex-utils-fuzzy-match"
1382 "codex-lmstudio"
1383 "codex-ollama"
1384 "codex-utils-oss"
1385 "codex-utils-sandbox-summary"
1386 "codex-utils-sleep-inhibitor"
1387 "codex-exec"
1388 "codex-mcp-server"
1389 "codex-process-hardening"
1390 "codex-responses-api-proxy"
1391 "codex-stdio-to-uds"
1392 "codex-debug-client"
1393 "codex-execpolicy-legacy")
1394 #:phases
1395 #~(modify-phases %standard-phases
1396 (add-after 'unpack 'chdir-to-workspace
1397 (lambda _
1398 (chdir "codex-rs")))
1399 (add-after 'chdir-to-workspace 'patch-git-deps-to-vendor
1400 (lambda _
1401 (substitute* "Cargo.toml"
1402 (("crossterm = \\{ git = [^}]+\\}")
1403 "crossterm = { version = \"0.28.1\" }")
1404 (("ratatui = \\{ git = [^}]+\\}")
1405 "ratatui = { version = \"0.29.0\" }")
1406 (("tokio-tungstenite = \\{ git = [^}]+\\}")
1407 "tokio-tungstenite = { version = \"0.28.0\" }")
1408 (("tungstenite = \\{ git = [^}]+\\}")
1409 "tungstenite = { version = \"0.27.0\" }")
1410 (("nucleo = \\{ git = [^}]+\\}")
1411 "nucleo = { version = \"0.5.0\" }")
1412 (("runfiles = \\{ git = [^}]+\\}")
1413 "runfiles = { version = \"0.1.0\" }"))
1414 ;; Disable V8 runtime in codex-code-mode.
1415 (substitute* "Cargo.toml"
1416 (("codex-code-mode = \\{ path = \"code-mode\" \\}")
1417 "codex-code-mode = { path = \"code-mode\", default-features = false }"))))
1418 (add-after 'patch-git-deps-to-vendor 'add-version-to-workspace-deps
1419 (lambda _
1420 ;; cargo package requires all dependencies to have versions.
1421 ;; Add version = "0.117.0" to internal path dependencies.
1422 (let ((cargo-files (find-files "." "^Cargo\\.toml$")))
1423 (substitute* cargo-files
1424 (("(codex-[a-z0-9-]+) = \\{ path = " all name)
1425 (string-append name " = { version = \"0.117.0\", path = "))
1426 (("(codex-[a-z0-9-]+) = \\{ package = " all name)
1427 (string-append name " = { version = \"0.117.0\", package = "))
1428 (("^(path = \"\\.\\./[^\"]*\")" all path-line)
1429 (string-append path-line "\nversion = \"0.117.0\"")))))))))
1430 (inputs (cargo-inputs 'rust-codex-0.0.0.785c0c43))
1431 (home-page "https://github.com/openai/codex")
1432 (synopsis "OpenAI Codex workspace crates (for codex-acp)")
1433 (description
1434 "This package provides the workspace crates from the OpenAI Codex
1435repository, used as dependencies by codex-acp.")
1436 (license license:asl2.0))))
1437
1438;; Also update (@ (gnu packages gnome) glycin-loaders) when updating this.
1439(define-public rust-glycin-3
1440 (package
1441 (name "rust-glycin")
1442 (version "3.1.0")
1443 (source
1444 (origin
1445 (method git-fetch)
1446 (uri (git-reference
1447 (url "https://gitlab.gnome.org/GNOME/glycin.git")
1448 ;; Rust library version is different from the tagged version.
1449 (commit "2.1.1")))
1450 (file-name (git-file-name name version))
1451 (sha256
1452 (base32
1453 "1mrv733xhbxydww4szskv7jc0hif908aavh8h4kjcxp0zgy13blf"))
1454 (patches (search-patches "glycin-sandbox-Adapt-bwrap-invocation.patch"))))
1455 (build-system cargo-build-system)
1456 (arguments
1457 (list
1458 #:skip-build? #t
1459 #:cargo-package-crates ''("glycin-common" "glycin-utils" "glycin")
1460 #:phases
1461 #~(modify-phases %standard-phases
1462 (add-after 'unpack 'set-bin-paths
1463 (lambda* (#:key inputs #:allow-other-keys)
1464 (substitute* "glycin/src/sandbox.rs"
1465 (("@bwrap@")
1466 (search-input-file inputs "bin/bwrap"))
1467 (("@storedir@")
1468 #$%storedir)
1469 (("/usr/bin/true")
1470 (search-input-file inputs "bin/true"))))))))
1471 (inputs (cons* bubblewrap (cargo-inputs 'glycin)))
1472 ;; Uses XDG_DATA_DIRS to search for the loaders. See Config::data_dirs() in
1473 ;; config.rs. Using a specific search path was discussed in
1474 ;; <https://codeberg.org/guix/guix/pulls/1653> and
1475 ;; <https://gitlab.gnome.org/GNOME/glycin/-/merge_requests/343>.
1476 (native-search-paths (list $XDG_DATA_DIRS))
1477 (home-page "https://gitlab.gnome.org/GNOME/glycin")
1478 (synopsis "Rust library for sandboxed image decoding")
1479 (description "Glycin is a sandbox image decoder for image viewers and
1480thumbnails to display untrusted content safely.")
1481 (license (list license:mpl2.0 license:lgpl2.1+))))
1482
1483;; Workspace dependency of zed.
1484;;
1485;; Cargo side: Cargo unifies dependency versions across zed's
1486;; workspace, including this package's transitive dependencies,
1487;; and records them in zed's Cargo.lock.
1488;;
1489;; Guix side: zed's cargo-inputs entry (generated from zed's
1490;; Cargo.lock) already contains all of this package's transitive
1491;; dependencies, so this package reuses zed's cargo-inputs.
1492(define-public rust-zed-xim-0.4.0-zed.16f35a2
1493 (hidden-package
1494 (package
1495 (name "rust-zed-xim")
1496 (version "0.4.0-zed")
1497 (source
1498 (origin
1499 (method git-fetch)
1500 (uri
1501 (git-reference
1502 (url "https://github.com/zed-industries/xim-rs.git")
1503 (commit "16f35a2c881b815a2b6cdfd6687988e84f8447d8")))
1504 (file-name
1505 (git-file-name "rust-zed-xim" "0.4.0-zed.16f35a2"))
1506 (sha256
1507 (base32 "14cyxxdgjpbkf8ny4c46cfqjinavi2cyxzwfngldlls97m5zh555"))))
1508 (build-system cargo-build-system)
1509 (arguments
1510 (list #:skip-build? #t
1511 #:install-source? #t
1512 #:cargo-package-crates ''("xim-ctext"
1513 "xim-parser"
1514 "zed-xim")
1515 #:cargo-package-flags ''("--no-metadata" "--no-verify"
1516 "--exclude-lockfile")
1517 #:phases
1518 #~(modify-phases %standard-phases
1519 (replace 'package
1520 (lambda* (#:key source (cargo-package-crates '())
1521 (cargo-package-flags '("--no-metadata" "--no-verify"))
1522 (vendor-dir "guix-vendor")
1523 #:allow-other-keys)
1524 (use-modules (ice-9 ftw))
1525 ;; Same as the standard package phase, but deletes
1526 ;; cargo's target/package/tmp-crate/ scratch directory
1527 ;; between the packaging loop and the repacking step.
1528 (when (file-exists? "Cargo.toml.orig")
1529 (delete-file "Cargo.toml.orig"))
1530 (for-each
1531 (lambda (pkg)
1532 (apply invoke "cargo" "package" "--offline"
1533 "--package" pkg cargo-package-flags)
1534 (for-each
1535 (lambda (crate)
1536 (invoke "tar" "xzf" crate "-C" vendor-dir))
1537 (find-files "target/package" "\\.crate$"))
1538 ((assoc-ref %standard-phases 'patch-cargo-checksums)
1539 #:vendor-dir vendor-dir))
1540 cargo-package-crates)
1541 (when (file-exists? "target/package/tmp-crate")
1542 (delete-file-recursively "target/package/tmp-crate"))
1543 (with-directory-excursion "target/package"
1544 (for-each
1545 (lambda (crate)
1546 (invoke "tar" "xf" crate)
1547 (delete-file crate)
1548 (let ((dir
1549 (car (scandir
1550 "."
1551 (lambda (file)
1552 (and (not (member file '("." "..")))
1553 (not (string-suffix?
1554 ".crate" file))))))))
1555 (for-each
1556 (lambda (file)
1557 (let ((s (lstat file)))
1558 (unless (eq? (stat:type s) 'symlink)
1559 (utime file 0 0 0 0))))
1560 (find-files dir #:directories? #t))
1561 (apply invoke "tar" "czf"
1562 (string-append dir ".crate")
1563 "--sort=name" "--mtime=@0"
1564 "--owner=root:0" "--group=root:0"
1565 (find-files dir #:directories? #t))
1566 (delete-file-recursively dir)))
1567 (find-files "." "\\.crate$"))))))))
1568 (inputs (cargo-inputs 'rust-zed-xim-0.4.0-zed.16f35a2))
1569 (home-page "https://github.com/XDeme1/xim-rs")
1570 (synopsis "X input method client and server")
1571 (description
1572 "This package provides a library for @code{xim}, the X input method.")
1573 (license license:expat))))
1574
1575(define-public rust-egui-skia-renderer-source
1576 (origin
1577 (method git-fetch)
1578 (uri (git-reference
1579 (url "https://gitlab.com/oscargus/egui_skia_renderer.git")
1580 (commit "36fe7b49a59a87f9d4b62533bd81e6e37139e9cd")))
1581 (file-name "egui-skia-renderer-checkout")
1582 (sha256
1583 (base32 "0amn342y45ixnhkfh5vzl31drmz0dj5jairfmx2zdp3xznqbx1lv"))))