1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
|
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2025 Hilton Chain <hako@ultrarare.space>
;;; Copyright © 2023-2025 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2025 Noé Lopez <noelopez@free.fr>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages rust-sources)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix search-paths)
#:use-module (guix build-system cargo)
#:use-module (guix build-system trivial)
#:use-module ((guix config) #:select (%storedir))
#:use-module (guix utils)
#:use-module (gnu packages)
#:use-module (gnu packages assembly)
#:use-module (gnu packages base)
#:use-module (gnu packages compression)
#:use-module (gnu packages llvm)
#:use-module (gnu packages golang)
#:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
#:use-module (gnu packages rust)
#:use-module (gnu packages textutils)
#:use-module (gnu packages virtualization))
;;;
;;; Cargo workspaces and Rust libraries requiring external inputs to unbundle.
;;; These packages are hidden, as they are not interesting to users.
;;;
(define gemoji-source-for-rust-deunicode-1
(let ((version "4.1.0"))
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/github/gemoji")
(commit (string-append "v" version))))
(file-name "gemoji-checkout")
(sha256
(base32
"1yhs9lj9gnzbvimv0y5f1a4my0slbvygkcjjkaxd4wkkyfvfbkxy")))))
(define-public rust-deunicode-1
(hidden-package
(package
(name "rust-deunicode")
(version "1.6.1")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/kornelski/deunicode")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"0bhbkfhh5qd4ygx47jj7j6h722i1skmkwashmj5wlh648f5gdmx4"))
(modules '((guix build utils)))
(snippet
'(for-each delete-file-recursively
'("scripts/gemoji"
"src/mapping.txt"
"src/pointers.bin")))))
(build-system cargo-build-system)
(arguments
(list #:skip-build? #t
#:cargo-package-crates ''("deunicode")
#:phases
#~(modify-phases %standard-phases
(add-before 'build 'compress-data
(lambda _
(with-directory-excursion "scripts"
(copy-recursively
#+(this-package-native-input "gemoji-checkout")
"gemoji")
(invoke "cargo" "run")))))))
(native-inputs (list gemoji-source-for-rust-deunicode-1))
;; scripts/Cargo.lock
(inputs (cargo-inputs 'rust-deunicode-1))
(home-page "https://lib.rs/crates/deunicode")
(synopsis "Convert Unicode strings to pure ASCII")
(description
"This package converts Unicode strings to pure ASCII by intelligently
transliterating them. It supports Emoji and Chinese.")
(license license:bsd-3))))
(define-public rust-hypher-0.1
(hidden-package
(package
(name "rust-hypher")
(version "0.1.6")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/typst/hypher")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "0mbgfq51gf98dl8b4m7q0s66njjc4hb87qmd4lf361nmwh63m9hk"))
(modules '((guix build utils)))
;; Pre-generated.
(snippet '(for-each delete-file (find-files "tries")))))
(build-system cargo-build-system)
(arguments
(list
#:skip-build? #t
#:cargo-package-crates ''("hypher")
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'regenerate
(lambda _
;; Stop the attempted dependency retrieval for a bench-marking
;; tool.
(substitute* "Cargo.toml" (("^members.+$") ""))
;; --no-default-features lets us avoid using the upstream
;; source's pre-generated tries when running the
;; trie-regenerating "generate" test. We are throwing library
;; binary away, anyways, because we only want the source.
;; See also: <https://github.com/typst/hypher/issues/19>.
(false-if-exception
(invoke "cargo" "test" "--test" "generate"
"--no-default-features"))
(delete-file-recursively "target"))))))
(home-page "https://github.com/typst/hypher")
(synopsis "Separate words into syllables")
(description "@code{hypher} is a Rust library for syllabification.")
(license (list license:expat license:asl2.0)))))
(define-public rust-pcre2-utf32-0.2
(hidden-package
(package
(name "rust-pcre2-utf32")
(version "0.2.9")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/fish-shell/rust-pcre2")
(commit (string-append version "-utf32"))))
(file-name (git-file-name name version))
(sha256
(base32
"0mhjw7fvrzxb3fd0c534a17qgy6svz0z8269d2fs6q8aw11610mr"))
(modules '((guix build utils)))
(snippet '(delete-file-recursively "pcre2-sys/upstream"))))
(build-system cargo-build-system)
(arguments
(list #:skip-build? #t
#:cargo-package-crates
''("pcre2-sys" "pcre2")))
(inputs (cargo-inputs 'rust-pcre2-utf32-0.2))
(home-page "https://github.com/fish-shell/rust-pcre2")
(synopsis "High level wrapper library for PCRE2")
(description
"This package provides @code{fish} shell's fork of @code{rust-pcre2} with
UTF-32 support.")
(license (list license:expat license:unlicense)))))
(define-public rust-pipewire-0.8.0.fd3d8f7
(let ((commit "fd3d8f7861a29c2eeaa4c393402e013578bb36d9")
(revision "0"))
(hidden-package
(package
(name "rust-pipewire")
(version (git-version "0.8.0" revision commit))
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://gitlab.freedesktop.org/pipewire/pipewire-rs.git")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32 "1hzyhz7xg0mz8a5y9j6yil513p1m610q3j9pzf6q55vdh5mcn79v"))))
(build-system cargo-build-system)
(arguments
(list #:skip-build? #t
#:cargo-package-crates
''("libspa-sys" "libspa" "pipewire-sys" "pipewire")
#:phases
#~(modify-phases %standard-phases
;; Avoid circular dependency.
(add-after 'unpack 'remove-dev-dependencies
(lambda _
(substitute* "libspa/Cargo.toml"
(("^pipewire.*") "")))))))
(inputs (cargo-inputs 'rust-pipewire-0.8.0.fd3d8f7))
(home-page "https://pipewire.org/")
(synopsis "Rust bindings for PipeWire")
(description "This package provides Rust bindings for PipeWire.")
(license license:expat)))))
(define-public rust-pipewire-0.8.0.93138d0
(let ((commit "93138d01b23628521b29b5604bbebe991cba4c65"))
(hidden-package
(package
(inherit rust-pipewire-0.8.0.fd3d8f7)
(name "rust-pipewire")
(version (git-version "0.8.0" "0" commit))
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://gitlab.freedesktop.org/pipewire/pipewire-rs.git")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"0zgqklzmyk893n82zq8d0is57npvy9lsfpqb83h1bbx9c42fl35p"))))
(inputs (cargo-inputs 'rust-pipewire-0.8.0.93138d0))))))
(define-public rust-pubgrub-0.3.0.b70cf70
(let ((commit "b70cf707aa43f21b32f3a61b8a0889b15032d5c4")
(revision "0"))
(hidden-package
(package
(name "rust-pubgrub")
(version (git-version "0.3.0" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/astral-sh/pubgrub")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"08rfk4hh2cx4v8fi62j365mwga3fgww9wcfszq7i5g4zmlhp8p8l"))
(modules '((guix build utils)))
;; Pretend to be version 0.3.0.
(snippet
'(substitute* "Cargo.toml"
(("0\\.3\\.0-alpha\\.1") "0.3.0")))))
(build-system cargo-build-system)
(arguments
(list #:skip-build? #t
#:cargo-package-crates ''("version-ranges" "pubgrub")))
(inputs (cargo-inputs 'rust-pubgrub-0.3.0.b70cf70))
(home-page "https://github.com/pubgrub-rs/pubgrub")
(synopsis "PubGrub version solving algorithm")
(description
"This package provides the @code{PubGrub} version solving algorithm.")
(license license:mpl2.0)))))
(define-public rust-ring-0.17
(hidden-package
(package
(name "rust-ring")
(version "0.17.8") ;Not tagged.
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/briansmith/ring")
(commit "fa98b490bcbc99a01ff150896ec74c1813242d7f")))
(file-name (git-file-name "rust-ring" version))
(sha256
(base32 "0rqfal81bf4l3dja98cajfjq2jbz1rcx7xdp2r33cxrm5y5psr28"))
(patches (search-patches "rust-ring-0.17-ring-core.patch"))
(modules '((guix build utils)))
(snippet
#~(begin
;; It turns out Guix's nasm works just fine here.
(substitute* "build.rs"
(("./target/tools/windows/nasm/nasm") "nasm"))
;; These files are pregenerated:
(delete-file "crypto/curve25519/curve25519_tables.h")
(delete-file "crypto/fipsmodule/ec/p256-nistz-table.h")
(delete-file "crypto/fipsmodule/ec/p256_table.h")
;; As seen in git between 0.17.0 and 0.17.1.
(substitute* "crypto/curve25519/make_curve25519_tables.py"
(("static const uint8_t k25519Precomp")
"const uint8_t k25519Precomp"))
;; This file causes problems during the 'package phase and
;; is not distributed with the packaged crate.
(delete-file-recursively "bench")
(substitute* "Cargo.toml"
(("\"bench\",") ""))))))
(build-system cargo-build-system)
(arguments
(list
#:skip-build? #t
#:cargo-package-crates ''("ring")
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'regenerate
(lambda _
(setenv "HOME" (getcwd))
(with-directory-excursion "crypto/curve25519"
(with-output-to-file "curve25519_tables.h"
(lambda _ (invoke "python3" "make_curve25519_tables.py"))))
(with-directory-excursion "crypto/fipsmodule/ec"
(invoke "go" "run" "make_tables.go")
(invoke "go" "run" "make_ec_scalar_base_mult_tests.go"))
(format #t "Generating the pregenerated files ...~%")
(force-output)
(mkdir-p "pregenerated/tmp/ring_core_generated")
;; We generate all the files which upstream would normally be
;; generate by using 'RING_PREGENERATE_ASM=1 cargo build
;; --target-dir=target/pregenerate_asm' in order to not include
;; a dependency on cargo when generating the sources.
(define (prefix script)
(string-append
"pregenerated/"
(string-drop-right
(string-drop script
(string-index-right script #\/)) 3)))
(for-each
(lambda (script)
(invoke "perl" script "ios64"
(string-append (prefix script) "-ios64.S"))
(invoke "perl" script "linux64"
(string-append (prefix script) "-linux64.S"))
(invoke "perl" script "win64"
(string-append (prefix script) "-win64.S")))
'("crypto/fipsmodule/aes/asm/aesv8-armx.pl"
"crypto/fipsmodule/modes/asm/ghashv8-armx.pl"
"crypto/chacha/asm/chacha-armv8.pl"
"crypto/cipher_extra/asm/chacha20_poly1305_armv8.pl"
"crypto/fipsmodule/aes/asm/vpaes-armv8.pl"
"crypto/fipsmodule/bn/asm/armv8-mont.pl"
"crypto/fipsmodule/ec/asm/p256-armv8-asm.pl"
"crypto/fipsmodule/modes/asm/ghash-neon-armv8.pl"
"crypto/fipsmodule/modes/asm/aesv8-gcm-armv8.pl"
"crypto/fipsmodule/sha/asm/sha512-armv8.pl"))
(for-each
(lambda (arch)
(invoke "perl" "crypto/fipsmodule/sha/asm/sha512-armv8.pl"
arch (string-append
"pregenerated/sha256-armv8-" arch ".S")))
'("ios64" "linux64" "win64"))
(for-each
(lambda (script)
(invoke "perl" script "linux32"
(string-append (prefix script) "-linux32.S")))
'("crypto/fipsmodule/aes/asm/aesv8-armx.pl"
"crypto/fipsmodule/modes/asm/ghashv8-armx.pl"
"crypto/fipsmodule/aes/asm/bsaes-armv7.pl"
"crypto/fipsmodule/aes/asm/vpaes-armv7.pl"
"crypto/fipsmodule/bn/asm/armv4-mont.pl"
"crypto/chacha/asm/chacha-armv4.pl"
"crypto/fipsmodule/modes/asm/ghash-armv4.pl"
"crypto/fipsmodule/sha/asm/sha256-armv4.pl"
"crypto/fipsmodule/sha/asm/sha512-armv4.pl"))
(for-each
(lambda (script)
(invoke "perl" script "elf"
"-fPIC" "-DOPENSSL_IA32_SSE2"
(string-append (prefix script) "-elf.S"))
(invoke "perl" script "win32n"
"-fPIC" "-DOPENSSL_IA32_SSE2"
(string-append
"pregenerated/tmp/"
(string-drop (prefix script) 13) "-win32n.asm")))
'("crypto/fipsmodule/aes/asm/aesni-x86.pl"
"crypto/fipsmodule/aes/asm/vpaes-x86.pl"
"crypto/fipsmodule/bn/asm/x86-mont.pl"
"crypto/chacha/asm/chacha-x86.pl"
"crypto/fipsmodule/modes/asm/ghash-x86.pl"))
(for-each
(lambda (script)
(invoke "perl" script "elf"
(string-append (prefix script) "-elf.S"))
(invoke "perl" script "macosx"
(string-append (prefix script) "-macosx.S"))
(invoke "perl" script "nasm"
(string-append
"pregenerated/tmp/"
(string-drop (prefix script) 13) "-nasm.asm")))
'("crypto/chacha/asm/chacha-x86_64.pl"
"crypto/fipsmodule/aes/asm/aesni-x86_64.pl"
"crypto/fipsmodule/aes/asm/vpaes-x86_64.pl"
"crypto/fipsmodule/bn/asm/x86_64-mont.pl"
"crypto/fipsmodule/bn/asm/x86_64-mont5.pl"
"crypto/fipsmodule/ec/asm/p256-x86_64-asm.pl"
"crypto/fipsmodule/modes/asm/aesni-gcm-x86_64.pl"
"crypto/fipsmodule/modes/asm/ghash-x86_64.pl"
"crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
"crypto/cipher_extra/asm/chacha20_poly1305_x86_64.pl"))
(invoke "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
"elf" "pregenerated/sha256-x86_64-elf.S")
(invoke "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
"macosx" "pregenerated/sha256-x86_64-macosx.S")
(invoke "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
"nasm" "pregenerated/tmp/sha256-x86_64-nasm.asm")
;; TODO: Extract ring_core_generated/prefix_symbols_nasm.inc
;; and ring_core_generated/prefix_symbols_asm.h from build.rs.
(for-each
(lambda (script)
(invoke "nasm" "-o" (string-append (prefix script) "o")
"-f" "win32" "-i" "include/" "-i" "pregenerated/tmp/"
"-Xgnu" "-gcv8" script))
(find-files "pregenerated/tmp" "win32n\\.asm"))
(for-each
(lambda (script)
(invoke "nasm" "-o" (string-append (prefix script) "o")
"-f" "win64" "-i" "include/" "-i" "pregenerated/tmp/"
"-Xgnu" "-gcv8" script))
(find-files "pregenerated/tmp" "nasm\\.asm")))))))
(native-inputs (list clang go gzip nasm perl python-minimal tar))
(propagated-inputs (cargo-inputs 'rust-ring-0.17))
(home-page "https://github.com/briansmith/ring")
(synopsis "Safe, fast, small crypto using Rust")
(description "This package provided safe, fast, small crypto using Rust.")
(license (list license:isc license:openssl)))))
(define-public rust-ring-0.17.14
(hidden-package
(package
(inherit rust-ring-0.17)
(version "0.17.14")
(source
(origin
(method url-fetch)
(uri (crate-uri "ring" version))
(file-name (string-append "rust-ring-" version ".tar.gz"))
(sha256
(base32 "1dw32gv19ccq4hsx3ribhpdzri1vnrlcfqb2vj41xn4l49n9ws54"))))
(arguments
(list #:skip-build? #t
#:cargo-package-crates ''("ring"))))))
(define-public rust-rustc-demangle-capi-0.1
(hidden-package
(package
(name "rust-rustc-demangle-capi")
(version "0.1.0")
(source
(origin
(method url-fetch)
(uri (crate-uri "rustc-demangle-capi" version))
(file-name (string-append name "-" version ".tar.gz"))
(sha256
(base32 "1s2g4z1yrh1sxl4qkmpd19ss3x2lr9115vbir7pnhgy63r1d63yv"))))
(build-system cargo-build-system)
(arguments
(list
#:phases
#~(modify-phases %standard-phases
(add-after 'install 'install-c-library
(lambda _
(install-file
(car (find-files "." "^rustc_demangle\\.h$"))
(string-append #$output "/include"))
(install-file
(car (find-files "." "^librustc_demangle.so$"))
(string-append #$output "/lib")))))))
(inputs (cargo-inputs 'rust-rustc-demangle-capi-0.1))
(home-page "https://github.com/alexcrichton/rustc-demangle")
(synopsis "C API for the @code{rustc-demangle} crate")
(description "This package provides a C API library for the
@code{rustc-demangle} crate.")
(license (list license:expat license:asl2.0)))))
(define-public rust-salsa-0.23.0.3713cd7
(let ((commit "3713cd7eb30821c0c086591832dd6f59f2af7fe7")
(revision "0"))
(package
(name "rust-salsa")
(version (git-version "0.23.0" revision commit))
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/salsa-rs/salsa.git")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32 "1c90zkhy9hvwqlk5is0nrs4wlpj9qzaga1z4jcdlyrdl343n7qlz"))))
(build-system cargo-build-system)
(arguments
(list #:skip-build? #t
#:cargo-package-crates
''("salsa-macro-rules" "salsa-macros" "salsa")))
(inputs (cargo-inputs 'rust-salsa-0.23.0.3713cd7))
(home-page "https://github.com/salsa-rs/salsa")
(synopsis "Framework for incrementalized computation")
(description "This package provides a generic framework for on-demand,
incrementalized computation (experimental).")
(license (list license:asl2.0 license:expat)))))
(define-public rust-smithay-0.6.0.ede2707
(let ((commit "ede27079f45eeb7c21796e22f3bc25b741b024ea")
(revision "2"))
(hidden-package
(package
(name "rust-smithay")
(version (git-version "0.6.0" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/Smithay/smithay")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"187vdwhy6fjjym9xmyzdhpw1r5xfdfsbbn7y8xv0x9dv12f1var2"))))
(build-system cargo-build-system)
(arguments
(list #:skip-build? #t
#:cargo-package-crates ''("smithay" "smithay-drm-extras")))
(inputs (cargo-inputs 'rust-smithay-0.6.0.ede2707))
(home-page "https://github.com/Smithay/smithay")
(synopsis "Smithy for Rust Wayland compositors")
(description
"Smithay aims to provide building blocks to create wayland compositors
in Rust. While not being a full-blown compositor, it'll provide objects and
interfaces implementing common functionalities that pretty much any compositor
will need, in a generic fashion.
It supports the @code{wayland}, @code{wayland-protocols}, and some external
extensions, such as @code{wlr-protocols} and @code{plasma-wayland-protocols}.")
(license license:expat)))))
(define-public rust-smithay-0.7.0.20d2dac
(let ((commit "20d2dacd71394b5f96f6ace0a70a6f20dc62c0c6"))
(hidden-package
(package
(inherit rust-smithay-0.6.0.ede2707)
(name "rust-smithay")
(version (git-version "0.7.0" "0" commit))
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/Smithay/smithay")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"0h1q1jgyg76axr8h95nv8sg29l15iqnyfr5qfl5rk2wc7iw04avl"))))
(inputs (cargo-inputs 'rust-smithay-0.7.0.20d2dac))))))
(define inspired-github-color-scheme-for-rust-syntect-5
(let ((version "1.3.0"))
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/sethlopez/InspiredGitHub.tmtheme")
(commit (string-append "v" version))))
(file-name "inspired-github-color-scheme-checkout")
(sha256
(base32
"0w2sswa2kid1jwqy28xqvjav17xzkza32i9vvyj67m1kfm3dd6ww")))))
(define solarized-for-rust-syntect-5
(let ((version "1.5.11"))
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/braver/Solarized")
(commit version)))
(file-name "solarized-checkout")
(sha256
(base32
"05n8wq7zahydrnx36k7awqjz8svn13xsxcazyj0909h4akbsglj1")))))
(define spacegray-for-rust-syntect-5
(let ((commit "2703e93f559e212ef3895edd10d861a4383ce93d"))
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/SublimeText/Spacegray")
(commit commit)))
(file-name "spacegray-checkout")
(sha256
(base32
"0vzs9i3sdh6f1b25vdbxwyphmxzbqixrnjlgws56fzfngy4my9dj")))))
(define-public rust-syntect-5.2
(hidden-package
(package
(name "rust-syntect")
(version "5.2.0")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/trishume/syntect")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"1wr5x6jy53s597j7kfyzhwph1d07a18qc45s47cx4f399f0xwk9l"))
(modules '((guix build utils)))
(snippet
'(begin
(delete-file-recursively "scripts")
(for-each
(lambda (file)
(delete-file file)
(with-output-to-file file
(const (display "\n"))))
(find-files "assets" "dump$"))))))
(build-system cargo-build-system)
(arguments
(list #:skip-build? #t
#:cargo-package-crates ''("syntect")
#:phases
#~(modify-phases %standard-phases
(replace 'build
(lambda _
(substitute* "Makefile"
(("git submodule.*") ""))
(with-directory-excursion "testdata"
(rmdir "InspiredGitHub.tmtheme")
(copy-recursively
#+(this-package-native-input
"inspired-github-color-scheme-checkout")
"InspiredGitHub.tmtheme")
(rmdir "Solarized")
(copy-recursively
#+(this-package-native-input "solarized-checkout")
"Solarized")
(rmdir "spacegray")
(copy-recursively
#+(this-package-native-input "solarized-checkout")
"spacegray"))
(invoke "make" "assets"))))))
(native-inputs
(list pkg-config
inspired-github-color-scheme-for-rust-syntect-5
solarized-for-rust-syntect-5
spacegray-for-rust-syntect-5))
(inputs (cons oniguruma (cargo-inputs 'rust-syntect-5.2)))
(home-page "https://github.com/trishume/syntect")
(synopsis "Library for syntax highlighting and code intelligence")
(description
"This package provides a library for syntax highlighting and code
intelligence.")
(license license:expat))))
(define-public rust-syntect-5.3
(hidden-package
(package
(inherit rust-syntect-5.2)
(name "rust-syntect")
(version "5.3.0")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/trishume/syntect")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "095yvdd4lpzfywcg5zr7pq28fm9iarx6a85mpgdc0g6d1waydp68"))
(modules '((guix build utils)))
(snippet (origin-snippet (package-source rust-syntect-5.2)))))
(inputs (cons oniguruma
(cargo-inputs 'rust-syntect-5.3))))))
(define-public rust-codex-0.0.0.785c0c43
(let ((commit "785c0c43df941e6997ff3a9e8a9dd48da2661f20")
(revision "0"))
(hidden-package
(package
(name "rust-codex")
(version (git-version "0.0.0" revision commit))
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/zed-industries/codex")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32 "0rwj1ykknng39mhzna3fw3rcl3vngynsjdcj1namgkvw91zd9dl7"))
;; TODO: Remove patches when Rust provides stable file locking API.
;; The file_lock feature is tracked at
;; <https://github.com/rust-lang/rust/issues/130994>.
(patches (search-patches "rust-codex-0.98.0-execpolicy-file-lock.patch"
"rust-codex-0.98.0-core-file-lock.patch"
"rust-codex-0.98.0-arg0-file-lock.patch"
"rust-codex-0.98.0-core-remove-self-dep.patch"))))
(build-system cargo-build-system)
(arguments
(list
#:skip-build? #t
#:cargo-package-crates
;; Order matters: dependencies must come before packages that need them
''("codex-async-utils" ; No internal deps
"codex-client" ; No internal deps
"codex-execpolicy" ; No internal deps
"codex-file-search" ; No internal deps
"codex-git" ; No internal deps
"codex-keyring-store" ; No internal deps
"codex-utils-absolute-path" ; No internal deps
"codex-utils-cache" ; No internal deps
"codex-utils-cargo-bin" ; No internal deps
"codex-utils-home-dir" ; No internal deps
"codex-utils-json-to-toml" ; No internal deps
"codex-utils-pty" ; No internal deps
"codex-utils-readiness" ; No internal deps
"codex-utils-string" ; No internal deps
"codex-utils-image" ; Depends on codex-utils-cache
"codex-apply-patch" ; Depends on codex-utils-cargo-bin
"codex-protocol" ; Depends on codex-git, codex-utils-*
"codex-windows-sandbox" ; Depends on codex-utils-absolute-path, codex-protocol
"codex-api" ; Depends on codex-client, codex-protocol
"codex-experimental-api-macros" ; Macro crate (must come before app-server-protocol)
"codex-app-server-protocol" ; Depends on codex-protocol, codex-experimental-api-macros
"codex-rmcp-client" ; Depends on codex-keyring-store, codex-protocol
"codex-otel" ; Depends on codex-app-server-protocol, codex-api
"codex-state" ; Depends on codex-protocol, codex-otel
"codex-core" ; Depends on many packages above
"codex-linux-sandbox" ; Depends on codex-core, codex-utils-absolute-path
"codex-arg0" ; Depends on codex-apply-patch, codex-core, codex-linux-sandbox
"codex-lmstudio" ; Depends on codex-core
"codex-login" ; Depends on codex-core
"codex-ollama" ; Depends on codex-core
"codex-common" ; Depends on codex-core, codex-lmstudio, codex-ollama
"codex-mcp-server") ; Depends on codex-core, codex-common
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'chdir-to-workspace
(lambda _
(chdir "codex-rs")))
(add-after 'chdir-to-workspace 'patch-git-deps-to-vendor
(lambda _
;; Avoid git fetches in offline builds by pointing patches
;; at the vendored sources provided via cargo-inputs.
(substitute* "Cargo.toml"
(("crossterm = \\{ git = [^}]+\\}")
"crossterm = { version = \"0.28.1\" }")
(("ratatui = \\{ git = [^}]+\\}")
"ratatui = { version = \"0.29.0\" }")
(("tokio-tungstenite = \\{ git = [^}]+\\}")
"tokio-tungstenite = { version = \"0.28.0\" }")
;; Point nucleo git dependency to vendored checkout.
(("nucleo = \\{ git = [^}]+\\}")
"nucleo = { version = \"0.5.0\" }")
;; Point runfiles git dependency to vendored checkout.
(("runfiles = \\{ git = [^}]+\\}")
"runfiles = { version = \"0.1.0\" }"))))
(add-after 'chdir-to-workspace 'add-version-to-workspace-deps
(lambda _
;; cargo package requires all dependencies to have versions.
;; Add version = "0.0.0" to internal path dependencies.
(let ((cargo-files (find-files "." "^Cargo\\.toml$")))
(substitute* cargo-files
;; Handle inline deps: name = { path = "..." }
(("(codex-[a-z0-9-]+) = \\{ path = " all name)
(string-append name " = { version = \"0.0.0\", path = "))
;; Handle inline deps with package: name = { package = "...", path = "..." }
(("(codex-[a-z0-9-]+) = \\{ package = " all name)
(string-append name " = { version = \"0.0.0\", package = "))
;; Handle section deps: [dependencies.X] with path = "..."
(("^(path = \"\\.\\./[^\"]*\")" all path-line)
(string-append path-line "\nversion = \"0.0.0\"")))))))))
(inputs (cargo-inputs 'rust-codex-0.0.0.785c0c43))
(home-page "https://github.com/zed-industries/codex")
(synopsis "Zed Codex workspace crates")
(description
"This package provides the workspace crates for the Zed Codex CLI
and runtime for AI-assisted coding.")
(license license:asl2.0)))))
;; Also update (@ (gnu packages gnome) glycin-loaders) when updating this.
(define-public rust-glycin-3
(package
(name "rust-glycin")
(version "3.0.7")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://gitlab.gnome.org/GNOME/glycin.git")
;; Rust library version is different from the tagged version.
(commit "2.0.7")))
(file-name (git-file-name name version))
(sha256
(base32
"0v6szxk5h8a4b28xb0lrhqrq6b4vka2ha4qgpdp35f6c49v9pdyp"))
(patches (search-patches "glycin-sandbox-Adapt-bwrap-invocation.patch"))))
(build-system cargo-build-system)
(arguments
(list
#:skip-build? #t
#:cargo-package-crates ''("glycin-common" "glycin-utils" "glycin")
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'set-bin-paths
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "glycin/src/sandbox.rs"
(("@bwrap@")
(search-input-file inputs "bin/bwrap"))
(("@storedir@")
#$%storedir)
(("/usr/bin/true")
(search-input-file inputs "bin/true"))))))))
(inputs (cons* bubblewrap (cargo-inputs 'glycin)))
;; Uses XDG_DATA_DIRS to search for the loaders. See Config::data_dirs() in
;; config.rs. Using a specific search path was discussed in
;; <https://codeberg.org/guix/guix/pulls/1653> and
;; <https://gitlab.gnome.org/GNOME/glycin/-/merge_requests/343>.
(native-search-paths (list $XDG_DATA_DIRS))
(home-page "https://gitlab.gnome.org/GNOME/glycin")
(synopsis "Rust library for sandboxed image decoding")
(description "Glycin is a sandbox image decoder for image viewers and
thumbnails to display untrusted content safely.")
(license (list license:mpl2.0 license:lgpl2.1+))))
|