projects/guix·blob ruby-team · refs

2008 lines · 79.2 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2018 宋文武 <[email protected]>
3;;; Copyright © 2019 Leo Famulari <[email protected]>
4;;; Copyright © 2018, 2019, 2021, 2022, 2024 Tobias Geerinckx-Rice <[email protected]>
5;;; Copyright © 2020 Jelle Licht <[email protected]>
6;;; Copyright © 2020 Ludovic Courtès <[email protected]>
7;;; Copyright © 2021 Léo Le Bouter <[email protected]>
8;;; Copyright © 2021 Maxim Cournoyer <[email protected]>
9;;; Copyright © 2021 Timmy Douglas <[email protected]>
10;;; Copyright © 2022 Michael Rohleder <[email protected]>
11;;; Copyright © 2022 Pierre Langlois <[email protected]>
12;;; Copyright © 2022 Zhu Zihao <[email protected]>
13;;; Copyright © 2023 Hilton Chain <[email protected]>
14;;; Copyright © 2023 Ricardo Wurmus <[email protected]>
15;;; Copyright © 2023 Zongyuan Li <[email protected]>
16;;; Copyright © 2024 Ashish SHUKLA <[email protected]>
17;;; Copyright © 2024 Foundation Devices, Inc. <[email protected]>
18;;; Copyright © 2024 Jean-Pierre De Jesus DIAZ <[email protected]>
19;;; Copyright © 2024-2026 Sharlatan Hellseher <[email protected]>
20;;; Copyright © 2024-2026 Tomas Volf <[email protected]>
21;;; Copyright © 2025, 2026 Foster Hangdaan <[email protected]>
22;;; Copyright © 2026 Giacomo Leidi <[email protected]>
23;;; Copyright © 2026 Konstantin Suntsov <[email protected]>
24;;;
25;;; This file is part of GNU Guix.
26;;;
27;;; GNU Guix is free software; you can redistribute it and/or modify it
28;;; under the terms of the GNU General Public License as published by
29;;; the Free Software Foundation; either version 3 of the License, or (at
30;;; your option) any later version.
31;;;
32;;; GNU Guix is distributed in the hope that it will be useful, but
33;;; WITHOUT ANY WARRANTY; without even the implied warranty of
34;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35;;; GNU General Public License for more details.
36;;;
37;;; You should have received a copy of the GNU General Public License
38;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
39
40(define-module (gnu packages containers)
41 #:use-module (guix gexp)
42 #:use-module ((guix licenses) #:prefix license:)
43 #:use-module (guix modules)
44 #:use-module (gnu packages)
45 #:use-module (guix packages)
46 #:use-module (guix download)
47 #:use-module (guix git-download)
48 #:use-module (guix build-system copy)
49 #:use-module (guix build-system gnu)
50 #:use-module (guix build-system go)
51 #:use-module (guix build-system guile)
52 #:use-module (guix build-system meson)
53 #:use-module (guix build-system pyproject)
54 #:use-module ((guix search-paths) #:select ($GUIX_EXTENSIONS_PATH))
55 #:use-module (guix utils)
56 #:use-module (gnu packages admin)
57 #:use-module (gnu packages autotools)
58 #:use-module (gnu packages base)
59 #:use-module (gnu packages bash)
60 #:use-module (gnu packages check)
61 #:use-module (gnu packages compression)
62 #:use-module (gnu packages docker)
63 #:use-module (gnu packages glib)
64 #:use-module (gnu packages gcc)
65 #:use-module (gnu packages gettext)
66 #:use-module (gnu packages gnupg)
67 #:use-module (gnu packages golang)
68 #:use-module (gnu packages golang-build)
69 #:use-module (gnu packages golang-check)
70 #:use-module (gnu packages golang-compression)
71 #:use-module (gnu packages golang-crypto)
72 #:use-module (gnu packages golang-maths)
73 #:use-module (gnu packages golang-web)
74 #:use-module (gnu packages golang-xyz)
75 #:use-module (gnu packages guile)
76 #:use-module (gnu packages guile-xyz)
77 #:use-module (gnu packages linux)
78 #:use-module (gnu packages man)
79 #:use-module (gnu packages pcre)
80 #:use-module (gnu packages python)
81 #:use-module (gnu packages networking)
82 #:use-module (gnu packages package-management)
83 #:use-module (gnu packages pkg-config)
84 #:use-module (gnu packages prometheus)
85 #:use-module (gnu packages python-xyz)
86 #:use-module (gnu packages python-build)
87 #:use-module (gnu packages python-check)
88 #:use-module (gnu packages rust-apps)
89 #:use-module (gnu packages selinux)
90 #:use-module (gnu packages version-control)
91 #:use-module (gnu packages web)
92 #:use-module (gnu packages wget))
93
94;;; Code:
95
96;;;
97;;; Libraries:
98;;;
99
100(define-public go-github-com-checkpoint-restore-checkpointctl
101 (package
102 (name "go-github-com-checkpoint-restore-checkpointctl")
103 (version "1.5.0")
104 (source
105 (origin
106 (method git-fetch)
107 (uri (git-reference
108 (url "https://github.com/checkpoint-restore/checkpointctl")
109 (commit (string-append "v" version))))
110 (file-name (git-file-name name version))
111 (sha256
112 (base32 "0qvgld9vji5f7h2idk6r3q30909hqws0rkpvgina43i57bsfh2sv"))
113 (snippet
114 #~(begin
115 (use-modules (guix build utils))
116 (delete-file-recursively "vendor")))))
117 (build-system go-build-system)
118 (arguments
119 (list
120 #:skip-build? #t
121 #:import-path "github.com/checkpoint-restore/checkpointctl"))
122 (native-inputs
123 (list go-github-com-spf13-cobra))
124 (propagated-inputs
125 (list go-github-com-checkpoint-restore-go-criu-v8
126 go-github-com-containers-storage
127 go-github-com-opencontainers-runtime-spec
128 go-github-com-xlab-treeprint))
129 (home-page "https://github.com/checkpoint-restore/checkpointctl")
130 (synopsis "Tool for in-depth analysis of container checkpoints")
131 (description
132 "This package provides a Go library to read and manipulate checkpoint
133archives as created by Podman, CRI-O and containerd.")
134 (license license:asl2.0)))
135
136(define-public go-github-com-containerd-aufs
137 (package
138 (name "go-github-com-containerd-aufs")
139 (version "1.0.0")
140 (source
141 (origin
142 (method git-fetch)
143 (uri (git-reference
144 (url "https://github.com/containerd/aufs")
145 (commit (string-append "v" version))))
146 (file-name (git-file-name name version))
147 (sha256
148 (base32 "0jyyyf6sr910m602axmp4h4j1l2n680cpp60z09pvprz55zi4ba0"))))
149 (build-system go-build-system)
150 (arguments
151 (list
152 #:skip-build? #t ;source only package
153 #:tests? #f
154 #:import-path "github.com/containerd/aufs"))
155 (propagated-inputs
156 (list ;; go-github-com-containerd-containerd ; cycles
157 go-github-com-containerd-continuity
158 go-github-com-pkg-errors
159 go-golang-org-x-sys))
160 (home-page "https://github.com/containerd/aufs")
161 (synopsis "AUFS snapshotter containerd v1")
162 (description
163 "This package provides an @acronym{Advanced multi-layered Unification
164FilesyStem, AUFS} implementation of the snapshot interface for containerd.")
165 (license license:asl2.0)))
166
167(define-public go-github-com-containerd-containerd-v2
168 (package
169 (name "go-github-com-containerd-containerd-v2")
170 (version "2.2.3")
171 (source
172 (origin
173 (method git-fetch)
174 (uri (git-reference
175 (url "https://github.com/containerd/containerd")
176 (commit (string-append "v" version))))
177 (file-name (git-file-name name version))
178 (sha256
179 (base32 "0wxy5np689571s6lw77mx63nw75fx85w5svi0jplksmqzmjqp8wd"))
180 (snippet
181 #~(begin (use-modules (guix build utils))
182 (delete-file-recursively "vendor")
183 ;; Submodules with their own go.mod files and packaged separately:
184 ;;
185 ;; - github.com/containerd/containerd/api
186 (delete-file-recursively "api")))))
187 (build-system go-build-system)
188 (arguments
189 (list
190 #:skip-build? #t
191 #:import-path "github.com/containerd/containerd/v2"
192 #:test-subdirs
193 #~(list "cmd/protoc-gen-go-fieldpath/..."
194 "core/containers/..."
195 "core/content/..."
196 "core/diff"
197 "core/diff/apply"
198 "core/events/..."
199 "core/images/..."
200 "core/introspection/..."
201 "core/leases/..."
202 "core/metrics/..."
203 "core/remotes/..."
204 "core/sandbox/..."
205 "core/streaming/..."
206 "core/transfer"
207 "core/transfer/archive/..."
208 "core/transfer/image/..."
209 "core/transfer/local/..."
210 "core/transfer/plugins/..."
211 "core/transfer/streaming/..."
212 "core/unpack/..."
213 "internal/cleanup/..."
214 "internal/erofsutils/..."
215 "internal/eventq/..."
216 "internal/failpoint/..."
217 "internal/fsverity/..."
218 "internal/kmutex/..."
219 "internal/lazyregexp/..."
220 "internal/pprof/..."
221 "internal/randutil/..."
222 "internal/registrar/..."
223 "internal/tomlext/..."
224 "internal/truncindex/..."
225 "internal/userns/..."
226 "internal/wintls/..."
227 "pkg/apparmor/..."
228 "pkg/archive/..."
229 "pkg/atomicfile/..."
230 "pkg/blockio/..."
231 "pkg/cap/..."
232 "pkg/cio..."
233 "pkg/deprecation/..."
234 "pkg/dialer/..."
235 "pkg/display/..."
236 "pkg/epoch/..."
237 "pkg/fifosync/..."
238 "pkg/filters/..."
239 "pkg/gc/..."
240 "pkg/httpdbg/..."
241
242 ;; TODO: Check why these submodule fail to build.
243 ;; "client/..."
244 ;; "cmd/containerd-shim-runc-v2/..."
245 ;; "cmd/containerd-stress/..."
246 ;; "cmd/containerd/..."
247 ;; "cmd/ctr/..."
248 ;; "cmd/gen-manpages/..."
249 ;; "contrib/..."
250 ;; "core/diff/proxy"
251 ;; "core/metadata/..."
252 ;; "core/mount/..."
253 ;; "core/runtime/..."
254 ;; "core/snapshots/..."
255 ;; "core/transfer/proxy/..."
256 ;; "core/transfer/registry/..."
257 ;; "integration/..."
258 ;; "internal/cri/..."
259 ;; "internal/nri/..."
260 ;; "pkg/cdi/..."
261 #;"plugins/...")
262 #:test-flags
263 #~(list "-skip" (string-join
264 ;; panic: cannot statfs cgroup root [recovered]
265 (list "TestValidateConfig"
266 ;; io_test.go:40: failed to start binary process:
267 ;; fork/exec /bin/echo: no such file or directory
268 "TestNewBinaryIO"
269 ;; expected success: got executable file not found in $PATH
270 "TestExecutorWithArgs"
271 "TestSetEnv"
272 "TestStdIOPipes"
273 ;; panic: cannot statfs cgroup root
274 "TestContainerCapabilities"
275 "TestContainerSpecTty"
276 "TestContainerSpecReadonlyRootfs"
277 "TestContainerSpecWithExtraMounts"
278 "TestContainerAndSandboxPrivileged"
279 "TestPrivilegedBindMount"
280 "TestCgroupNamespace"
281 "TestPidNamespace/node_namespace_mode"
282 ;; failed to apply b: invalid argument
283 "TestDiffTar/IgnoreSockets"
284 "TestBinDirVerifyImage/max_verifiers_=_-1,_with_timeout"
285 "TestContainerSpecDefaultPath"
286 ;; Error: Not equal:
287 ;; expected: 1000
288 ;; actual : 123
289 "TestSetPositiveOomScoreAdjustment")
290 "|"))))
291 (native-inputs
292 (list go-github-com-stretchr-testify))
293 (propagated-inputs
294 (list go-dario-cat-mergo
295 go-github-com-adalogics-go-fuzz-headers
296 go-github-com-checkpoint-restore-checkpointctl
297 go-github-com-checkpoint-restore-go-criu-v7
298 go-github-com-containerd-btrfs-v2
299 go-github-com-containerd-cgroups-v3
300 go-github-com-containerd-console
301 go-github-com-containerd-containerd-api
302 go-github-com-containerd-continuity
303 go-github-com-containerd-errdefs
304 go-github-com-containerd-errdefs-pkg
305 go-github-com-containerd-fifo
306 go-github-com-containerd-go-cni
307 go-github-com-containerd-go-runc
308 go-github-com-containerd-imgcrypt-v2
309 go-github-com-containerd-log
310 go-github-com-containerd-nri
311 go-github-com-containerd-otelttrpc
312 go-github-com-containerd-platforms
313 go-github-com-containerd-plugin
314 go-github-com-containerd-ttrpc
315 go-github-com-containerd-typeurl-v2
316 go-github-com-containerd-zfs-v2
317 go-github-com-containernetworking-cni
318 go-github-com-containernetworking-plugins
319 go-github-com-coreos-go-systemd-v22
320 go-github-com-davecgh-go-spew
321 go-github-com-distribution-reference
322 go-github-com-docker-go-events
323 go-github-com-docker-go-metrics
324 go-github-com-docker-go-units
325 go-github-com-emicklei-go-restful-v3
326 go-github-com-fsnotify-fsnotify
327 go-github-com-google-certtostore
328 go-github-com-google-go-cmp
329 go-github-com-google-uuid
330 go-github-com-grpc-ecosystem-go-grpc-middleware-providers-prometheus
331 go-github-com-intel-goresctrl
332 go-github-com-klauspost-compress
333 go-github-com-mdlayher-vsock
334 ;;go-github-com-microsoft-go-winio ;Windows only
335 ;;go-github-com-microsoft-hcsshim ;Windows only
336 go-github-com-moby-locker
337 go-github-com-moby-sys-mountinfo
338 go-github-com-moby-sys-sequential
339 go-github-com-moby-sys-signal
340 go-github-com-moby-sys-symlink
341 go-github-com-moby-sys-user
342 go-github-com-moby-sys-userns
343 go-github-com-opencontainers-go-digest
344 go-github-com-opencontainers-image-spec
345 go-github-com-opencontainers-runtime-spec
346 go-github-com-opencontainers-runtime-tools
347 go-github-com-opencontainers-selinux
348 go-github-com-pelletier-go-toml-v2
349 go-github-com-prometheus-client-golang
350 go-github-com-sirupsen-logrus
351 go-github-com-tchap-go-patricia-v2
352 go-github-com-urfave-cli-v2
353 go-github-com-vishvananda-netlink
354 go-github-com-vishvananda-netns
355 go-go-etcd-io-bbolt
356 go-go-opentelemetry-io-contrib-instrumentation-google-golang-org-grpc-otelgrpc
357 go-go-opentelemetry-io-contrib-instrumentation-net-http-otelhttp
358 go-go-opentelemetry-io-otel
359 go-go-opentelemetry-io-otel-exporters-otlp-otlptrace
360 go-go-opentelemetry-io-otel-exporters-otlp-otlptrace-otlptracegrpc
361 go-go-opentelemetry-io-otel-exporters-otlp-otlptrace-otlptracehttp
362 go-go-opentelemetry-io-otel-sdk
363 go-go-opentelemetry-io-otel-trace
364 go-go-uber-org-goleak
365 go-golang-org-x-mod
366 go-golang-org-x-sync
367 go-golang-org-x-sys
368 go-golang-org-x-time
369 go-google-golang-org-genproto-googleapis-rpc
370 go-google-golang-org-grpc
371 go-google-golang-org-protobuf
372 go-gopkg-in-inf-v0
373 go-k8s-io-apimachinery
374 go-k8s-io-client-go
375 go-k8s-io-cri-api
376 go-k8s-io-klog-v2
377 go-tags-cncf-io-container-device-interface))
378 (home-page "https://containerd.io/")
379 (synopsis "Container runtime support daemon")
380 (description
381 "Containerd is a container runtime with an emphasis on simplicity,
382robustness, and portability. It is available as a daemon, which can manage
383the complete container lifecycle of its host system: image transfer and
384storage, container execution and supervision, low-level storage and network
385attachments, etc.")
386 (license license:asl2.0)))
387
388(define-public go-github-com-containers-gvisor-tap-vsock
389 (package
390 (name "go-github-com-containers-gvisor-tap-vsock")
391 (version "0.8.8")
392 (source
393 (origin
394 (method git-fetch)
395 (uri (git-reference
396 (url "https://github.com/containers/gvisor-tap-vsock")
397 (commit (string-append "v" version))))
398 (file-name (git-file-name name version))
399 (sha256
400 (base32 "1xz710dmy58gngd0qizjw8g9nkraksqald8vzhwc5h36dqkc8nrf"))
401 (modules '((guix build utils)))
402 (snippet
403 #~(begin
404 (delete-file-recursively "vendor")
405 ;; Submodules with their own go.mod files and packaged separately:
406 ;;
407 ;; - github.com/containers/gvisor-tap-vsock/tools
408 (delete-file-recursively "tools")))))
409 (build-system go-build-system)
410 (arguments
411 (list
412 #:skip-build? #t
413 #:import-path "github.com/containers/gvisor-tap-vsock"
414 #:unpack-path "github.com/containers/gvisor-tap-vsock"
415 #:build-flags
416 #~(list (string-append "-ldflags="
417 "-X github.com/containers/gvisor-tap-vsock"
418 "/pkg/types.gitVersion=" #$version))
419 #:test-flags
420 #~(list "-skip"
421 (string-join
422 ;; Received unexpected error:
423 ;; listen unix /tmp/guix-.../test.sock: bind: invalid argument
424 (list "TestNotificationSender_Success"
425 ;; Requires network
426 "TestSuite"
427 "TestDNS")
428 "|"))
429 #:phases
430 #~(modify-phases %standard-phases
431 (add-after 'unpack 'prune-tests
432 (lambda* (#:key unpack-path #:allow-other-keys)
433 (with-directory-excursion (string-append "src/" unpack-path)
434 ;; Requires working DNS.
435 (substitute* "pkg/services/dns/dns_test.go"
436 (("Should pass DNS requests to default system DNS.*" all)
437 (string-append all "\n" "ginkgo.Skip(\"No network.\");"))
438 (("\"redhat.com\",")
439 "\"localhost\",")
440 (("\"52.200.142.250\"")
441 "\"127.0.0.1\""))))))))
442 (native-inputs
443 (list go-github-com-stretchr-testify
444 go-github-com-foxcpp-go-mockdns))
445 (propagated-inputs
446 (list go-github-com-apparentlymart-go-cidr
447 go-github-com-containers-winquit
448 go-github-com-coreos-stream-metadata-go
449 go-github-com-dustin-go-humanize
450 go-github-com-google-gopacket
451 go-github-com-inetaf-tcpproxy
452 go-github-com-insomniacslk-dhcp
453 ;; go-github-com-linuxkit-virtsock ;Windows only
454 go-github-com-mdlayher-vsock
455 ;; go-github-com-microsoft-go-winio ;Windows only
456 go-github-com-miekg-dns
457 go-github-com-onsi-ginkgo
458 go-github-com-onsi-gomega
459 go-github-com-opencontainers-go-digest
460 go-github-com-sirupsen-logrus
461 go-github-com-songgao-packets
462 go-github-com-songgao-water
463 go-github-com-vishvananda-netlink
464 go-golang-org-x-crypto
465 go-golang-org-x-mod
466 go-golang-org-x-sync
467 go-golang-org-x-sys
468 go-gopkg-in-yaml-v3
469 go-gvisor-dev-gvisor))
470 (home-page "https://github.com/containers/gvisor-tap-vsock")
471 (synopsis "Network stack for virtualization based on gVisor")
472 (description "This package provides a replacement for @code{libslirp} and
473@code{VPNKit}, written in pure Go. It is based on the network stack of gVisor
474and brings a configurable DNS server and dynamic port forwarding.
475
476It can be used with QEMU, Hyperkit, Hyper-V and User-Mode Linux.
477
478The binary is called @command{gvproxy}.")
479 (license license:asl2.0)))
480
481(define-public go-github-com-opencontainers-image-spec-schema
482 (package
483 (name "go-github-com-opencontainers-image-spec-schema")
484 (version "0.0.0-20260514171043-13cff54902ec")
485 (source
486 (origin
487 (method git-fetch)
488 (uri (git-reference
489 (url "https://github.com/opencontainers/image-spec")
490 (commit (go-version->git-ref version))))
491 (file-name (git-file-name name version))
492 (sha256
493 (base32 "0jg1wfbr6rva24cz6q6d73wgaridzkh9sclzm2dwxpiwmbkcas38"))
494 (modules '((guix build utils)
495 (ice-9 ftw)
496 (srfi srfi-26)))
497 (snippet
498 #~(begin
499 (define (delete-all-but directory . preserve)
500 (define (directory? x)
501 (and=> (stat x #f)
502 (compose (cut eq? 'directory <>) stat:type)))
503 (with-directory-excursion directory
504 (let* ((pred
505 (negate (cut member <> (append '("." "..") preserve))))
506 (items (scandir "." pred)))
507 (for-each (lambda (item)
508 (if (directory? item)
509 (delete-file-recursively item)
510 (delete-file item)))
511 items))))
512 (delete-all-but "." "schema")))))
513 (build-system go-build-system)
514 (arguments
515 (list
516 #:embed-files
517 ;; For go-github-com-santhosh-tekuri-jsonschema-v6:
518 #~(list "applicator"
519 "content"
520 "core"
521 "format"
522 "format-annotation"
523 "format-assertion"
524 "meta-data"
525 "schema"
526 "unevaluated"
527 "validation")
528 #:import-path "github.com/opencontainers/image-spec/schema"
529 #:unpack-path "github.com/opencontainers/image-spec"))
530 (propagated-inputs
531 (list go-github-com-opencontainers-go-digest
532 go-github-com-opencontainers-image-spec
533 go-github-com-russross-blackfriday-v2
534 go-github-com-santhosh-tekuri-jsonschema-v6))
535 (home-page "https://github.com/opencontainers/image-spec")
536 (synopsis "OCI Image Format")
537 (description
538 "Package schema defines the OCI image media types, schema definitions and
539validation functions.")
540 (license license:asl2.0)))
541
542(define-public go-github-com-opencontainers-image-tools
543 (package
544 (name "go-github-com-opencontainers-image-tools")
545 (version "0.3.0")
546 (source
547 (origin
548 (method git-fetch)
549 (uri (git-reference
550 (url "https://github.com/opencontainers/image-tools")
551 (commit (string-append "v" version))))
552 (file-name (git-file-name name version))
553 (sha256
554 (base32 "0drxjgcxm268cwv547anl23rv1jx7mvdfxp7nxr6fjbzpxav6bd2"))))
555 (build-system go-build-system)
556 (arguments
557 (list
558 #:skip-build? #t
559 #:import-path "github.com/opencontainers/image-tools"))
560 (home-page "https://github.com/opencontainers/image-tools")
561 (synopsis "OCI Image Tooling")
562 (description
563 "@code{oci-image-tool} is a collection of tools for working with the
564@url{https://github.com/opencontainers/image-spec, OCI image format
565specification}.")
566 (license license:asl2.0)))
567
568(define-public go-github-com-rootless-containers-rootlesskit-v3
569 (package
570 (name "go-github-com-rootless-containers-rootlesskit-v3")
571 (version "3.0.0")
572 (source
573 (origin
574 (method git-fetch)
575 (uri (git-reference
576 (url "https://github.com/rootless-containers/rootlesskit")
577 (commit (string-append "v" version))))
578 (file-name (git-file-name name version))
579 (sha256
580 (base32 "0giw1whjpm64h8f1iamgym246rr3wl01w7zgw4lygrj7dqk3clmb"))))
581 (build-system go-build-system)
582 (arguments
583 (list
584 #:skip-build? #t
585 #:import-path "github.com/rootless-containers/rootlesskit/v3"))
586 (propagated-inputs
587 (list go-github-com-containernetworking-plugins
588 go-github-com-containers-gvisor-tap-vsock
589 go-github-com-gofrs-flock
590 go-github-com-google-uuid
591 go-github-com-gorilla-mux
592 go-github-com-insomniacslk-dhcp
593 go-github-com-masterminds-semver-v3
594 go-github-com-moby-sys-mountinfo
595 go-github-com-moby-vpnkit
596 go-github-com-sirupsen-logrus
597 go-github-com-songgao-water
598 go-github-com-urfave-cli-v2
599 go-golang-org-x-sync
600 go-golang-org-x-sys
601 go-gotest-tools-v3))
602 (home-page "https://github.com/rootless-containers/rootlesskit")
603 (synopsis "Linux-native fakeroot using user namespaces in Golang")
604 (description
605 "@code{RootlessKit} is a Linux-native implementation of \"fake root\" using
606@url{http://man7.org/linux/man-pages/man7/user_namespaces.7.html,(code
607user_namespaces(7))}. It is used to run containers engines as an
608unprivileged user, known as \"Rootless mode\".")
609 (license license:asl2.0)))
610
611(define-public go-go-podman-io-common
612 (package
613 (name "go-go-podman-io-common")
614 (version "0.68.1")
615 (source
616 (origin
617 (method git-fetch)
618 (uri (git-reference
619 (url "https://github.com/podman-container-tools/container-libs")
620 (commit (go-version->git-ref version #:subdir "common"))))
621 (file-name (git-file-name name version))
622 (sha256
623 (base32 "040snqsg3il98pz9w8442wdzwm2rm07yqbch87f4jic4p4s0707s"))
624 (modules '((guix build utils)
625 (ice-9 ftw)
626 (srfi srfi-26)))
627 (snippet
628 #~(begin
629 (define (delete-all-but directory . preserve)
630 (define (directory? x)
631 (and=> (stat x #f)
632 (compose (cut eq? 'directory <>) stat:type)))
633 (with-directory-excursion directory
634 (let* ((pred
635 (negate (cut member <> (append '("." "..") preserve))))
636 (items (scandir "." pred)))
637 (for-each (lambda (item)
638 (if (directory? item)
639 (delete-file-recursively item)
640 (delete-file item)))
641 items))))
642 (delete-all-but "." "common")
643 ;; Module name has been changed upstream.
644 (substitute* (find-files "." "\\.go$")
645 (("github.com/disiqueira/gotree")
646 "github.com/d6o/GoTree"))))))
647 (build-system go-build-system)
648 (arguments
649 (list
650 #:skip-build? #t
651 #:import-path "go.podman.io/common"
652 #:unpack-path "go.podman.io"
653 #:embed-files
654 #~(list "^VERSION$")
655 #:test-subdirs
656 ;; XXX: Remove when go-go-podman-io-image-v5 and go-go-podman-io-storage
657 ;; are updated.
658 #~(list "pkg/auth" "pkg/flag" "pkg/chown" "pkg/parse" "pkg/umask"
659 "pkg/report" "pkg/sysctl" "pkg/cgroups" "pkg/filters"
660 "pkg/formats" "pkg/machine" "pkg/seccomp" "pkg/secrets"
661 "pkg/sysinfo" "pkg/timetype" "pkg/manifests" "pkg/configmaps"
662 "pkg/hooks/0.1.0" "pkg/strongunits" "pkg/capabilities"
663 "pkg/subscriptions" "pkg/secrets/filedriver"
664 "pkg/configmaps/filedriver" "pkg/apparmor/internal/supported")))
665 (native-inputs
666 (list go-github-com-onsi-ginkgo-v2
667 go-github-com-davecgh-go-spew
668 go-github-com-onsi-gomega
669 go-github-com-spf13-cobra
670 go-github-com-spf13-pflag
671 go-github-com-stretchr-testify))
672 (propagated-inputs
673 (list go-github-com-checkpoint-restore-checkpointctl
674 go-github-com-checkpoint-restore-go-criu-v8
675 go-github-com-containerd-platforms
676 go-github-com-containers-ocicrypt
677 go-github-com-coreos-go-systemd-v22
678 go-github-com-cyphar-filepath-securejoin-0.4.1
679 go-github-com-davecgh-go-spew
680 go-github-com-d6o-gotree-v3 ;go-github-com-disiqueira-gotree-v3
681 go-github-com-docker-distribution
682 go-github-com-docker-go-units
683 go-github-com-fsnotify-fsnotify
684 go-github-com-godbus-dbus-v5
685 go-github-com-hashicorp-go-multierror
686 go-github-com-jinzhu-copier
687 go-github-com-json-iterator-go
688 go-github-com-moby-sys-capability
689 go-github-com-moby-sys-devices
690 go-github-com-opencontainers-cgroups
691 go-github-com-opencontainers-go-digest
692 go-github-com-opencontainers-image-spec
693 go-github-com-opencontainers-runtime-spec
694 go-github-com-opencontainers-runtime-tools
695 go-github-com-opencontainers-selinux
696 go-github-com-pkg-sftp
697 go-github-com-pmezard-go-difflib
698 go-github-com-seccomp-libseccomp-golang
699 go-github-com-sirupsen-logrus
700 go-github-com-skeema-knownhosts
701 go-github-com-vishvananda-netlink
702 go-go-etcd-io-bbolt
703 go-go-podman-io-image-v5
704 go-go-podman-io-storage
705 go-golang-org-x-crypto
706 go-golang-org-x-sync
707 go-golang-org-x-sys
708 go-golang-org-x-term
709 go-sigs-k8s-io-yaml
710 go-tags-cncf-io-container-device-interface))
711 (home-page "https://go.podman.io")
712 (synopsis "Go code and configuration used across containers projects")
713 (description
714 "This package provides shared common files and common Go code to manage
715those files in github.com/containers repos.")
716 (license license:asl2.0)))
717
718(define-public go-go-podman-io-image-v5
719 (package
720 (name "go-go-podman-io-image-v5")
721 (version "5.39.2")
722 (source
723 (origin
724 (method git-fetch)
725 (uri (git-reference
726 (url "https://github.com/podman-container-tools/container-libs")
727 (commit (go-version->git-ref version #:subdir "image"))))
728 (file-name (git-file-name name version))
729 (sha256
730 (base32 "17qjzgc3h89sa0y8qkviz5gry1kvkkm3j79yhn78c7gbmqcx5v0j"))
731 (modules '((guix build utils)
732 (ice-9 ftw)
733 (srfi srfi-26)))
734 (snippet
735 #~(begin
736 (define (delete-all-but directory . preserve)
737 (define (directory? x)
738 (and=> (stat x #f)
739 (compose (cut eq? 'directory <>) stat:type)))
740 (with-directory-excursion directory
741 (let* ((pred
742 (negate (cut member <> (append '("." "..") preserve))))
743 (items (scandir "." pred)))
744 (for-each (lambda (item)
745 (if (directory? item)
746 (delete-file-recursively item)
747 (delete-file item)))
748 items))))
749 (delete-all-but "." "image")
750 ;; This is a workaround to provide a correct import-path.
751 (rename-file "image" "tmp")
752 (mkdir-p "image/v5")
753 (copy-recursively "tmp" "image/v5")
754 (delete-file-recursively "tmp")))))
755 (build-system go-build-system)
756 (arguments
757 (list
758 #:skip-build? #t
759 #:import-path "go.podman.io/image/v5"
760 #:unpack-path "go.podman.io"
761 #:embed-files
762 #~(list "^VERSION$"
763 ;; For go-github-com-santhosh-tekuri-jsonschema-v6:
764 "applicator"
765 "content"
766 "core"
767 "format"
768 "format-annotation"
769 "format-assertion"
770 "meta-data"
771 "schema"
772 "unevaluated"
773 "validation")
774 #:test-flags
775 #~(list "-skip" (string-join
776 ;; Tests try to access local directories: /usr/share,
777 ;; /var/tmp; remote source https://quay.io/v2/,
778 ;; https://registry.suse.com/auth.
779 (list "TestComputeBlobInfo"
780 "TestCreateBigFileTemp"
781 "TestGPGSigningMechanismSign"
782 "TestMkDirBigFileTemp"
783 "TestReferenceNewImage"
784 "TestReferenceNewImageSource"
785 "TestReferencePolicyConfigurationNamespaces"
786 "TestSetCredentialsInteroperability"
787 "TestSetupCertificates"
788 "TestSign"
789 "TestSignDockerManifest"
790 "TestSignDockerManifestWithPassphrase"
791 "TestSimpleSignerSignImageManifest"
792 "TestSourcePrepareLayerData")
793 "|"))
794 #:phases
795 #~(modify-phases %standard-phases
796 (add-before 'check 'set-HOME
797 (lambda _
798 (setenv "HOME" "/tmp"))))))
799 (native-inputs
800 (list btrfs-progs
801 eudev
802 gnupg
803 go-github-com-stretchr-testify
804 gpgme
805 libassuan))
806 (propagated-inputs
807 (list go-dario-cat-mergo
808 go-github-com-burntsushi-toml
809 go-github-com-containers-libtrust
810 go-github-com-containers-ocicrypt
811 go-github-com-cyberphone-json-canonicalization
812 go-github-com-distribution-reference
813 go-github-com-docker-cli
814 go-github-com-docker-distribution
815 go-github-com-docker-docker
816 go-github-com-docker-docker-credential-helpers
817 go-github-com-docker-go-connections
818 go-github-com-hashicorp-go-cleanhttp
819 go-github-com-hashicorp-go-retryablehttp
820 go-github-com-klauspost-compress
821 go-github-com-klauspost-pgzip
822 go-github-com-manifoldco-promptui
823 go-github-com-mattn-go-sqlite3
824 go-github-com-opencontainers-go-digest
825 go-github-com-opencontainers-image-spec
826 go-github-com-proglottis-gpgme
827 go-github-com-santhosh-tekuri-jsonschema-v6
828 go-github-com-secure-systems-lab-go-securesystemslib
829 go-github-com-sigstore-fulcio
830 go-github-com-sigstore-sigstore
831 go-github-com-sirupsen-logrus
832 go-github-com-sylabs-sif-v2
833 go-github-com-ulikunitz-xz
834 go-github-com-vbauerster-mpb-v8
835 go-go-etcd-io-bbolt
836 go-go-podman-io-storage
837 go-golang-org-x-crypto
838 go-golang-org-x-oauth2
839 go-golang-org-x-sync
840 go-golang-org-x-term
841 go-gopkg-in-yaml-v3))
842 (home-page "https://go.podman.io")
843 (synopsis "Go library to work in various way with containers' images")
844 (description
845 "@code{image} is a set of Go libraries aimed at working in various way
846with containers' images and container image registries. The
847@code{containers/image} library allows application to pull and push images
848from container image registries, like the docker.io and quay.io registries. It
849also implements \"simple image signing\". It's a successor of
850@url{https://github.com/containers/image} project.")
851 (license license:asl2.0)))
852
853(define-public go-go-podman-io-storage
854 (package
855 (name "go-go-podman-io-storage")
856 (version "1.62.0")
857 (source
858 (origin
859 (method git-fetch)
860 (uri (git-reference
861 (url "https://github.com/podman-container-tools/container-libs")
862 (commit (go-version->git-ref version #:subdir "storage"))))
863 (file-name (git-file-name name version))
864 (sha256
865 (base32 "0ywj80wkpyq2yhizsdlfh0n2fxip75042rsk7jm4vyp98bb18rb6"))
866 (modules '((guix build utils)
867 (ice-9 ftw)
868 (srfi srfi-26)))
869 (snippet
870 #~(begin
871 (define (delete-all-but directory . preserve)
872 (define (directory? x)
873 (and=> (stat x #f)
874 (compose (cut eq? 'directory <>) stat:type)))
875 (with-directory-excursion directory
876 (let* ((pred
877 (negate (cut member <> (append '("." "..") preserve))))
878 (items (scandir "." pred)))
879 (for-each (lambda (item)
880 (if (directory? item)
881 (delete-file-recursively item)
882 (delete-file item)))
883 items))))
884 (delete-all-but "." "storage")))))
885 (build-system go-build-system)
886 (arguments
887 (list
888 #:import-path "go.podman.io/storage"
889 #:unpack-path "go.podman.io"
890 #:test-flags
891 #~(list "-skip" (string-join
892 ;; Root access is required.
893 (list "TestAttachLoopbackDeviceRace"
894 "TestChangesWithChangesGH13590"
895 "TestChroot.*"
896 "TestCopyDir"
897 "TestCopyWithTarInexistentDestWillCreateIt"
898 "TestEnsureRemoveAllWithMount"
899 "TestLookupAdditionalLayerDecodeError"
900 "TestLookupAdditionalLayerSuccess"
901 "TestMkdir.*"
902 "TestReplaceFileTarWrapper"
903 "TestStoreDelete"
904 "TestStoreMultiList"
905 "TestSupportsShifting"
906 "TestTarUntarWithXattr"
907 "TestTarWithBlockCharFifo"
908 "TestTarWithMaliciousSymlinks"
909 "TestUnshareOOMScoreAdj"
910 "TestUntarHardlinkToSymlink"
911 "TestUntarPath"
912 "TestUntarWithMaliciousSymlinks"
913 "TestVfs.*")
914 "|"))))
915 (native-inputs
916 (list go-github-com-stretchr-testify))
917 (inputs
918 (list btrfs-progs))
919 (propagated-inputs
920 (list go-github-com-burntsushi-toml
921 go-github-com-containerd-stargz-snapshotter-estargz
922 go-github-com-cyphar-filepath-securejoin-0.4.1
923 go-github-com-docker-go-units
924 go-github-com-google-go-intervals
925 go-github-com-json-iterator-go
926 go-github-com-klauspost-compress
927 go-github-com-klauspost-pgzip
928 go-github-com-mattn-go-shellwords
929 go-github-com-mistifyio-go-zfs-v3
930 go-github-com-moby-sys-capability
931 go-github-com-moby-sys-mountinfo
932 go-github-com-moby-sys-user
933 go-github-com-opencontainers-go-digest
934 go-github-com-opencontainers-runtime-spec
935 go-github-com-opencontainers-selinux
936 go-github-com-sirupsen-logrus
937 go-github-com-tchap-go-patricia-v2
938 go-github-com-ulikunitz-xz
939 go-github-com-vbatts-tar-split
940 go-golang-org-x-sync
941 go-golang-org-x-sys
942 go-gotest-tools-v3))
943 (home-page "https://go.podman.io")
944 (synopsis "Manage layer/image/container storage")
945 (description
946 "@code{storage} is a Go library which aims to provide methods for storing
947filesystem layers, container images, and containers.")
948 (license license:asl2.0)))
949
950;;;
951;;; Executables:
952;;;
953
954(define-public checkpointctl
955 (package/inherit go-github-com-checkpoint-restore-checkpointctl
956 (name "checkpointctl")
957 (arguments
958 (substitute-keyword-arguments
959 (package-arguments go-github-com-checkpoint-restore-checkpointctl)
960 ((#:build-flags _) #~(list (string-append "-X main.version="
961 #$version)))
962 ((#:install-source? _ #t) #f)
963 ((#:skip-build? _ #t) #f)
964 ((#:tests? _ #t) #f)))
965 (native-inputs
966 (append
967 (package-native-inputs go-github-com-checkpoint-restore-checkpointctl)
968 (package-propagated-inputs go-github-com-checkpoint-restore-checkpointctl)))
969 (propagated-inputs '())
970 (inputs '())
971 (description
972 "This package provides a tool to read and manipulate checkpoint archives
973as created by Podman, CRI-O and containerd.")))
974
975(define-public crun
976 (package
977 (name "crun")
978 (version "1.29.1")
979 (source
980 (origin
981 (method git-fetch)
982 (uri (git-reference
983 (url "https://github.com/containers/crun")
984 (commit version)
985 (recursive? #t)))
986 (sha256
987 (base32
988 "02dlw47mydpwridbaqgdwm0l6wl54qngqbg9526ib6hcj347mj96"))
989 (file-name (git-file-name name version))))
990 (build-system gnu-build-system)
991 (arguments
992 (list
993 #:configure-flags #~(list "--disable-systemd")
994 #:tests? #f ; XXX: needs /sys/fs/cgroup mounted
995 #:phases
996 #~(modify-phases %standard-phases
997 (add-after 'unpack 'git-version-h
998 (lambda _
999 (call-with-output-file "git-version.h"
1000 (lambda (port)
1001 (format
1002 port
1003 "#ifndef GIT_VERSION\n# define GIT_VERSION ~s\n#endif"
1004 #$version)))))
1005 (add-after 'unpack 'fix-tests
1006 (lambda _
1007 (substitute* (find-files "tests" "\\.(c|py)")
1008 (("/bin/true") (which "true"))
1009 (("/bin/false") (which "false"))
1010 ;; relies on sd_notify which requires systemd?
1011 (("\"sd-notify\" : test_sd_notify,") "")
1012 (("\"sd-notify-file\" : test_sd_notify_file,") "")))))))
1013 (inputs
1014 (list json-c
1015 libcap
1016 libseccomp
1017 yajl))
1018 (native-inputs
1019 (list automake
1020 autoconf
1021 git-minimal/pinned
1022 libtool
1023 pkg-config
1024 python-minimal-wrapper))
1025 (home-page "https://github.com/containers/crun")
1026 (synopsis "Open Container Initiative (OCI) Container runtime")
1027 (description
1028 "crun is a fast and low-memory footprint Open Container Initiative (OCI)
1029Container Runtime fully written in C.")
1030 (license license:gpl2+)))
1031
1032(define-public conmon
1033 (package
1034 (name "conmon")
1035 (version "2.2.1")
1036 (source
1037 (origin
1038 (method git-fetch)
1039 (uri (git-reference
1040 (url "https://github.com/containers/conmon")
1041 (commit (string-append "v" version))))
1042 (sha256
1043 (base32 "0n9l6030ibhk7pmsq85rarcf9b0kzglxibd1xnb6vzmkz3ywg1il"))
1044 (file-name (git-file-name name version))))
1045 (build-system gnu-build-system)
1046 (arguments
1047 (list #:make-flags
1048 #~(list (string-append "CC=" #$(cc-for-target))
1049 (string-append "PREFIX=" #$output))
1050 #:test-target "test"
1051 #:phases
1052 #~(modify-phases %standard-phases
1053 (delete 'configure)
1054 (add-before 'check 'prepare-tests
1055 (lambda* (#:key inputs #:allow-other-keys)
1056 (setenv "RUNTIME_BINARY"
1057 (search-input-file inputs "sbin/runc"))
1058
1059 ;; We need to skip all tests requiring journald.
1060 (for-each
1061 (lambda (test file)
1062 (substitute* file
1063 (((string-append "@test \"" test "\" \\{\n$") all)
1064 (string-append all "skip 'no journald in Guix';"))))
1065 '("log driver as journald should pass"
1066 "log driver as journald with short cid should fail"
1067 "multiple log drivers should pass"
1068 "log management: should work with multiple log drivers")
1069 '("test/01-basic.bats"
1070 "test/01-basic.bats"
1071 "test/01-basic.bats"
1072 "test/06-log-management.bats")))))))
1073 (inputs
1074 (list crun
1075 glib
1076 libseccomp))
1077 (native-inputs
1078 (list bats
1079 git
1080 go-md2man
1081 pkg-config
1082 socat
1083 runc))
1084 (home-page "https://github.com/containers/conmon")
1085 (synopsis "Monitoring tool for Open Container Initiative (OCI) runtime")
1086 (description
1087 "Conmon is a monitoring program and communication tool between a container
1088manager (like Podman or CRI-O) and an Open Container Initiative (OCI)
1089runtime (like runc or crun) for a single container.")
1090 (license license:asl2.0)))
1091
1092(define-public distrobox
1093 (package
1094 (name "distrobox")
1095 (version "1.8.2.4")
1096 (source
1097 (origin
1098 (method git-fetch)
1099 (uri (git-reference
1100 (url "https://github.com/89luca89/distrobox")
1101 (commit version)))
1102 (sha256
1103 (base32 "07kqgr5diwvkks3fn1r0nnpfqq6gngqyx4x7lxs06ri6g0a4knvf"))
1104 (file-name (git-file-name name version))))
1105 (build-system copy-build-system)
1106 (arguments
1107 (list #:phases
1108 #~(modify-phases %standard-phases
1109 ;; This script creates desktop files but when the store path for
1110 ;; distrobox changes it leaves the stale path on the desktop
1111 ;; file, so remove the path to use the profile's current
1112 ;; distrobox.
1113 (add-after 'unpack 'patch-distrobox-generate-entry
1114 (lambda _
1115 (substitute* "distrobox-generate-entry"
1116 (("\\$\\{distrobox_path\\}/distrobox") "distrobox"))))
1117 ;; Use WRAP-SCRIPT to wrap all of the scripts of distrobox,
1118 ;; excluding the host side ones.
1119 (add-after 'install 'wrap-scripts
1120 (lambda _
1121 (let ((path (search-path-as-list
1122 (list "bin")
1123 (list #$(this-package-input "podman")
1124 #$(this-package-input "wget")))))
1125 (for-each (lambda (script)
1126 (wrap-script
1127 (string-append #$output "/bin/distrobox-"
1128 script)
1129 `("PATH" ":" prefix ,path)))
1130 '("assemble"
1131 "create"
1132 "enter"
1133 "ephemeral"
1134 "generate-entry"
1135 "list"
1136 "rm"
1137 "stop"
1138 "upgrade")))))
1139 ;; These scripts are used in the container side and the
1140 ;; /gnu/store path is not shared with the containers.
1141 (add-after 'patch-shebangs 'unpatch-shebangs
1142 (lambda _
1143 (for-each (lambda (script)
1144 (substitute*
1145 (string-append #$output "/bin/distrobox-"
1146 script)
1147 (("#!.*/bin/sh") "#!/bin/sh\n")))
1148 '("export" "host-exec" "init"))))
1149 (replace 'install
1150 (lambda _
1151 (invoke "./install" "--prefix" #$output))))))
1152 (inputs
1153 (list guile-3.0 ; for wrap-script
1154 podman
1155 wget))
1156 (home-page "https://distrobox.it")
1157 (synopsis "Create and start containers highly integrated with the hosts")
1158 (description
1159 "Distrobox is a fancy wrapper around Podman or Docker to create and start
1160containers highly integrated with the hosts.")
1161 (license license:gpl3)))
1162
1163(define-public dive
1164 (package
1165 (name "dive")
1166 (version "0.12.0") ;newer version needs docker/docker@28+
1167 (source
1168 (origin
1169 (method git-fetch)
1170 (uri (git-reference
1171 (url "https://github.com/wagoodman/dive")
1172 (commit (string-append "v" version))))
1173 (file-name (git-file-name name version))
1174 (sha256
1175 (base32 "0p60bq0lc820p7x3nq8kxc8cx646c0z7zxqc7vav77zc4qbm3r8a"))))
1176 (build-system go-build-system)
1177 (arguments
1178 (list
1179 #:install-source? #f
1180 #:build-flags
1181 #~(list (string-append "-ldflags=-X main.version=" #$version))
1182 #:import-path "github.com/wagoodman/dive"
1183 #:test-flags #~(list "-vet=off")))
1184 (native-inputs
1185 (list go-github-com-awesome-gocui-gocui
1186 go-github-com-awesome-gocui-keybinding
1187 go-github-com-cespare-xxhash
1188 go-github-com-docker-cli
1189 go-github-com-docker-docker
1190 go-github-com-dustin-go-humanize
1191 go-github-com-fatih-color
1192 go-github-com-google-uuid
1193 go-github-com-logrusorgru-aurora
1194 go-github-com-lunixbochs-vtclean
1195 go-github-com-mitchellh-go-homedir
1196 go-github-com-phayes-permbits
1197 go-github-com-sergi-go-diff
1198 go-github-com-sirupsen-logrus
1199 go-github-com-spf13-afero
1200 go-github-com-spf13-cobra
1201 go-github-com-spf13-viper
1202 go-golang-org-x-net))
1203 (home-page "https://github.com/wagoodman/dive")
1204 (synopsis "Tool for exploring each layer in a docker image")
1205 (description
1206 "This package provides a tool for exploring a Docker image, layer
1207contents, and discovering ways to shrink the size of Docker/OCI image.")
1208 (license license:expat)))
1209
1210(define-public guix-compose
1211 (package
1212 (name "guix-compose")
1213 (version "0.2.0")
1214 (source
1215 (origin
1216 (method git-fetch)
1217 (uri (git-reference
1218 (url "https://codeberg.org/fishinthecalculator/guix-compose")
1219 (commit version)))
1220 (file-name (git-file-name name version))
1221 (sha256
1222 (base32 "1dy48qkz3ifxagijpvwg7rmq7hz3pikhdcfral6djyc9ppmz8mbm"))))
1223 (build-system guile-build-system)
1224 (arguments
1225 (list
1226 #:source-directory "src"
1227 #:phases
1228 #~(modify-phases %standard-phases
1229 (add-after 'unpack 'set-load-paths-in-entry-point
1230 (lambda _
1231 (define load-path
1232 (cons (string-append #$output "/share/guile/site/3.0")
1233 (parse-path (getenv "GUILE_LOAD_PATH"))))
1234 (define load-compiled-path
1235 (cons (string-append #$output "/lib/guile/3.0/site-ccache")
1236 (parse-path (getenv "GUILE_LOAD_COMPILED_PATH"))))
1237 (define search-paths-header
1238 `(begin
1239 (set! %load-path
1240 (append (list ,@load-path) %load-path))
1241 (set! %load-compiled-path
1242 (append (list ,@load-compiled-path)
1243 %load-compiled-path))))
1244
1245 (substitute* "src/guix/extensions/compose.scm"
1246 ((";;@load-paths@")
1247 (with-output-to-string
1248 (lambda () (write search-paths-header)))))))
1249 (add-after 'build 'add-extension-to-search-path
1250 (lambda _
1251 (with-directory-excursion #$output
1252 (mkdir-p "share/guix/extensions")
1253 (symlink
1254 (string-append
1255 #$output "/share/guile/site/3.0/guix/extensions/compose.scm")
1256 "share/guix/extensions/compose.scm"))))
1257 (add-after 'add-extension-to-search-path 'check
1258 (lambda* (#:key tests? #:allow-other-keys)
1259 (when tests?
1260 (invoke
1261 "guile" "-L" "./modules" "-s" "tests/test-compose.scm")))))))
1262 (native-inputs (list guile-3.0))
1263 ;; Avoid setting propagated so that we use the user’s profile.
1264 (inputs (list guix guile-dotenv guile-yamlpp))
1265 (synopsis "Guix' docker compose compatibility layer")
1266 (description "A toolkit to run, read and write docker-compose.yml files with
1267Guix machinery.")
1268 (home-page "https://codeberg.org/fishinthecalculator/guix-compose")
1269 (license license:gpl3+)))
1270
1271(define-public runc
1272 ;; TODO: Inheerit form go-github-com-opencontainers-runc when it's moved
1273 ;; here.
1274 (package
1275 (name "runc")
1276 (version "1.3.0")
1277 (source
1278 (origin
1279 (method git-fetch)
1280 (uri (git-reference
1281 (url "https://github.com/opencontainers/runc")
1282 (commit (string-append "v" version))))
1283 (file-name (git-file-name name version))
1284 (sha256
1285 (base32 "0midvxwmj4fvhy5mqv616bhlx39j0gd6y890adx7dnz5in506ym1"))
1286 (snippet
1287 #~(begin
1288 (use-modules (guix build utils))
1289 (delete-file-recursively "vendor")))))
1290 (build-system go-build-system)
1291 (arguments
1292 (list
1293 ;; XXX: 20/139 tests fail due to missing /var, cgroups and apparmor in
1294 ;; the build environment.
1295 #:tests? #f
1296 #:install-source? #f
1297 #:import-path "github.com/opencontainers/runc"
1298 #:phases
1299 #~(modify-phases %standard-phases
1300 (add-after 'unpack 'patch-source
1301 (lambda* (#:key import-path #:allow-other-keys)
1302 (substitute* (string-append "src/" import-path "/Makefile")
1303 (("/bin/bash") (which "bash")))))
1304 (replace 'build
1305 (lambda* (#:key import-path #:allow-other-keys)
1306 (with-directory-excursion (string-append "src/" import-path)
1307 (invoke "make" "all" "man"))))
1308 (replace 'install
1309 (lambda* (#:key import-path outputs #:allow-other-keys)
1310 (with-directory-excursion (string-append "src/" import-path)
1311 (invoke "make" "install" "install-bash" "install-man"
1312 (string-append "PREFIX=" #$output))))))))
1313 (native-inputs
1314 (list go-github-com-checkpoint-restore-go-criu-v6
1315 go-github-com-containerd-console
1316 go-github-com-coreos-go-systemd-v22
1317 go-github-com-cyphar-filepath-securejoin-0.4.1
1318 go-github-com-docker-go-units
1319 go-github-com-godbus-dbus-v5
1320 go-github-com-moby-sys-capability
1321 go-github-com-moby-sys-mountinfo
1322 go-github-com-moby-sys-user
1323 go-github-com-moby-sys-userns
1324 go-github-com-mrunalp-fileutils
1325 go-github-com-opencontainers-cgroups-0.0.1
1326 go-github-com-opencontainers-runtime-spec-1.2.1
1327 go-github-com-opencontainers-selinux
1328 go-github-com-seccomp-libseccomp-golang
1329 go-github-com-sirupsen-logrus
1330 go-github-com-urfave-cli
1331 go-github-com-vishvananda-netlink
1332 go-golang-org-x-net
1333 go-golang-org-x-sys
1334 go-google-golang-org-protobuf
1335 go-md2man
1336 pkg-config))
1337 (inputs
1338 (list libseccomp))
1339 (synopsis "Open container initiative runtime")
1340 (home-page "https://opencontainers.org/")
1341 (description
1342 "@command{runc} is a command line client for running applications
1343packaged according to the
1344@uref{https://github.com/opencontainers/runtime-spec/blob/master/spec.md, Open
1345Container Initiative (OCI) format} and is a compliant implementation of the
1346Open Container Initiative specification.")
1347 (license license:asl2.0)))
1348
1349(define-public libslirp
1350 (package
1351 (name "libslirp")
1352 (version "4.9.4")
1353 (source
1354 (origin
1355 (method git-fetch)
1356 (uri (git-reference
1357 (url "https://gitlab.freedesktop.org/slirp/libslirp")
1358 (commit (string-append "v" version))))
1359 (sha256
1360 (base32 "19f1p37b4ybqbgk817g3sqhdvr1gl3d1063hj7zg1jqa301s2afw"))
1361 (file-name (git-file-name name version))))
1362 (build-system meson-build-system)
1363 (propagated-inputs
1364 ;; In Requires of slirp.pc.
1365 (list glib))
1366 (native-inputs
1367 (list pkg-config))
1368 (home-page "https://gitlab.freedesktop.org/slirp/libslirp")
1369 (synopsis "User-mode networking library")
1370 (description
1371 "libslirp is a user-mode networking library used by virtual machines,
1372containers or various tools.")
1373 (license license:bsd-3)))
1374
1375(define-public skopeo
1376 (package
1377 (name "skopeo")
1378 (version "1.24.0")
1379 (source (origin
1380 (method git-fetch)
1381 (uri (git-reference
1382 (url "https://github.com/podman-container-tools/skopeo")
1383 (commit (string-append "v" version))))
1384 (file-name (git-file-name name version))
1385 (sha256
1386 (base32
1387 "05a2xp3ss59nld8i4zf85rqrqlsid1ipj5484vp23a5sdiybl0j4"))))
1388 (build-system gnu-build-system)
1389 (native-inputs
1390 (list go
1391 go-md2man
1392 pkg-config))
1393 (inputs
1394 (list bash-minimal
1395 btrfs-progs
1396 eudev
1397 libassuan
1398 libselinux
1399 libostree
1400 lvm2
1401 glib
1402 gpgme))
1403 (arguments
1404 (list
1405 #:make-flags
1406 #~(list (string-append "CC=" #$(cc-for-target))
1407 "PREFIX="
1408 (string-append "DESTDIR=" #$output)
1409 "GOGCFLAGS=-trimpath"
1410 (string-append "GOMD2MAN=" #$go-md2man "/bin/go-md2man"))
1411 #:tests? #f ; The tests require Docker
1412 #:test-target "test-unit"
1413 #:imported-modules
1414 (source-module-closure `(,@%default-gnu-imported-modules
1415 (guix build go-build-system)))
1416 #:phases
1417 #~(modify-phases %standard-phases
1418 (delete 'configure)
1419 (add-after 'unpack 'set-env
1420 (lambda _
1421 ;; When running go, things fail because HOME=/homeless-shelter.
1422 (setenv "HOME" "/tmp")
1423 ;; Required for detecting btrfs in hack/btrfs* due to bug in GNU
1424 ;; Make <4.4 causing CC not to be propagated into $(shell ...)
1425 ;; calls. Can be removed once we update to >4.3.
1426 (setenv "CC" #$(cc-for-target))))
1427 (add-after 'install 'wrap-skopeo
1428 (lambda _
1429 (wrap-program (string-append #$output "/bin/skopeo")
1430 `("PATH" suffix
1431 ;; We need at least newuidmap, newgidmap and mount.
1432 ("/run/privileged/bin"))))))))
1433 (home-page "https://github.com/podman-container-tools/skopeo")
1434 (synopsis "Interact with container images and container image registries")
1435 (description
1436 "@command{skopeo} is a command line utility providing various operations
1437with container images and container image registries. It can:
1438@enumerate
1439
1440@item Copy container images between various containers image stores,
1441converting them as necessary.
1442
1443@item Convert a Docker schema 2 or schema 1 container image to an OCI image.
1444
1445@item Inspect a repository on a container registry without needlessly pulling
1446the image.
1447
1448@item Sign and verify container images.
1449
1450@item Delete container images from a remote container registry.
1451
1452@end enumerate")
1453 (license license:asl2.0)))
1454
1455(define-public slirp4netns
1456 (package
1457 (name "slirp4netns")
1458 (version "1.3.3")
1459 (source
1460 (origin
1461 (method git-fetch)
1462 (uri (git-reference
1463 (url "https://github.com/rootless-containers/slirp4netns")
1464 (commit (string-append "v" version))))
1465 (sha256
1466 (base32 "165z1ccsb8w901965rlzcrbln17l1jdg9k7vsiamlx0q06v24b96"))
1467 (file-name (git-file-name name version))))
1468 (build-system gnu-build-system)
1469 (arguments
1470 '(#:tests? #f ; XXX: open("/dev/net/tun"): No such file or directory
1471 #:phases (modify-phases %standard-phases
1472 (add-after 'unpack 'fix-hardcoded-paths
1473 (lambda _
1474 (substitute* (find-files "tests" "\\.sh")
1475 (("ping") "/run/privileged/bin/ping")))))))
1476 (inputs
1477 (list glib
1478 libcap
1479 libseccomp
1480 libslirp))
1481 (native-inputs
1482 (list automake
1483 autoconf
1484 iproute ; iproute, jq, nmap (ncat) and util-linux are for tests
1485 jq
1486 nmap
1487 pkg-config
1488 util-linux))
1489 (home-page "https://github.com/rootless-containers/slirp4netns")
1490 (synopsis "User-mode networking for unprivileged network namespaces")
1491 (description
1492 "slirp4netns provides user-mode networking (\"slirp\") for unprivileged
1493network namespaces.")
1494 (license license:gpl2+)))
1495
1496(define-public passt
1497 (package
1498 (name "passt")
1499 (version "2024_12_11.09478d5")
1500 (source
1501 (origin
1502 (method url-fetch)
1503 (uri (string-append "https://passt.top/passt/snapshot/passt-" version
1504 ".tar.gz"))
1505 (sha256
1506 (base32 "1arkir4784chw9x37174rc12cp353501m43p6iwvk5mqrlq02k90"))))
1507 (build-system gnu-build-system)
1508 (arguments
1509 (list
1510 #:make-flags
1511 #~(list (string-append "CC=" #$(cc-for-target))
1512 "RLIMIT_STACK_VAL=1024" ; ¯\_ (ツ)_/¯
1513 (string-append "VERSION=" #$version)
1514 (string-append "prefix=" #$output))
1515 #:tests? #f
1516 #:phases
1517 #~(modify-phases %standard-phases
1518 (delete 'configure))))
1519 (home-page "https://passt.top")
1520 (synopsis "Plug A Simple Socket Transport")
1521 (description
1522 "passt implements a thin layer between guest and host, that only
1523implements what's strictly needed to pretend processes are running locally.
1524The TCP adaptation doesn't keep per-connection packet buffers, and reflects
1525observed sending windows and acknowledgements between the two sides. This TCP
1526adaptation is needed as passt runs without the CAP_NET_RAW capability: it
1527can't create raw IP sockets on the pod, and therefore needs to map packets at
1528Layer-2 to Layer-4 sockets offered by the host kernel.
1529
1530Also provides pasta, which similarly to slirp4netns, provides networking to
1531containers by creating a tap interface available to processes in the
1532namespace, and mapping network traffic outside the namespace using native
1533Layer-4 sockets.")
1534 (license (list license:gpl2+ license:bsd-3))))
1535
1536(define-public cni-plugins
1537 (package
1538 (name "cni-plugins")
1539 (version "1.9.1")
1540 (source
1541 (origin
1542 (method git-fetch)
1543 (uri (git-reference
1544 (url "https://github.com/containernetworking/plugins")
1545 (commit (string-append "v" version))))
1546 (file-name (git-file-name name version))
1547 (sha256
1548 (base32 "12z6w2jk6xgfiwdxys7skpkxldz1cgaa7scgfcr90lsghay59s6w"))
1549 (snippet
1550 #~(begin (use-modules (guix build utils))
1551 (delete-file-recursively "vendor")))))
1552 (build-system go-build-system)
1553 (arguments
1554 (list
1555 #:install-source? #f
1556 ;; XXX: Tests require root access, see test_linux.sh.
1557 #:tests? #f
1558 #:import-path "github.com/containernetworking/plugins/plugins/..."
1559 #:unpack-path "github.com/containernetworking/plugins"))
1560 (native-inputs
1561 (list go-github-com-alexflint-go-filemutex
1562 go-github-com-buger-jsonparser
1563 go-github-com-containernetworking-cni
1564 go-github-com-coreos-go-iptables
1565 go-github-com-coreos-go-systemd-v22
1566 go-github-com-godbus-dbus-v5
1567 go-github-com-insomniacslk-dhcp
1568 go-github-com-mattn-go-shellwords
1569 ;; go-github-com-microsoft-hcsshim
1570 go-github-com-networkplumbing-go-nft
1571 go-github-com-onsi-ginkgo-v2
1572 go-github-com-onsi-gomega
1573 go-github-com-opencontainers-selinux
1574 go-github-com-pkg-errors
1575 go-github-com-safchain-ethtool
1576 go-github-com-vishvananda-netlink
1577 go-github-com-vishvananda-netns
1578 go-golang-org-x-sys
1579 go-sigs-k8s-io-knftables
1580 util-linux))
1581 (home-page "https://github.com/containernetworking/plugins")
1582 (synopsis "Container Network Interface (CNI) network plugins")
1583 (description
1584 "This package provides Container Network Interface (CNI) plugins to
1585configure network interfaces in Linux containers.")
1586 (license license:asl2.0)))
1587
1588(define-public gvisor-tap-vsock
1589 (package/inherit go-github-com-containers-gvisor-tap-vsock
1590 (name "gvisor-tap-vsock")
1591 (arguments
1592 (substitute-keyword-arguments arguments
1593 ((#:install-source? _ #t) #f)
1594 ((#:skip-build? _ #t) #f)
1595 ((#:tests? _ #t) #f)
1596 ((#:phases _ '%standard-phases)
1597 #~(modify-phases %standard-phases
1598 ;; Build binary outputs are taken from project's Makefile.
1599 (replace 'build
1600 (lambda arguments
1601 (for-each
1602 (lambda (cmd)
1603 (apply (assoc-ref %standard-phases 'build)
1604 `(,@arguments #:import-path ,cmd)))
1605 (list "github.com/containers/gvisor-tap-vsock/cmd/gvproxy"
1606 "github.com/containers/gvisor-tap-vsock/cmd/qemu-wrapper"
1607 "github.com/containers/gvisor-tap-vsock/cmd/vm"))))
1608 (add-after 'install 'fix-bin-name
1609 (lambda _
1610 (rename-file (string-append #$output "/bin/vm")
1611 (string-append #$output "/bin/gvforwarder"))))))))
1612 (native-inputs
1613 (package-propagated-inputs go-github-com-containers-gvisor-tap-vsock))
1614 (propagated-inputs '())
1615 (inputs '())))
1616
1617(define-public catatonit
1618 (package
1619 (name "catatonit")
1620 (version "0.2.1")
1621 (source
1622 (origin
1623 (method git-fetch)
1624 (uri (git-reference
1625 (url "https://github.com/openSUSE/catatonit/")
1626 (commit (string-append "v" version))))
1627 (file-name (git-file-name name version))
1628 (sha256
1629 (base32 "14vh0xpg6lzmh7r52vi9w1qfc14r7cfhfrbca7q5fg62d3hx7kxi"))))
1630 (build-system gnu-build-system)
1631 (native-inputs
1632 (list autoconf automake libtool))
1633 (home-page "https://github.com/openSUSE/catatonit")
1634 (synopsis "Container init")
1635 (description
1636 "Catatonit is a simple container init tool developed as a rewrite of
1637@url{https://github.com/cyphar/initrs, initrs} in C due to the need for static
1638compilation of Rust binaries with @code{musl}. Inspired by other container
1639inits like @url{https://github.com/krallin/tini, tini} and
1640@url{https://github.com/Yelp/dumb-init, dumb-init}, catatonit focuses on
1641correct signal handling, utilizing @code{signalfd(2)} for improved stability.
1642Its main purpose is to support the key usage by @code{docker-init}:
1643@code{/dev/init} – <your program>, with minimal additional features planned.")
1644 (license license:gpl2+)))
1645
1646(define-public podman
1647 (package
1648 (name "podman")
1649 (version "6.1.0")
1650 (outputs '("out" "docker"))
1651 (properties
1652 `((output-synopsis "docker" "docker alias for podman")))
1653 (source
1654 (origin
1655 (method git-fetch)
1656 (uri (git-reference
1657 (url "https://github.com/podman-container-tools/podman")
1658 (commit (string-append "v" version))))
1659 (sha256
1660 (base32 "1vwm2s3ylsdmp550s45wzfmgnc1ckwap8f5nw7rypv0qqkr82fn2"))
1661 (file-name (git-file-name name version))))
1662 (build-system gnu-build-system)
1663 (arguments
1664 (list
1665 #:make-flags
1666 #~(list (string-append "CC=" #$(cc-for-target))
1667 (string-append "PREFIX=" #$output)
1668 (string-append "HELPER_BINARIES_DIR=" #$output "/_guix")
1669 (string-append "GOMD2MAN=" #$go-md2man "/bin/go-md2man")
1670 (string-append "BUILDFLAGS=-trimpath"))
1671 #:tests? #f ; /sys/fs/cgroup not set up in guix sandbox
1672 #:test-target "test"
1673 #:phases
1674 #~(modify-phases %standard-phases
1675 (delete 'configure)
1676 (add-after 'unpack 'set-env
1677 (lambda _
1678 ;; When running go, things fail because HOME=/homeless-shelter.
1679 (setenv "HOME" "/tmp")))
1680 (replace 'check
1681 (lambda* (#:key tests? #:allow-other-keys)
1682 (when tests?
1683 (invoke "make" "localsystem")
1684 (invoke "make" "remotesystem"))))
1685 (add-after 'unpack 'fix-hardcoded-paths
1686 (lambda _
1687 (substitute* "vendor/go.podman.io/common/pkg/config/config_linux.go"
1688 (("/usr/local/libexec/podman")
1689 (string-append #$output "/libexec/podman"))
1690 (("/usr/local/lib/podman")
1691 (string-append #$output "/bin")))))
1692 (add-after 'install 'symlink-helpers
1693 (lambda _
1694 (mkdir-p (string-append #$output "/_guix"))
1695 (for-each
1696 (lambda (what)
1697 (symlink (string-append (car what) "/bin/" (cdr what))
1698 (string-append #$output "/_guix/" (cdr what))))
1699 ;; Only tools that cannot be discovered via $PATH are
1700 ;; symlinked. Rest is handled in the 'wrap-podman phase.
1701 `((#$aardvark-dns . "aardvark-dns")
1702 ;; Required for podman-machine, which is *not* supported out
1703 ;; of the box. But it cannot be discovered via $PATH, so
1704 ;; there is no other way for the user to install it. It
1705 ;; costs ~10MB, so let's leave it here.
1706 (#$gvisor-tap-vsock . "gvproxy")
1707 (#$netavark . "netavark")))))
1708 (add-after 'install 'wrap-podman
1709 (lambda _
1710 (wrap-program (string-append #$output "/bin/podman")
1711 `("PATH" suffix
1712 (,(string-append #$catatonit "/bin")
1713 ,(string-append #$conmon "/bin")
1714 ,(string-append #$crun "/bin")
1715 ,(string-append #$gcc "/bin") ; cpp
1716 ,(string-append #$iptables "/sbin")
1717 ,(string-append #$nftables "/sbin")
1718 ,(string-append #$passt "/bin")
1719 ,(string-append #$procps "/bin") ; ps
1720 "/run/privileged/bin")))))
1721 (add-after 'install 'install-docker
1722 (lambda _
1723 ;; So it picks podman of the other output.
1724 (substitute* "docker/docker.in"
1725 (("[$][{]BINDIR[}]") (string-append #$output "/bin"))
1726 (("[$][{]ETCDIR[}]") "/etc"))
1727 (invoke "make" "install.docker"
1728 (string-append "PREFIX=" #$output:docker)
1729 (string-append "ETCDIR=" #$output:docker "/etc"))))
1730 (add-after 'install 'install-completions
1731 (lambda _
1732 (invoke "make" "install.completions"
1733 (string-append "PREFIX=" #$output)))))))
1734 (inputs
1735 (list bash-minimal
1736 btrfs-progs
1737 gpgme
1738 libassuan
1739 libseccomp
1740 libselinux))
1741 (native-inputs
1742 (list grep
1743 bats
1744 git-minimal/pinned
1745 go
1746 go-md2man
1747 gettext-minimal ; for envsubst
1748 mandoc
1749 pkg-config
1750 python))
1751 (home-page "https://podman.io")
1752 (synopsis "Manage containers, images, pods, and their volumes")
1753 (description
1754 "Podman (the POD MANager) is a tool for managing containers and images,
1755volumes mounted into those containers, and pods made from groups of
1756containers.
1757
1758Not all commands are working out of the box due to requiring additional
1759binaries to be present in the $PATH.
1760
1761To get @code{podman compose} working, install either @code{podman-compose} or
1762@code{docker-compose} packages.
1763
1764To get @code{podman machine} working, install @code{qemu-minimal}, and
1765@code{openssh} packages.")
1766 (license license:asl2.0)))
1767
1768(define-public podman-compose
1769 (package
1770 (name "podman-compose")
1771 (version "1.6.0")
1772 (source
1773 (origin
1774 (method git-fetch)
1775 (uri (git-reference
1776 (url "https://github.com/containers/podman-compose")
1777 (commit (string-append "v" version))))
1778 (file-name (git-file-name name version))
1779 (sha256
1780 (base32 "0lp4s7j1dwrnl8r9k93kd0396jwy0rkyq545ca88d90nyrjwniff"))))
1781 (build-system pyproject-build-system)
1782 (arguments
1783 (list
1784 ;; Only run tests in `tests/unit`, skipping the ones in
1785 ;; `tests/integration`. The integration tests need an environment with
1786 ;; the ability to manage containers and volumes using the `podman`
1787 ;; command.
1788 ;;
1789 ;; tests: 378 tests
1790 #:test-backend #~'unittest
1791 #:test-flags #~(list "discover" "tests/unit")))
1792 (native-inputs
1793 (list python-parameterized
1794 python-setuptools))
1795 (propagated-inputs
1796 (list python-dotenv
1797 python-pyyaml))
1798 (home-page "https://github.com/containers/podman-compose")
1799 (synopsis "Script to run docker-compose.yml using podman")
1800 (description
1801 "This package provides an implementation of
1802@url{https://compose-spec.io/, Compose Spec} for @code{podman} focused on
1803being rootless and not requiring any daemon to be running.")
1804 (license license:gpl2)))
1805
1806(define-public podman-containers-storage
1807 (package/inherit go-go-podman-io-storage
1808 (name "podman-containers-storage")
1809 (arguments
1810 (substitute-keyword-arguments arguments
1811 ((#:import-path _ "") "go.podman.io/storage/cmd/...")
1812 ((#:install-source? #t #t) #f)
1813 ((#:tests? #t #t) #f)
1814 ((#:phases phases '%standard-phases)
1815 #~(modify-phases #$phases
1816 (add-after 'install 'build-and-install-docs
1817 (lambda* (#:key unpack-path #:allow-other-keys)
1818 (with-directory-excursion (string-append "src/" unpack-path
1819 "/storage")
1820 (setenv "PREFIX" #$output)
1821 (invoke "make" "-C" "docs" "docs" "install"))))))))
1822 (native-inputs
1823 (append
1824 (modify-inputs native-inputs
1825 (append go-md2man))
1826 (package-propagated-inputs go-go-podman-io-storage)))
1827 (propagated-inputs '())
1828 (description
1829 "@code{containers-storage} is a command line tool for manipulating local
1830layer/image/container stores.")))
1831
1832(define-public buildah
1833 (package
1834 (name "buildah")
1835 (version "1.44.1")
1836 (source
1837 (origin
1838 (method git-fetch)
1839 (uri (git-reference
1840 (url "https://github.com/containers/buildah")
1841 (commit (string-append "v" version))))
1842 (sha256
1843 (base32 "0ivy7i0pqzhpsnd38l9favi32vgm0xcsn5bg4cxxqg6yzgw0fshh"))
1844 (file-name (git-file-name name version))))
1845 (build-system gnu-build-system)
1846 (arguments
1847 (list
1848 #:make-flags
1849 #~(list (string-append "CC=" #$(cc-for-target))
1850 (string-append "PREFIX=" #$output)
1851 (string-append "GOMD2MAN=" #$go-md2man "/bin/go-md2man"))
1852 #:tests? #f ; /sys/fs/cgroup not set up in guix sandbox
1853 #:test-target "test-unit"
1854 #:phases
1855 #~(modify-phases %standard-phases
1856 (delete 'configure)
1857 (add-after 'unpack 'set-env
1858 (lambda _
1859 ;; When running go, things fail because HOME=/homeless-shelter.
1860 (setenv "HOME" "/tmp")))
1861 ;; Add -trimpath to build flags to avoid keeping references to go
1862 ;; packages.
1863 (add-after 'set-env 'patch-buildflags
1864 (lambda _
1865 (substitute* "Makefile"
1866 (("BUILDFLAGS :=") "BUILDFLAGS := -trimpath "))))
1867 (replace 'check
1868 (lambda* (#:key tests? #:allow-other-keys)
1869 (when tests?
1870 (invoke "make" "test-unit")
1871 (invoke "make" "test-conformance")
1872 (invoke "make" "test-integration"))))
1873 (add-after 'install 'symlink-helpers
1874 (lambda _
1875 (mkdir-p (string-append #$output "/_guix"))
1876 (for-each
1877 (lambda (what)
1878 (symlink (string-append (car what) "/bin/" (cdr what))
1879 (string-append #$output "/_guix/" (cdr what))))
1880 ;; Only tools that cannot be discovered via $PATH are
1881 ;; symlinked. Rest is handled in the 'wrap-buildah phase.
1882 `((#$aardvark-dns . "aardvark-dns")
1883 (#$netavark . "netavark")))))
1884 (add-after 'install 'wrap-buildah
1885 (lambda _
1886 (wrap-program (string-append #$output "/bin/buildah")
1887 `("CONTAINERS_HELPER_BINARY_DIR" =
1888 (,(string-append #$output "/_guix")))
1889 `("PATH" suffix
1890 (,(string-append #$crun "/bin")
1891 ,(string-append #$gcc "/bin") ; cpp
1892 ,(string-append #$passt "/bin")
1893 "/run/privileged/bin")))))
1894 (add-after 'install 'install-completions
1895 (lambda _
1896 (invoke "make" "install.completions"
1897 (string-append "PREFIX=" #$output)))))))
1898 (inputs (list bash-minimal
1899 btrfs-progs
1900 eudev
1901 glib
1902 gpgme
1903 libassuan
1904 libseccomp
1905 lvm2))
1906 (native-inputs
1907 (list bats
1908 go
1909 go-md2man
1910 pkg-config))
1911 (synopsis "Build @acronym{OCI, Open Container Initiative} images")
1912 (description
1913 "Buildah is a command-line tool to build @acronym{OCI, Open Container
1914Initiative} container images. More generally, it can be used to:
1915
1916@itemize
1917@item
1918create a working container, either from scratch or using an image as a
1919starting point;
1920@item
1921create an image, either from a working container or via the instructions
1922in a @file{Dockerfile};
1923@item
1924mount a working container's root filesystem for manipulation;
1925@item
1926use the updated contents of a container's root filesystem as a filesystem
1927layer to create a new image.
1928@end itemize")
1929 (home-page "https://buildah.io")
1930 (license license:asl2.0)))
1931
1932(define-public umoci
1933 (package
1934 (name "umoci")
1935 (version "0.6.0")
1936 (source
1937 (origin
1938 (method git-fetch)
1939 (uri (git-reference
1940 (url "https://github.com/opencontainers/umoci")
1941 (commit (string-append "v" version))))
1942 (file-name (git-file-name name version))
1943 (sha256
1944 (base32 "0m50x2q2h34g6sh786blf8r9wh098yzgwnicdlx0cgsqqwjsn0ia"))
1945 (snippet
1946 #~(begin
1947 (use-modules (guix build utils))
1948 (delete-file-recursively "vendor")))))
1949 (build-system go-build-system)
1950 (arguments
1951 (list
1952 #:install-source? #f
1953 #:import-path "github.com/opencontainers/umoci/cmd/umoci"
1954 #:unpack-path "github.com/opencontainers/umoci"
1955 #:test-flags
1956 ;; Two tests fail with error: unpack config.json: convert spec to
1957 ;; rootless: inspecting mount flags of /etc/resolv.conf: no such file or
1958 ;; directory
1959 #~(list "-skip" (string-append "TestUnpackManifestCustomLayer"
1960 "|TestUnpackStartFromDescriptor"))
1961 #:test-subdirs #~(list "../../...") ;test the whole library
1962 #:build-flags
1963 #~(list (string-append "-ldflags="
1964 "-X github.com/opencontainers/umoci.version="
1965 #$version))
1966 #:phases
1967 #~(modify-phases %standard-phases
1968 (add-after 'install 'build-and-install-man-pages
1969 (lambda* (#:key unpack-path #:allow-other-keys)
1970 (with-directory-excursion
1971 (string-append "src/" unpack-path "/doc/man")
1972 (mkdir-p (string-append #$output "/share/man/man1"))
1973 (for-each
1974 (lambda (file)
1975 (let* ((file (string-drop-right file 3)) ;cut .md
1976 (in-md (string-append file ".md"))
1977 (out-man (string-append #$output
1978 "/share/man/man1/" file)))
1979 (invoke "go-md2man" "-in" in-md "-out" out-man)))
1980 (find-files "." "\\.md$"))))))))
1981 (native-inputs
1982 (list go-github-com-adalogics-go-fuzz-headers
1983 go-github-com-apex-log
1984 go-github-com-blang-semver-v4
1985 go-github-com-containerd-platforms
1986 go-github-com-cyphar-filepath-securejoin-0.4.1
1987 go-github-com-cyphar-go-mtree
1988 go-github-com-docker-go-units
1989 go-github-com-klauspost-compress
1990 go-github-com-klauspost-pgzip
1991 go-github-com-moby-sys-user
1992 go-github-com-moby-sys-userns
1993 go-github-com-mohae-deepcopy
1994 go-github-com-opencontainers-go-digest
1995 go-github-com-opencontainers-image-spec
1996 go-github-com-opencontainers-runtime-spec
1997 go-github-com-rootless-containers-proto-go-proto
1998 go-github-com-stretchr-testify
1999 go-github-com-urfave-cli
2000 go-golang-org-x-sys
2001 go-google-golang-org-protobuf
2002 go-md2man))
2003 (home-page "https://umo.ci/")
2004 (synopsis "Tool for modifying Open Container images")
2005 (description
2006 "@command{umoci} is a tool that allows for high-level modification of an
2007Open Container Initiative (OCI) image layout and its tagged images.")
2008 (license license:asl2.0)))