projects/guix·blob java-team · refs

3895 lines · 169.2 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013-2017, 2020-2022 Ludovic Courtès <[email protected]>
3;;; Copyright © 2015, 2016, 2017, 2018 Mark H Weaver <[email protected]>
4;;; Copyright © 2016-2021, 2023-2025 Efraim Flashner <[email protected]>
5;;; Copyright © 2016, 2017 Ricardo Wurmus <[email protected]>
6;;; Copyright © 2017 Alex Vong <[email protected]>
7;;; Copyright © 2017 Andy Patterson <[email protected]>
8;;; Copyright © 2017, 2018, 2019 Rutger Helling <[email protected]>
9;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <[email protected]>
10;;; Copyright © 2018 Danny Milosavljevic <[email protected]>
11;;; Copyright © 2018 Sou Bunnbu <[email protected]>
12;;; Copyright © 2018 Julien Lepiller <[email protected]>
13;;; Copyright © 2019 Guy Fleury Iteriteka <[email protected]>
14;;; Copyright © 2020 Jakub Kądziołka <[email protected]>
15;;; Copyright © 2020, 2021 Brice Waegeneire <[email protected]>
16;;; Copyright © 2020 Mathieu Othacehe <[email protected]>
17;;; Copyright © 2020, 2021, 2022, 2026 Marius Bakke <[email protected]>
18;;; Copyright © 2020-2026 Maxim Cournoyer <[email protected]>
19;;; Copyright © 2020 Brett Gilio <[email protected]>
20;;; Copyright © 2021 Leo Famulari <[email protected]>
21;;; Copyright © 2021, 2022 Pierre Langlois <[email protected]>
22;;; Copyright © 2021 Dion Mendel <[email protected]>
23;;; Copyright © 2021 Andrew Whatson <[email protected]>
24;;; Copyright © 2021 Vincent Legoll <[email protected]>
25;;; Copyright © 2021 Petr Hodina <[email protected]>
26;;; Copyright © 2021 Raghav Gururajan <[email protected]>
27;;; Copyright © 2022, 2024, 2025 Oleg Pykhalov <[email protected]>
28;;; Copyright © 2022, 2023 Ekaitz Zarraga <[email protected]>
29;;; Copyright © 2022 Arun Isaac <[email protected]>
30;;; Copyright © 2022 Zhu Zihao <[email protected]>
31;;; Copyright © 2023 Juliana Sims <[email protected]>
32;;; Copyright © 2023 Ahmad Draidi <[email protected]>
33;;; Copyright © 2023 Sharlatan Hellseher <[email protected]>
34;;; Copyright © 2023-2025 Hartmut Goebel <[email protected]>
35;;; Copyright © 2024 Nicolas Graves <[email protected]>
36;;; Copyright © 2024 Janneke Nieuwenhuizen <[email protected]>
37;;; Copyright © 2024 Raven Hallsby <[email protected]>
38;;; Copyright © 2024 jgart <[email protected]>
39;;; Copyright © 2024, 2025 Ashish SHUKLA <[email protected]>
40;;; Copyright © 2024 Jakob Kirsch <[email protected]>
41;;; Copyright © 2024-2026 Giacomo Leidi <[email protected]>
42;;; Copyright © 2024 Artyom V. Poptsov <[email protected]>
43;;; Copyright © 2025 Karl Hallsby <[email protected]>
44;;; Copyright © 2025 Douglas Deslauriers <[email protected]>
45;;; Copyright © 2025 Andreas Enge <[email protected]>
46;;; Copyright © 2026 Nguyễn Gia Phong <[email protected]>
47;;; Copyright © 2026 Cayetano Santos <[email protected]>
48;;; Copyright © 2026 Sergio Pastor Pérez <[email protected]>
49;;;
50;;; This file is part of GNU Guix.
51;;;
52;;; GNU Guix is free software; you can redistribute it and/or modify it
53;;; under the terms of the GNU General Public License as published by
54;;; the Free Software Foundation; either version 3 of the License, or (at
55;;; your option) any later version.
56;;;
57;;; GNU Guix is distributed in the hope that it will be useful, but
58;;; WITHOUT ANY WARRANTY; without even the implied warranty of
59;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
60;;; GNU General Public License for more details.
61;;;
62;;; You should have received a copy of the GNU General Public License
63;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
64
65(define-module (gnu packages virtualization)
66 #:use-module (gnu packages)
67 #:use-module (gnu packages acl)
68 #:use-module (gnu packages admin)
69 #:use-module (gnu packages apparmor)
70 #:use-module (gnu packages assembly)
71 #:use-module (gnu packages attr)
72 #:use-module (gnu packages apparmor)
73 #:use-module (gnu packages augeas)
74 #:use-module (gnu packages autotools)
75 #:use-module (gnu packages backup)
76 #:use-module (gnu packages base)
77 #:use-module (gnu packages bash)
78 #:use-module (gnu packages bison)
79 #:use-module (gnu packages bootloaders)
80 #:use-module (gnu packages build-tools)
81 #:use-module (gnu packages cdrom)
82 #:use-module (gnu packages check)
83 #:use-module (gnu packages cluster)
84 #:use-module (gnu packages cmake)
85 #:use-module (gnu packages compression)
86 #:use-module (gnu packages containers)
87 #:use-module (gnu packages cpio)
88 #:use-module (gnu packages cross-base)
89 #:use-module (gnu packages crypto)
90 #:use-module (gnu packages cryptsetup)
91 #:use-module (gnu packages curl)
92 #:use-module (gnu packages cyrus-sasl)
93 #:use-module (gnu packages dbm)
94 #:use-module (gnu packages debian)
95 #:use-module (gnu packages disk)
96 #:use-module (gnu packages dns)
97 #:use-module (gnu packages docbook)
98 #:use-module (gnu packages documentation)
99 #:use-module (gnu packages engineering)
100 #:use-module (gnu packages figlet)
101 #:use-module (gnu packages file)
102 #:use-module (gnu packages firmware)
103 #:use-module (gnu packages compiler-tools)
104 #:use-module (gnu packages fonts)
105 #:use-module (gnu packages fontutils)
106 #:use-module (gnu packages freedesktop)
107 #:use-module (gnu packages gcc)
108 #:use-module (gnu packages gettext)
109 #:use-module (gnu packages gl)
110 #:use-module (gnu packages glib)
111 #:use-module (gnu packages gnome)
112 #:use-module (gnu packages gnupg)
113 #:use-module (gnu packages golang)
114 #:use-module (gnu packages golang-build)
115 #:use-module (gnu packages golang-compression)
116 #:use-module (gnu packages golang-check)
117 #:use-module (gnu packages golang-crypto)
118 #:use-module (gnu packages golang-web)
119 #:use-module (gnu packages golang-xyz)
120 #:use-module (gnu packages gperf)
121 #:use-module (gnu packages graphviz)
122 #:use-module (gnu packages gtk)
123 #:use-module (gnu packages guile)
124 #:use-module (gnu packages java)
125 #:use-module (gnu packages haskell)
126 #:use-module (gnu packages haskell-apps)
127 #:use-module (gnu packages haskell-check)
128 #:use-module (gnu packages haskell-crypto)
129 #:use-module (gnu packages haskell-web)
130 #:use-module (gnu packages haskell-xyz)
131 #:use-module (gnu packages high-availability)
132 #:use-module (gnu packages image)
133 #:use-module (gnu packages libbsd)
134 #:use-module (gnu packages libusb)
135 #:use-module (gnu packages linux)
136 #:use-module (gnu packages llvm)
137 #:use-module (gnu packages lua)
138 #:use-module (gnu packages m4)
139 #:use-module (gnu packages man)
140 #:use-module (gnu packages multiprecision)
141 #:use-module (gnu packages ncurses)
142 #:use-module (gnu packages nettle)
143 #:use-module (gnu packages networking)
144 #:use-module (gnu packages ocaml)
145 #:use-module (gnu packages onc-rpc)
146 #:use-module (gnu packages package-management)
147 #:use-module (gnu packages pciutils)
148 #:use-module (gnu packages pcre)
149 #:use-module (gnu packages perl)
150 #:use-module (gnu packages pkg-config)
151 #:use-module (gnu packages polkit)
152 #:use-module (gnu packages protobuf)
153 #:use-module (gnu packages pulseaudio)
154 #:use-module (gnu packages python)
155 #:use-module (gnu packages python-build)
156 #:use-module (gnu packages python-check)
157 #:use-module (gnu packages python-crypto)
158 #:use-module (gnu packages python-web)
159 #:use-module (gnu packages python-xyz)
160 #:use-module (gnu packages readline)
161 #:use-module (gnu packages ruby)
162 #:use-module (gnu packages ruby-check)
163 #:use-module (gnu packages ruby-xyz)
164 #:use-module (gnu packages rust)
165 #:use-module (gnu packages rust-apps)
166 #:use-module (gnu packages rsync)
167 #:use-module (gnu packages sdl)
168 #:use-module (gnu packages selinux)
169 #:use-module (gnu packages sphinx)
170 #:use-module (gnu packages spice)
171 #:use-module (gnu packages ssh)
172 #:use-module (gnu packages tcl)
173 #:use-module (gnu packages texinfo)
174 #:use-module (gnu packages textutils)
175 #:use-module (gnu packages tls)
176 #:use-module (gnu packages web)
177 #:use-module (gnu packages wget)
178 #:use-module (gnu packages vnc)
179 #:use-module (gnu packages wxwidgets)
180 #:use-module (gnu packages xdisorg)
181 #:use-module (gnu packages xml)
182 #:use-module (gnu packages xorg)
183 #:use-module ((guix licenses) #:prefix license:)
184 #:use-module (guix build-system cargo)
185 #:use-module (guix build-system cmake)
186 #:use-module (guix build-system gnu)
187 #:use-module (guix build-system go)
188 #:use-module (guix build-system haskell)
189 #:use-module (guix build-system meson)
190 #:use-module (guix build-system pyproject)
191 #:use-module (guix build-system ruby)
192 #:use-module (guix build-system trivial)
193 #:use-module (guix deprecation)
194 #:use-module (guix download)
195 #:use-module (guix gexp)
196 #:use-module (guix git-download)
197 #:use-module (guix packages)
198 #:use-module (guix modules)
199 #:use-module (guix search-paths)
200 #:use-module (guix utils)
201 #:use-module (srfi srfi-1)
202 #:use-module (srfi srfi-26)
203 #:use-module (ice-9 match))
204
205(define-public qemu
206 (package
207 (name "qemu")
208 ;; Do not forget to update the various firmware used by QEMU, and sync the
209 ;; configuration options used by the seabios-qemu package with those
210 ;; provided by QEMU.
211 (version "10.2.1")
212 (source
213 (origin
214 (method url-fetch)
215 (uri (string-append "https://download.qemu.org/qemu-"
216 version ".tar.xz"))
217 (sha256
218 (base32 "1qf9j6cnh9ycs33dmrm1bas3wafkdh7w5yzz1dilvj72v1vp8wd3"))
219 (patches (search-patches "qemu-build-info-manual.patch"
220 "qemu-fix-agent-paths.patch"
221 "qemu-fix-test-virtio-version.patch"))
222 (modules '((guix build utils)))
223 (snippet
224 '(begin
225 ;; Delete the bundled rust crates.
226 (delete-file-recursively "subprojects/packagecache")
227 (mkdir-p "subprojects/packagecache")
228 ;; TODO: Scrub all firmwares from this directory!
229 (with-directory-excursion "pc-bios"
230 ;; Delete firmwares provided by SeaBIOS.
231 (for-each delete-file (find-files "." "^(bios|vgabios).*\\.bin$"))
232 ;; Delete ppc64 OpenBIOS. TODO: Remove sparc32 and sparc64 too
233 ;; once they are supported in Guix.
234 (delete-file "openbios-ppc")
235 ;; Delete riscv64 OpenSBI. TODO: Remove riscv32 when supported
236 ;; in Guix.
237 (delete-file "opensbi-riscv64-generic-fw_dynamic.bin")
238 ;; Delete iPXE firmwares.
239 (for-each delete-file (find-files "." "^(efi|pxe)-.*\\.rom$")))
240 ;; Delete bundled code that we provide externally.
241 (for-each delete-file-recursively
242 '("roms/u-boot/scripts/dtc"
243 "roms/ipxe"
244 "roms/openbios"
245 "roms/opensbi"
246 "roms/seabios"))))))
247 (outputs '("out" "static" "doc")) ;5.3 MiB of HTML docs
248 (build-system gnu-build-system)
249 (arguments
250 (list
251 ;; FIXME: Disable tests on i686 to work around
252 ;; <https://bugs.gnu.org/40527>.
253 #:tests? (or (%current-target-system)
254 (not (string=? "i686-linux" (%current-system))))
255 #:parallel-tests? (not (or (target-arm32?)
256 (target-riscv64?)))
257 #:configure-flags
258 #~(let ((gcc (search-input-file %build-inputs "/bin/gcc"))
259 (openbios (search-input-file %build-inputs
260 "share/qemu/openbios-ppc"))
261 (opensbi (search-input-file
262 %build-inputs
263 "share/qemu/opensbi-riscv64-generic-fw_dynamic.bin"))
264 (seabios (search-input-file %build-inputs
265 "share/qemu/bios.bin"))
266 (ipxe
267 #$@(if (this-package-input "ipxe-qemu")
268 #~((search-input-file %build-inputs
269 "share/qemu/pxe-virtio.rom"))
270 #~((string-append #$output "/share/qemu"))))
271 (out #$output))
272 (cons* (string-append "--cc=" gcc)
273 ;; Some architectures insist on using HOST_CC.
274 (string-append "--host-cc=" gcc)
275 (string-append "--prefix=" out)
276 "--sysconfdir=/etc"
277 "--enable-fdt=system"
278 (string-append "--firmwarepath=" out "/share/qemu:"
279 (dirname seabios) ":"
280 (dirname ipxe) ":"
281 (dirname openbios) ":"
282 (dirname opensbi))
283 (string-append "--smbd=" out "/libexec/samba-wrapper")
284 "--disable-debug-info" ;for space considerations
285 ;; The binaries need to be linked against -lrt.
286 (string-append "--extra-ldflags=-lrt")
287 #$@(if (this-package-native-input "rust")
288 #~((list "--enable-rust"))
289 #~((list)))))
290 ;; Make build and test output verbose to facilitate investigation upon failure.
291 #:make-flags #~'("V=1")
292 #:modules `((srfi srfi-1)
293 (srfi srfi-26)
294 (ice-9 ftw)
295 (ice-9 match)
296 ((guix build cargo-build-system) #:prefix cargo:)
297 ,@%default-gnu-modules)
298 #:imported-modules `(,@%cargo-build-system-modules
299 ,@%default-gnu-imported-modules)
300 #:phases
301 #~(modify-phases %standard-phases
302 ;; Since we removed the bundled firmwares above, many tests
303 ;; can't work. Re-add them here.
304 (add-after 'unpack 'replace-firmwares
305 (lambda* (#:key inputs #:allow-other-keys)
306 (let* ((seabios (dirname (search-input-file
307 inputs "share/qemu/bios.bin")))
308 (seabios-firmwares (find-files seabios "\\.bin$"))
309 (ipxe
310 #$@(if (this-package-input "ipxe-qemu")
311 #~((dirname (search-input-file
312 inputs "share/qemu/pxe-virtio.rom")))
313 #~((string-append #$output "/share/qemu"))))
314 (ipxe-firmwares (find-files ipxe "\\.rom$"))
315 (openbios (search-input-file
316 inputs "share/qemu/openbios-ppc"))
317 (opensbi-riscv64
318 (search-input-file
319 inputs
320 "share/qemu/opensbi-riscv64-generic-fw_dynamic.bin"))
321 (allowed-differences
322 ;; Ignore minor differences (addresses etc) in the firmware
323 ;; data tables compared to what the test suite expects.
324 '("tests/data/acpi/x86/pc/SSDT.dimmpxm"
325 "tests/data/acpi/x86/pc/DSDT.dimmpxm"
326 "tests/data/acpi/x86/pc/ERST.acpierst"
327 "tests/data/acpi/x86/q35/ERST.acpierst"
328 "tests/data/acpi/x86/q35/DSDT.cxl"))
329 (allowed-differences-whitelist
330 (open-file "tests/qtest/bios-tables-test-allowed-diff.h"
331 "a")))
332 (with-directory-excursion "pc-bios"
333 (for-each (lambda (file)
334 (symlink file (basename file)))
335 (append seabios-firmwares ipxe-firmwares
336 (list openbios opensbi-riscv64))))
337 (for-each (lambda (file)
338 (format allowed-differences-whitelist
339 "\"~a\",~%" file))
340 allowed-differences)
341 (close-port allowed-differences-whitelist))))
342 #$@(if (this-package-native-input "rust")
343 #~((add-after 'unpack 'prepare-rust-crates
344 (lambda args
345 (apply (assoc-ref cargo:%standard-phases
346 'prepare-rust-crates)
347 args)
348 ;; Use /tmp/rust-crates as the source.
349 (substitute* (find-files "subprojects" "-rs\\.wrap$")
350 (("source_url = (.*)" _ url)
351 (let ((split-url (string-split url #\/)))
352 (string-append
353 "source_url = file:///tmp/rust-crates/rust-"
354 (list-ref split-url 6) "-"
355 (list-ref split-url 7) ".tar.gz\n"))))
356 ;; "Download" the packages.
357 (for-each
358 (lambda (wrapper)
359 (invoke "meson" "subprojects" "download"
360 (string-drop-right wrapper 5)))
361 (scandir "subprojects"
362 (lambda (file)
363 (string-suffix? "-rs.wrap" file)))))))
364 #~())
365 ;; If the ipxe firmware isn't available, remove it from the list
366 ;; of files expected to be available and remove some of the tests.
367 #$@(if (not (this-package-input "ipxe-qemu"))
368 #~((add-after 'unpack 'dont-require-ipxe-firmware
369 (lambda _
370 (substitute* "pc-bios/meson.build"
371 ((".*(pxe|efi)-.*") ""))
372 ;; Skip all the tests in tests/qtest instead
373 ;; of cherry-picking the tests which need the
374 ;; ipxe-qemu firmware.
375 (substitute* "tests/meson.build"
376 (("subdir.*qtest.*") ""))
377 ;; efi-ne2k_pci.rom is from ipxe-qemu.
378 (substitute* "tests/functional/ppc/meson.build"
379 ((".*'74xx',.*") "")))))
380 #~())
381 (add-after 'unpack 'extend-test-time-outs
382 (lambda _
383 ;; These tests can time out on heavily-loaded and/or slow storage.
384 (substitute* (cons* "tests/qemu-iotests/common.qemu"
385 (find-files "tests/qemu-iotests" "^[0-9]+$"))
386 (("QEMU_COMM_TIMEOUT=[0-9]+" match)
387 (string-append match "9")))))
388 (add-after 'unpack 'disable-unusable-tests
389 (lambda _
390 (substitute* "tests/unit/meson.build"
391 ;; Comment out the test-qga test, which needs /sys and
392 ;; fails within the build environment.
393 (("tests.*test-qga.*$" all)
394 (string-append "# " all))
395 ;; Comment out the test-char test, which needs networking and
396 ;; fails within the build environment.
397 ((".*'test-char':.*" all)
398 (string-append "# " all)))
399 (substitute* "tests/qtest/meson.build"
400 ;; These tests fail to get the expected number of tests
401 ;; on arm platforms.
402 (("'arm-cpu-features',") "")
403 ;; This test is known to be flaky.
404 ;; See <https://gitlab.com/qemu-project/qemu/-/issues/2121>.
405 (("\\['ahci-test'\\]") "[]"))
406 ;; This test appears to be flaky as well, probably resulting
407 ;; from a race condition.
408 (delete-file "tests/qemu-iotests/tests/copy-before-write")
409 ;; This test fails non-deterministically (see:
410 ;; https://gitlab.com/qemu-project/qemu/-/issues/2867).
411 (delete-file "tests/qemu-iotests/161")))
412 #$@(cond
413 ((target-riscv64?)
414 #~((add-after 'unpack 'disable-some-tests
415 (lambda _
416 ;; Extend the test timeout for this test:
417 (substitute* "tests/unit/meson.build"
418 (("test-crypto-tlssession': 90")
419 "test-crypto-tlssession': 180"))
420
421 ;; qemu.qmp.QMPConnectError:
422 ;; Unexpected empty reply from server
423 (delete-file "tests/qemu-iotests/040")
424 (delete-file "tests/qemu-iotests/041")
425 (delete-file "tests/qemu-iotests/256")
426
427 ;; No 'PCI' bus found for device 'virtio-scsi-pci'
428 (delete-file "tests/qemu-iotests/127")
429 (delete-file "tests/qemu-iotests/267")
430
431 ;; This test takes too long.
432 (delete-file "tests/qemu-iotests/tests/iothreads-stream")))))
433 ((target-arm32?)
434 #~((add-after 'unpack 'disable-some-tests
435 (lambda _
436 ;; Extend the test timeout for this test:
437 (substitute* "tests/unit/meson.build"
438 (("test-crypto-tlssession': 90")
439 "test-crypto-tlssession': 180"))
440
441 ;; failed to allocate memory for stack: Cannot allocate memory
442 (substitute* "tests/qtest/meson.build"
443 ((".*qtests_aspeed :.*") ""))))))
444 ((target-aarch64?)
445 #~((add-after 'unpack 'disable-some-tests
446 (lambda _
447 ;; fails on some devices with GICv3 emulation not supported.
448 (let ((patch #$(local-file
449 (search-patch
450 "qemu-disable-aarch64-migration-test.patch"))))
451 (invoke "patch" "--force" "-p1" "-i" patch))))))
452 (else '()))
453 (add-after 'patch-source-shebangs 'patch-embedded-shebangs
454 (lambda* (#:key native-inputs inputs #:allow-other-keys)
455 ;; Ensure the executables created by these source files reference
456 ;; /bin/sh from the store so they work inside the build container.
457 (substitute* '("block/cloop.c"
458 "migration/exec.c"
459 "migration/migration.c"
460 "net/tap.c"
461 "util/envlist.c")
462 (("/bin/sh")
463 (search-input-file inputs "/bin/sh")))
464 ;; For tests, use the native /bin/sh is available.
465 (substitute* '("tests/qtest/libqtest.c"
466 "tests/qtest/vhost-user-blk-test.c")
467 (("/bin/sh")
468 (search-input-file (or native-inputs inputs) "/bin/sh")))
469 (substitute* "tests/qemu-iotests/testenv.py"
470 (("#!/usr/bin/env python3")
471 (string-append "#!" (search-input-file (or native-inputs inputs)
472 "/bin/python3"))))))
473 (add-before 'configure 'fix-optionrom-makefile
474 (lambda _
475 ;; Work around the inability of the rules defined in this
476 ;; Makefile to locate the firmware files (e.g.: No rule to make
477 ;; target 'multiboot.bin') by extending the VPATH.
478 (substitute* "pc-bios/optionrom/Makefile"
479 (("^VPATH = \\$\\(SRC_DIR\\)")
480 "VPATH = $(SRC_DIR):$(TOPSRC_DIR)/pc-bios"))))
481 ;; XXX ./configure is being re-run at beginning of build phase...
482 (replace 'configure
483 (lambda* (#:key inputs configure-flags #:allow-other-keys)
484 ;; The `configure' script doesn't understand some of the
485 ;; GNU options. Thus, add a new phase that's compatible.
486 (setenv "SHELL" (which "bash"))
487 ;; Ensure config.status gets the correct shebang off the bat.
488 ;; The build system gets confused if we change it later and
489 ;; attempts to re-run the whole configuration, and fails.
490 (substitute* "configure"
491 (("#!/bin/sh")
492 (string-append "#!" (which "sh"))))
493 (mkdir-p "b/qemu")
494 (chdir "b/qemu")
495 (apply invoke "../../configure" configure-flags)))
496
497 ;; Configure, build and install QEMU user-emulation static binaries.
498 (add-after 'configure 'configure-user-static
499 (lambda* (#:key inputs outputs #:allow-other-keys)
500 (let* ((gcc (search-input-file inputs "/bin/gcc"))
501 ;; This is the common set of configure flags; it is
502 ;; duplicated here to isolate this phase from manipulations
503 ;; to the #:configure-flags build argument, as done in
504 ;; derived packages such as qemu-minimal.
505 (configure-flags (list (string-append "--cc=" gcc)
506 (string-append "--host-cc=" gcc)
507 "--sysconfdir=/etc"
508 "--disable-debug-info"))
509 (static (assoc-ref outputs "static")))
510 (mkdir-p "../user-static")
511 (with-directory-excursion "../user-static"
512 (apply invoke "../../configure"
513 "--static"
514 "--disable-docs" ;already built
515 "--disable-system"
516 "--enable-linux-user"
517 (string-append "--prefix=" static)
518 configure-flags)))))
519 (add-after 'build 'build-user-static
520 (lambda args
521 (with-directory-excursion "../user-static"
522 (apply (assoc-ref %standard-phases 'build) args))))
523 (add-after 'install 'install-plugins
524 (lambda* (#:key outputs #:allow-other-keys)
525 (let ((plugin-dir (string-append
526 (assoc-ref outputs "out")
527 "/lib/qemu/plugins")))
528 (mkdir-p plugin-dir)
529 (with-directory-excursion "contrib/plugins"
530 (for-each
531 (cut install-file <> plugin-dir)
532 (find-files "." "\\.so$"))))))
533 (add-after 'install 'install-user-static
534 (lambda* (#:key outputs #:allow-other-keys)
535 (let ((static-bin (string-append
536 (assoc-ref outputs "static") ;see bug#70611
537 "/bin")))
538 (with-directory-excursion "../user-static"
539 (for-each
540 (cut install-file <> static-bin)
541 (find-files "."
542 (lambda (name stat)
543 ;; Select 'qemu-' prefixed executables.
544 (and (string-prefix? "./qemu-" name)
545 (eq? 'regular (stat:type stat))
546 (logtest #o100 (stat:perms stat))))))))))
547 (add-before 'check 'set-SOCK_DIR
548 (lambda _
549 ;; The default value for SOCK_DIR is TMPDIR, which can be long
550 ;; in the build chroot (e.g.:
551 ;; /tmp/guix-build-qemu-minimal-drv-0); set it to SOCK_DIR to
552 ;; avoid using more than 109 characters for socket files (the
553 ;; limit when using the kernel Linux).
554 (setenv "SOCK_DIR" "/tmp")))
555 (add-after 'install 'delete-firmwares
556 (lambda _
557 ;; Delete firmares that are accessible on --firmwarepath.
558 ;; For some reason tests fail if we simply remove them from
559 ;; pc-bios/meson.build, hence this roundabout way.
560 (with-directory-excursion (string-append #$output "/share/qemu")
561 (for-each delete-file
562 (append
563 '("openbios-ppc"
564 "opensbi-riscv64-generic-fw_dynamic.bin")
565 (find-files "." "^(vga)?bios(-[a-z0-9-]+)?\\.bin$")
566 (find-files "." "^(efi|pxe)-.*\\.rom$"))))))
567 ;; Create a wrapper for Samba. This allows QEMU to use Samba without
568 ;; pulling it in as an input. Note that you need to explicitly install
569 ;; Samba in your Guix profile for Samba support.
570 (add-after 'install 'create-samba-wrapper
571 (lambda* (#:key inputs #:allow-other-keys)
572 (let ((libexec (string-append #$output "/libexec")))
573 (call-with-output-file "samba-wrapper"
574 (lambda (port)
575 (format port "#!/bin/sh
576exec smbd $@")))
577 (chmod "samba-wrapper" #o755)
578 (install-file "samba-wrapper" libexec))))
579 (add-after 'install 'move-html-doc
580 (lambda* (#:key inputs outputs #:allow-other-keys)
581 (let* ((out #$output)
582 (doc (assoc-ref outputs "doc")) ;see bug#70611
583 (qemu-doc (string-append doc "/share/doc/qemu-"
584 #$(package-version this-package))))
585 (mkdir-p qemu-doc)
586 (rename-file (string-append out "/share/doc/qemu")
587 (string-append qemu-doc "/html"))))))))
588 (inputs
589 (append
590 (if (supported-package? ipxe-qemu)
591 (list ipxe-qemu)
592 '())
593 (list alsa-lib
594 bash-minimal
595 capstone
596 dtc
597 glib
598 gnutls ;for qcow2 disk encryption
599 gtk+
600 libaio
601 libcacard ;smartcard support
602 attr libcap-ng ;VirtFS support
603 libdrm
604 libepoxy
605 libjpeg-turbo
606 libpng
607 libseccomp
608 libslirp
609 liburing
610 libusb ;USB pass-through support
611 mesa
612 ncurses
613 openbios-qemu-ppc
614 opensbi-qemu
615 pipewire ;Pipewire support, -audiodev pipewire
616 pixman
617 pulseaudio
618 sdl2
619 seabios-qemu
620 spice
621 usbredir
622 util-linux
623 vde2
624 virglrenderer
625 zlib
626 `(,zstd "lib"))))
627 (native-inputs
628 (append
629 ;; The rust code doesn't seem to be in use yet.
630 (if #f ;(supported-package? rust)
631 (append
632 (cons* rust
633 rust-bindgen-cli
634 (cargo-inputs 'qemu))
635 (or (and=> (%current-target-system)
636 (compose list make-rust-sysroot))
637 '()))
638 '())
639 ;; Note: acpica is here only to pretty-print firmware differences with
640 ;; IASL (see the replace-firmwares phase above).
641 (list acpica
642 bison
643 flex
644 gettext-minimal
645 `(,glib "bin") ;gtester, etc.
646 meson
647 ninja
648 perl
649 pkg-config
650 python-wrapper
651 python-sphinx
652 python-sphinx-rtd-theme
653 python-tomli
654 texinfo
655 ;; The following static libraries are required to build
656 ;; the static output of QEMU.
657 `(,glib "static")
658 `(,pcre2 "static")
659 `(,zlib "static"))))
660 ;; When using command-line options such as '-display spice-app', QEMU will
661 ;; search 'XDG_DATA_DIRS' for applications that can handle the relevant
662 ;; URI schema.
663 (native-search-paths (list $XDG_DATA_DIRS))
664 (home-page "https://www.qemu.org")
665 (synopsis "Machine emulator and virtualizer")
666 (description
667 "QEMU is a generic machine emulator and virtualizer.
668
669When used as a machine emulator, QEMU can run OSes and programs made for one
670machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
671using dynamic translation, it achieves very good performance.
672
673When used as a virtualizer, QEMU achieves near native performances by
674executing the guest code directly on the host CPU. QEMU supports
675virtualization when executing under the Xen hypervisor or using
676the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
677server and embedded PowerPC, and S390 guests.")
678
679 ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
680 (license license:gpl2)
681
682 ;; Several tests fail on MIPS; see <http://hydra.gnu.org/build/117914>.
683 (supported-systems (fold delete %supported-systems
684 '("mips64el-linux" "i586-gnu" "x86_64-gnu")))))
685
686(define-public qemu-minimal
687 ;; QEMU without GUI support, only supporting the host's architecture
688 (package/inherit qemu
689 (name "qemu-minimal")
690 (outputs '("out"))
691 (synopsis
692 "Machine emulator and virtualizer (without GUI or docs) for the host architecture")
693 (arguments
694 (substitute-keyword-arguments arguments
695 ((#:configure-flags configure-flags #~'())
696 ;; Restrict to the host's architecture.
697 (let* ((system (or (%current-target-system)
698 (%current-system)))
699 (target-list-arg
700 (match system
701 ((? (cut string-prefix? "i686" <>))
702 "--target-list=i386-softmmu")
703 ((? (cut string-prefix? "x86_64" <>))
704 "--target-list=i386-softmmu,x86_64-softmmu")
705 ((? (cut string-prefix? "mips64" <>))
706 (string-append "--target-list=mips-softmmu,mipsel-softmmu,"
707 "mips64-softmmu,mips64el-softmmu"))
708 ((? (cut string-prefix? "mips" <>))
709 "--target-list=mips-softmmu,mipsel-softmmu")
710 ((? (cut string-prefix? "aarch64" <>))
711 "--target-list=arm-softmmu,aarch64-softmmu")
712 ((? (cut string-prefix? "arm" <>))
713 "--target-list=arm-softmmu")
714 ((? (cut string-prefix? "alpha" <>))
715 "--target-list=alpha-softmmu")
716 ((? (cut string-prefix? "powerpc64" <>))
717 "--target-list=ppc-softmmu,ppc64-softmmu")
718 ((? (cut string-prefix? "powerpc" <>))
719 "--target-list=ppc-softmmu")
720 ((? (cut string-prefix? "s390" <>))
721 "--target-list=s390x-softmmu")
722 ((? (cut string-prefix? "riscv" <>))
723 "--target-list=riscv32-softmmu,riscv64-softmmu")
724 (else ; An empty list actually builds all the targets.
725 '()))))
726 #~(cons #$target-list-arg #$configure-flags)))
727 ((#:phases phases #~'%standard-phases)
728 #~(modify-phases #$phases
729 (delete 'configure-user-static)
730 (delete 'build-user-static)
731 (delete 'install-user-static)
732 (delete 'move-html-doc)))))
733
734 ;; Remove dependencies on optional libraries, notably GUI libraries.
735 (native-inputs (filter (lambda (input)
736 (match input
737 ;; Work around the fact that modify-inputs can not
738 ;; delete specific outputs; i.e. here we should keep
739 ;; `(,glib "bin"), but not `(,glib "static").
740 ((label package output)
741 (not (string=? "static" output)))
742 (_ input)))
743 (modify-inputs native-inputs
744 (delete "gettext-minimal"
745 "python-sphinx"
746 "python-sphinx-rtd-theme"))))
747 (inputs (modify-inputs inputs
748 (delete "libusb"
749 "mesa"
750 "sdl2"
751 "spice"
752 "virglrenderer"
753 "gtk+"
754 "usbredir"
755 "libdrm"
756 "libepoxy"
757 "pipewire"
758 "pulseaudio"
759 "vde2"
760 "libcacard")))))
761
762(define (system->qemu-target system)
763 (cond
764 ((string-prefix? "i686" system)
765 "qemu-system-i386")
766 ((string-prefix? "arm" system)
767 "qemu-system-arm")
768 (else
769 (string-append "qemu-system-" (match (string-split system #\-)
770 ((arch kernel) arch)
771 (_ system))))))
772
773(define-public libx86emu
774 (package
775 (name "libx86emu")
776 (version "3.5")
777 (home-page "https://github.com/wfeldt/libx86emu")
778 (source (origin
779 (method git-fetch)
780 (uri (git-reference
781 (url home-page)
782 (commit version)))
783 (file-name (git-file-name name version))
784 (sha256
785 (base32 "11nj3y7maz9ch15b1c2b69gd8d7mpaha377zpdbvfsmg5w9zz93l"))
786 (modules '((guix build utils)))
787 (snippet `(begin
788 ;; Remove git2log program file.
789 (delete-file "git2log")
790 ;; Remove variables that depends on git2log.
791 (substitute* "Makefile"
792 (("GIT2LOG.*=.*$") "")
793 (("GITDEPS.*=.*$") "")
794 (("BRANCH.*=.*$") ""))))))
795 (build-system gnu-build-system)
796 (arguments
797 `(#:test-target "test"
798 ;; sys/io.h is not present from glibc on non-x86 systems.
799 #:tests? ,(and (target-x86?)
800 (not (%current-target-system)))
801 #:phases (modify-phases %standard-phases
802 (add-after 'unpack 'patch
803 (lambda* (#:key outputs #:allow-other-keys)
804 (let* ((out (assoc-ref outputs "out"))
805 (include (string-append out "/include"))
806 (lib (string-append out "/lib")))
807 ;; Correct the values of version and install directories.
808 (substitute* "Makefile"
809 (("VERSION.*=.*$")
810 (string-append "VERSION := "
811 ,version "\n"))
812 (("PREFIX.*=.*$")
813 (string-append "PREFIX := " out "\n"))
814 (("MAJOR_VERSION.*=.*$")
815 (string-append "MAJOR_VERSION := "
816 ,(version-major version) "\n"))
817 (("LIBDIR.*=.*$")
818 (string-append "LIBDIR = " lib "\n"))
819 (("/usr/include")
820 include)))))
821 ;; XXX: "make -C test" fails because it cannot find "x86test"
822 ;; executable due to parallel tests. So we need to make sure that
823 ;; this file is built before running the tests.
824 (add-before 'check 'make-x86test
825 (lambda _
826 (invoke "make" "-C" "test" "x86test")))
827 (delete 'configure)))) ;no configure script
828 (native-inputs (list nasm perl))
829 (synopsis "Library for x86 emulation")
830 (description
831 "Libx86emu is a small library to emulate x86 instructions. The
832focus here is not a complete emulation but to cover enough for typical
833firmware blobs. You can
834@enumerate
835@item intercept any memory access or directly map real memory ranges
836@item intercept any i/o access, map real i/o ports, or block any real i/o
837@item intercept any interrupt
838@item add a hook to run after each instruction
839@item recognize a special x86 instruction that can trigger logging
840@item use integrated logging
841@end enumerate")
842 (license (license:x11-style "file://LICENSE"))))
843
844(define-public ganeti
845 (package
846 (name "ganeti")
847 (version "3.1.1")
848 (source (origin
849 (method git-fetch)
850 (uri (git-reference
851 (url "https://github.com/ganeti/ganeti")
852 (commit (string-append "v" version))))
853 (sha256
854 (base32 "1l3a3rw7bd7545irz1n0w3bj3djkrl7x90aw6hg39d3mhwpg9vhc"))
855 (file-name (git-file-name name version))
856 (patches (search-patches "ganeti-shepherd-support.patch"
857 "ganeti-shepherd-master-failover.patch"
858 "ganeti-haskell-pythondir.patch"
859 "ganeti-disable-version-symlinks.patch"
860 "ganeti-lens-compat.patch"))))
861 (build-system gnu-build-system)
862 (arguments
863 (list
864 #:imported-modules `(,@%pyproject-build-system-modules
865 ,@%haskell-build-system-modules)
866 #:modules `(,@%default-gnu-modules
867 ((guix build haskell-build-system) #:prefix haskell:)
868 ((guix build pyproject-build-system) #:select (site-packages))
869 (srfi srfi-1)
870 (srfi srfi-26)
871 (ice-9 match)
872 (ice-9 rdelim))
873
874 ;; The default test target includes a lot of checks that are only really
875 ;; relevant for developers such as NEWS file checking, line lengths, etc.
876 ;; We are only interested in the "py-tests" and "hs-tests" targets: this
877 ;; is the closest we've got even though it includes a little more.
878 #:test-target "check-TESTS"
879
880 #:configure-flags
881 #~(list "--localstatedir=/var"
882 "--sharedstatedir=/var"
883 "--sysconfdir=/etc"
884 "--enable-haskell-tests"
885
886 ;; By default, the build system installs everything to versioned
887 ;; directories such as $libdir/3.0 and relies on a $libdir/default
888 ;; symlink pointed from /etc/ganeti/{lib,share} to actually function.
889 ;; This is done to accommodate installing multiple versions in
890 ;; parallel, but is of little use to us as Guix users can just
891 ;; roll back and forth. Thus, disable it for simplicity.
892 "--disable-version-links"
893
894 ;; Ganeti can optionally take control over SSH host keys and
895 ;; distribute them to nodes as they are added, and also rotate keys
896 ;; with 'gnt-cluster renew-crypto --new-ssh-keys'. Thus it needs to
897 ;; know how to restart the SSH daemon.
898 "--with-sshd-restart-command='herd restart ssh-daemon'"
899
900 ;; Look for OS definitions in this directory by default. It can
901 ;; be changed in the cluster configuration.
902 "--with-os-search-path=/run/current-system/profile/share/ganeti/os"
903
904 ;; The default QEMU executable to use. We don't use the package
905 ;; here because this entry is stored in the cluster configuration.
906 (string-append
907 "--with-kvm-path=/run/current-system/profile/bin/"
908 #$(system->qemu-target (%current-system))))
909 #:phases
910 #~(modify-phases %standard-phases
911 (add-after 'unpack 'create-vcs-version
912 (lambda _
913 ;; If we are building from a git checkout, we need to create a
914 ;; 'vcs-version' file manually because the build system does
915 ;; not have access to the git repository information.
916 (unless (file-exists? "vcs-version")
917 (call-with-output-file "vcs-version"
918 (cut format <> "v~a~%" #$version)))))
919 (add-after 'unpack 'patch-absolute-file-names
920 (lambda* (#:key inputs #:allow-other-keys)
921 (substitute* '("lib/utils/process.py"
922 "lib/utils/text.py"
923 "src/Ganeti/Constants.hs"
924 "src/Ganeti/HTools/CLI.hs"
925 "test/py/legacy/ganeti.config_unittest.py"
926 "test/py/legacy/ganeti.hooks_unittest.py"
927 "test/py/legacy/ganeti.utils.process_unittest.py"
928 "test/py/legacy/ganeti.utils.text_unittest.py"
929 "test/py/legacy/ganeti.utils.wrapper_unittest.py")
930 (("/bin/sh") (search-input-file inputs "/bin/sh"))
931 (("/bin/bash") (search-input-file inputs "/bin/bash"))
932 (("/usr/bin/env") (search-input-file inputs "/bin/env"))
933 (("/bin/true") (search-input-file inputs "/bin/true")))
934
935 ;; This script is called by the node daemon at startup to perform
936 ;; sanity checks on the cluster IP addresses, and it is also used
937 ;; in a master-failover scenario. Add absolute references to
938 ;; avoid propagating these executables.
939 (substitute* "tools/master-ip-setup"
940 (("arping") (search-input-file inputs "/bin/arping"))
941 (("ndisc6") (search-input-file inputs "/bin/ndisc6"))
942 (("fping") (search-input-file inputs "/sbin/fping"))
943 (("grep") (search-input-file inputs "/bin/grep"))
944 (("ip addr") (string-append (search-input-file inputs "/sbin/ip")
945 " addr")))))
946 (add-after 'unpack 'override-builtin-PATH
947 (lambda _
948 ;; Ganeti runs OS install scripts and similar with a built-in
949 ;; hard coded PATH. Patch so it works on Guix System.
950 (substitute* "src/Ganeti/Constants.hs"
951 (("/sbin:/bin:/usr/sbin:/usr/bin")
952 "/run/privileged/bin:/run/current-system/profile/sbin:\
953/run/current-system/profile/bin"))))
954 (add-after 'bootstrap 'patch-sphinx-version-detection
955 (lambda _
956 ;; The build system runs 'sphinx-build --version' to verify that
957 ;; the Sphinx is recent enough, but does not expect the
958 ;; .sphinx-build-real executable name created by the Sphinx wrapper.
959 (substitute* "configure"
960 (("\\$SPHINX --version 2>&1")
961 "$SPHINX --version 2>&1 \
962| sed 's/.sphinx-build-real/sphinx-build/g'"))))
963 ;; The build system invokes Cabal and GHC, which do not work with
964 ;; GHC_PACKAGE_PATH: <https://github.com/haskell/cabal/issues/3728>.
965 ;; Tweak the build system to do roughly what haskell-build-system does.
966 (add-before 'configure 'configure-haskell
967 (lambda* (#:key system inputs outputs #:allow-other-keys)
968 ((assoc-ref haskell:%standard-phases 'setup-compiler)
969 #:system system
970 ;; The phase expects the GHC input to be named "haskell".
971 ;; TODO(haskell-team): Both this and the next phase can be
972 ;; removed when #10184 is merged.
973 #:inputs `(("haskell" . ,(assoc-ref inputs "ghc")) ,@inputs)
974 #:outputs outputs)))
975 (add-after 'configure 'do-not-use-GHC_PACKAGE_PATH
976 (lambda _
977 ;; The temporary package database populated by the
978 ;; 'configure-haskell' phase above.
979 (let ((package-db (string-append (or (getenv "TMP") "/tmp")
980 "/package.conf.d")))
981 (unsetenv "GHC_PACKAGE_PATH")
982 (substitute* "Makefile"
983 ;; Patch Cabal and GHC invocations to include -package-db.
984 (("^CABAL_SETUP = runhaskell")
985 (string-append "CABAL_SETUP = runhaskell -package-db="
986 package-db))
987 (("\\$\\(CABAL_SETUP\\) configure")
988 (string-append "$(CABAL_SETUP) configure --package-db="
989 package-db))
990 (("\\$\\(GHC\\)")
991 (string-append "$(GHC) -package-db=" package-db))))))
992 (add-after 'configure 'make-ghc-use-shared-libraries
993 (lambda _
994 (substitute* "Makefile"
995 (("HFLAGS =") "HFLAGS = -dynamic -fPIC"))))
996 (add-after 'configure 'fix-installation-directories
997 (lambda _
998 (substitute* "Makefile"
999 ;; Do not attempt to create /var during install.
1000 (("\\$\\(DESTDIR\\)\\$\\{localstatedir\\}")
1001 "$(DESTDIR)${prefix}${localstatedir}")
1002 ;; Similarly, do not attempt to install the sample ifup scripts
1003 ;; to /etc/ganeti.
1004 (("\\$\\(DESTDIR\\)\\$\\(ifupdir\\)")
1005 "$(DESTDIR)${prefix}$(ifupdir)"))))
1006 (add-before 'build 'adjust-tests
1007 (lambda _
1008 ;; Disable tests that can not run. Do it early to prevent
1009 ;; touching the Makefile later and triggering a needless rebuild.
1010 (substitute* "Makefile"
1011 ;; These tests expect the presence of a 'root' user (via
1012 ;; ganeti/runtime.py), which fails in the build environment.
1013 (("test/py/legacy/ganeti\\.asyncnotifier_unittest\\.py") "")
1014 (("test/py/legacy/ganeti\\.backend_unittest\\.py") "")
1015 (("test/py/legacy/ganeti\\.backend_unittest-runasroot\\.py") "")
1016 (("test/py/legacy/ganeti\\.daemon_unittest\\.py") "")
1017 (("test/py/legacy/ganeti\\.hypervisor\\.hv_kvm_unittest\\.py") "")
1018 (("test/py/legacy/ganeti\\.tools\\.ensure_dirs_unittest\\.py") "")
1019 (("test/py/legacy/ganeti\\.utils\\.io_unittest-runasroot\\.py") "")
1020 ;; Disable the bash_completion test, as it requires the full
1021 ;; bash instead of bash-minimal.
1022 (("test/py/legacy/bash_completion\\.bash")
1023 "")
1024 ;; XXX: Unclear why this test fails.
1025 ;; Generating hspace simulation data for hinfo and hbal...
1026 ;; FAIL to build test files
1027 (("test/hs/offline-test\\.sh")
1028 ""))))
1029 (add-after 'build 'build-bash-completions
1030 (lambda _
1031 (setenv "PYTHONPATH" ".")
1032 (invoke "./autotools/build-bash-completion")
1033 (unsetenv "PYTHONPATH")))
1034 (add-before 'check 'pre-check
1035 (lambda* (#:key inputs #:allow-other-keys)
1036 ;; Set TZDIR so that time zones are found.
1037 (setenv "TZDIR" (search-input-directory inputs "share/zoneinfo"))
1038
1039 (substitute* "test/py/legacy/ganeti.utils.process_unittest.py"
1040 ;; This test attempts to run an executable with
1041 ;; RunCmd(..., reset_env=True), which fails because the default
1042 ;; PATH from Constants.hs does not exist in the build container.
1043 ((".*def testResetEnv.*" all)
1044 (string-append " @unittest.skipIf(True, "
1045 "\"cannot reset env in the build container\")\n"
1046 all))
1047
1048 ;; XXX: Somehow this test fails in the build container, but
1049 ;; works in 'guix environment -C', even without /bin/sh?
1050 ((".*def testPidFile.*" all)
1051 (string-append " @unittest.skipIf(True, "
1052 "\"testPidFile fails in the build container\")\n"
1053 all)))
1054
1055 (substitute* "test/py/legacy/ganeti.hooks_unittest.py"
1056 ;; Similarly, hooks are run with RunParts(..., reset_env=True)
1057 ;; which makes this tests unable to resolve "sh".
1058 ((" \"\"\"Test environment execution\"\"\"" all)
1059 (string-append all "\n raise unittest.SkipTest"
1060 "(\"cannot reset env in the build container\")")))
1061
1062 ;; XXX: Why are these links not added automatically.
1063 (with-directory-excursion "test/hs"
1064 (for-each (cut symlink "../../src/htools" <>)
1065 '("hspace" "hscan" "hinfo" "hbal" "hroller"
1066 "hcheck" "hail" "hsqueeze")))))
1067 (add-after 'install 'install-bash-completions
1068 (lambda _
1069 (let ((compdir (string-append #$output "/etc/bash_completion.d")))
1070 (mkdir-p compdir)
1071 (copy-file "doc/examples/bash_completion"
1072 (string-append compdir "/ganeti"))
1073 ;; The one file contains completions for many different
1074 ;; executables. Create symlinks for found completions.
1075 (with-directory-excursion compdir
1076 (for-each
1077 (lambda (prog) (symlink "ganeti" prog))
1078 (call-with-input-file "ganeti"
1079 (lambda (port)
1080 (let loop ((line (read-line port))
1081 (progs '()))
1082 (if (eof-object? line)
1083 progs
1084 (if (string-prefix? "complete" line)
1085 (loop (read-line port)
1086 ;; Extract "prog" from lines of the form:
1087 ;; "complete -F _prog -o filenames prog".
1088 ;; Note that 'burnin' is listed with the
1089 ;; absolute file name, which is why we
1090 ;; run everything through 'basename'.
1091 (match (string-split line #\ )
1092 ((commands ... prog)
1093 (cons (basename prog) progs))))
1094 (loop (read-line port) progs)))))))))))
1095 (add-after 'install 'wrap
1096 (lambda* (#:key inputs outputs #:allow-other-keys)
1097 (let* ((out (assoc-ref outputs "out"))
1098 (sbin (string-append out "/sbin"))
1099 (lib (string-append out "/lib"))
1100 (PYTHONPATH (string-append (site-packages inputs outputs)
1101 ":" (getenv "GUIX_PYTHONPATH"))))
1102 (define (shell-script? file)
1103 (call-with-ascii-input-file file
1104 (lambda (port)
1105 (let ((shebang (false-if-exception (read-line port))))
1106 (and shebang
1107 (string-prefix? "#!" shebang)
1108 (or (string-contains shebang "/bin/bash")
1109 (string-contains shebang "/bin/sh")))))))
1110
1111 (define* (wrap? file #:rest _)
1112 ;; Do not wrap shell scripts because some are meant to be
1113 ;; sourced, which breaks if they are wrapped. We do wrap
1114 ;; the Haskell executables because some call out to Python
1115 ;; directly.
1116 (and (executable-file? file)
1117 (not (symbolic-link? file))
1118 (not (shell-script? file))))
1119
1120 (for-each (cut wrap-program <>
1121 `("GUIX_PYTHONPATH" ":" prefix
1122 (,PYTHONPATH)))
1123 (append-map (cut find-files <> wrap?)
1124 (list (string-append lib "/ganeti")
1125 sbin)))))))))
1126 (native-inputs
1127 (list ghc
1128 cabal-install
1129 m4
1130 autoconf
1131 automake
1132
1133 ;; For the documentation.
1134 python-docutils
1135 python-sphinx
1136 pandoc
1137 graphviz
1138
1139 ;; Test dependencies.
1140 fakeroot
1141 ghc-temporary
1142 ghc-test-framework
1143 ghc-test-framework-hunit
1144 ghc-test-framework-quickcheck2
1145 python-pytest
1146 python-pyyaml
1147 openssh
1148 procps
1149 shelltestrunner
1150 tzdata-for-tests))
1151 (inputs
1152 (list bash-minimal
1153 iputils ;for 'arping'
1154 curl
1155 fping
1156 iproute
1157 ndisc6
1158 socat
1159 qemu-minimal ;for qemu-img
1160 ghc-attoparsec
1161 ghc-base64-bytestring
1162 ghc-case-insensitive
1163 ghc-cryptonite
1164 ghc-curl
1165 ghc-hinotify
1166 ghc-hslogger
1167 ghc-json
1168 ghc-lens
1169 ghc-lifted-base
1170 ghc-monad-control
1171 ghc-network
1172 ghc-old-time
1173 ghc-parallel
1174 ghc-psqueue
1175 ghc-regex-pcre
1176 ghc-random
1177 ghc-transformers-base
1178 ghc-utf8-string
1179 ghc-zlib
1180 ;; For the optional metadata daemon.
1181 ghc-snap-core
1182 ghc-snap-server
1183 python
1184 python-pyopenssl
1185 python-simplejson
1186 python-pyparsing
1187 python-pyinotify
1188 python-pycurl
1189 python-bitarray-2
1190 python-paramiko
1191 python-psutil))
1192 (home-page "https://www.ganeti.org/")
1193 (synopsis "Cluster-based virtual machine management system")
1194 (description
1195 "Ganeti is a virtual machine management tool built on top of existing
1196virtualization technologies such as Xen or KVM. Ganeti controls:
1197
1198@itemize @bullet
1199@item Disk creation management;
1200@item Operating system installation for instances (in co-operation with
1201OS-specific install scripts); and
1202@item Startup, shutdown, and failover between physical systems.
1203@end itemize
1204
1205Ganeti is designed to facilitate cluster management of virtual servers and
1206to provide fast and simple recovery after physical failures, using
1207commodity hardware.")
1208 (license license:bsd-2)))
1209
1210(define-public ganeti-instance-guix
1211 (package
1212 (name "ganeti-instance-guix")
1213 (version "0.8")
1214 (home-page "https://github.com/mbakke/ganeti-instance-guix")
1215 (source (origin
1216 (method git-fetch)
1217 (uri (git-reference (url home-page) (commit version)))
1218 (file-name (git-file-name name version))
1219 (sha256
1220 (base32
1221 "0sw9ks3j3y33apdcghjxxjf09ld592z9skaa7bgn9d2lhplzjihr"))))
1222 (build-system gnu-build-system)
1223 (arguments
1224 '(#:configure-flags '("--sysconfdir=/etc" "--localstatedir=/var")))
1225 (native-inputs
1226 (list autoconf automake jq))
1227 (inputs
1228 (list btrfs-progs
1229 cryptsetup-minimal
1230 e2fsprogs
1231 f2fs-tools
1232 lvm2
1233 multipath-tools
1234 util-linux
1235 parted
1236 xfsprogs))
1237 (synopsis "Guix OS integration for Ganeti")
1238 (description
1239 "This package provides a guest OS definition for Ganeti that uses
1240Guix to build virtual machines.")
1241 (license license:gpl3+)))
1242
1243(define-public ganeti-instance-debootstrap
1244 (package
1245 (name "ganeti-instance-debootstrap")
1246 ;; We need two commits on top of the latest release for compatibility
1247 ;; with newer sfdisk, as well as gnt-network integration.
1248 (version "0.16-2-ge145396")
1249 (home-page "https://github.com/ganeti/instance-debootstrap")
1250 (source (origin
1251 (method git-fetch)
1252 (uri (git-reference (url home-page) (commit version)))
1253 (file-name (git-file-name name version))
1254 (sha256
1255 (base32
1256 "0f2isw9d8lawzj21rrq1q9xhq8xfa65rqbhqmrn59z201x9q1336"))))
1257 (build-system gnu-build-system)
1258 (arguments
1259 '(#:configure-flags '("--sysconfdir=/etc" "--localstatedir=/var")
1260 #:phases (modify-phases %standard-phases
1261 (add-after 'unpack 'add-absolute-references
1262 (lambda _
1263 (substitute* "common.sh.in"
1264 (("/sbin/blkid") (which "blkid"))
1265 (("kpartx -")
1266 (string-append (which "kpartx") " -")))
1267 (substitute* "import"
1268 (("restore -r")
1269 (string-append (which "restore") " -r")))
1270 (substitute* "export"
1271 (("dump -0")
1272 (string-append (which "dump") " -0")))
1273 (substitute* "create"
1274 (("debootstrap") (which "debootstrap"))
1275 (("`which run-parts`") (which "run-parts"))
1276 ;; Here we actually need to hard code /bin/passwd
1277 ;; because it's called via chroot, which fails if
1278 ;; "/bin" is not in PATH.
1279 (("passwd") "/bin/passwd"))
1280 #t))
1281 (add-after 'unpack 'set-dpkg-arch
1282 (lambda* (#:key system #:allow-other-keys)
1283 ;; The create script passes --arch to debootstrap,
1284 ;; and defaults to `dpkg --print-architecture` when
1285 ;; ARCH is not set in variant.conf. Hard code the
1286 ;; build-time architecture to avoid the dpkg dependency.
1287 (let ((dpkg-arch
1288 (cond ((string-prefix? "x86_64" system)
1289 "amd64")
1290 ((string-prefix? "i686" system)
1291 "i386")
1292 ((string-prefix? "aarch64" system)
1293 "arm64")
1294 (else (car (string-split system #\-))))))
1295 (substitute* "create"
1296 (("`dpkg --print-architecture`")
1297 dpkg-arch))
1298 #t)))
1299 (add-after 'configure 'adjust-Makefile
1300 (lambda _
1301 ;; Do not attempt to create /etc/ganeti/instance-debootstrap
1302 ;; and /etc/default/ganeti-instance-debootstrap during install.
1303 ;; They are created by the Ganeti service.
1304 (substitute* "Makefile"
1305 (("\\$\\(variantsdir\\)")
1306 "$(prefix)/etc/ganeti/instance-debootstrap/variants")
1307 (("\\$\\(defaultsdir\\)")
1308 "$(prefix)/etc/default/ganeti-instance-debootstrap"))
1309 #t))
1310 (add-after 'install 'make-variants.list-symlink
1311 (lambda* (#:key outputs #:allow-other-keys)
1312 ;; The Ganeti OS API mandates a variants.list file that
1313 ;; describes all supported "variants" of this OS.
1314 ;; Guix generates this file, so make the original file
1315 ;; a symlink to it.
1316 (with-directory-excursion (string-append
1317 (assoc-ref outputs "out")
1318 "/share/ganeti/os/debootstrap")
1319 (delete-file "variants.list")
1320 (symlink "/etc/ganeti/instance-debootstrap/variants/variants.list"
1321 "variants.list"))
1322 #t)))))
1323 (native-inputs
1324 (list autoconf automake))
1325 (inputs
1326 `(("debianutils" ,debianutils)
1327 ("debootstrap" ,debootstrap)
1328 ("dump" ,dump)
1329 ("kpartx" ,multipath-tools)
1330 ("util-linux" ,util-linux)))
1331 (synopsis "Debian OS integration for Ganeti")
1332 (description
1333 "This package provides a guest OS definition for Ganeti. It installs
1334Debian or a derivative using @command{debootstrap}.")
1335 (license license:gpl2+)))
1336
1337(define-public rvvm
1338 (package
1339 (name "rvvm")
1340 (version "0.6")
1341 (source (origin
1342 (method git-fetch)
1343 (uri (git-reference
1344 (url "https://github.com/LekKit/RVVM")
1345 (commit (string-append "v" version))))
1346 (file-name (git-file-name name version))
1347 (sha256
1348 (base32
1349 "1mbb1c9r33am2z27a17xkjw5gpzvz41wywx1g021s0w34lmsax76"))))
1350 (build-system cmake-build-system)
1351 (arguments
1352 (list
1353 #:configure-flags
1354 ;; See src/rvjit/rvjit.h for list of architectures.
1355 #~(#$@(if (or (target-x86?)
1356 (target-arm?))
1357 #~'()
1358 #~(list "-DRVVM_USE_JIT=NO")))
1359 #:modules `((srfi srfi-26)
1360 (guix build utils)
1361 (guix build cmake-build-system))
1362 #:phases
1363 #~(modify-phases %standard-phases
1364 ;; Install phase inspired by the Makefile.
1365 (replace 'install
1366 (lambda _
1367 (let ((src "../source/src/")
1368 (incl (string-append #$output "/include/rvvm/")))
1369 (install-file "rvvm" (string-append #$output "/bin"))
1370 (for-each
1371 (cut install-file <> (string-append #$output "/lib"))
1372 (find-files "." "\\.(so|a)$"))
1373 (install-file (string-append src "rvvmlib.h") incl)
1374 (for-each
1375 (cut install-file <> (string-append incl "devices"))
1376 (find-files (string-append src "devices") "\\.h$"))))))
1377 #:tests? #f)) ; no tests
1378 (home-page "https://github.com/LekKit/RVVM")
1379 (synopsis "RISC-V virtual machine")
1380 (description
1381 "RVVM is a RISC-V CPU and system software implementation written in C. It
1382supports the entire RV64GC ISA, and it passes compliance tests for both RV64 and
1383RV32. OpenSBI, U-Boot, and custom firmwares boot and execute properly. It is
1384capable of running Linux, FreeBSD, OpenBSD, Haiku, and other OSes. Furthermore,
1385it emulates a variety of hardware and peripherals.")
1386 (license (list license:gpl3+ license:mpl2.0))))
1387
1388(define-public spike
1389 ;; Last 1.1.0 tag in 2021.
1390 (let ((commit "262df8bfac33b0419688429dd066487744db5c79")
1391 (revision "1"))
1392 (package
1393 (name "spike")
1394 (version (git-version "1.1.0" revision commit))
1395 (source
1396 (origin
1397 (method git-fetch)
1398 (uri (git-reference
1399 (url "https://github.com/riscv-software-src/riscv-isa-sim")
1400 (commit commit)))
1401 (file-name (git-file-name name version))
1402 (sha256
1403 (base32 "1dyvkidksp0mj6vp8bn1gyzdcpay4m8x653axaivk38q4jyz2qkh"))))
1404 (build-system gnu-build-system)
1405 (arguments
1406 (list
1407 #:phases
1408 #~(modify-phases %standard-phases
1409 (add-before 'configure 'configure-dtc-path
1410 (lambda* (#:key inputs #:allow-other-keys)
1411 ;; Reference dtc by its absolute store path.
1412 (substitute* "riscv/dts.cc"
1413 (("DTC")
1414 (string-append "\"" (search-input-file inputs "/bin/dtc")
1415 "\""))))))))
1416 (inputs
1417 (list dtc))
1418 (native-inputs
1419 (list python-minimal-wrapper))
1420 (home-page "https://github.com/riscv-software-src/riscv-isa-sim")
1421 (synopsis "RISC-V ISA Simulator")
1422 (description "Spike, the RISC-V ISA Simulator, implements a functional model
1423of one or more RISC-V harts.")
1424 (license license:bsd-3))))
1425
1426(define-public swtpm
1427 (package
1428 (name "swtpm")
1429 ;; When updating this package, please make sure that the path patching logic
1430 ;; below is still functional.
1431 (version "0.10.1")
1432 (source
1433 (origin
1434 (method git-fetch)
1435 (uri (git-reference
1436 (url "https://github.com/stefanberger/swtpm")
1437 (commit (string-append "v" version))))
1438 (file-name (git-file-name name version))
1439 (sha256
1440 (base32 "0wah3zsnkasccazzlycq8scc52q4h1g58w0br45sr185inw6zgrp"))
1441 (snippet
1442 #~(begin
1443 ;; Do not attempt to install /var.
1444 (use-modules (guix build utils))
1445 (substitute* "samples/Makefile.am"
1446 (("install-data-local")
1447 "install-data-local-DISABLED"))))))
1448 (build-system gnu-build-system)
1449 (arguments
1450 (list
1451 ;; Most tests require networking, at least loopback.
1452 #:make-flags
1453 #~(let ((tests '("test_ctrlchannel4"
1454 "test_parameters"
1455 "test_print_capabilities"
1456 "test_swtpm_cert"
1457 "test_swtpm_setup_create_cert"
1458 "test_swtpm_setup_file_backend"
1459 "test_swtpm_setup_misc"
1460 "test_swtpm_setup_overwrite"
1461 "test_tpm2_parameters"
1462 "test_tpm2_print_capabilities"
1463 "test_tpm2_swtpm_cert"
1464 "test_tpm2_swtpm_cert_ecc"
1465 "test_tpm2_swtpm_localca"
1466 "test_tpm2_swtpm_setup_create_cert"
1467 "test_tpm2_swtpm_setup_overwrite")))
1468 (list (string-append "TESTS=" (string-join tests " "))))
1469 #:configure-flags
1470 #~'("--localstatedir=/var")
1471 #:phases
1472 #~(modify-phases %standard-phases
1473 (add-after 'unpack 'fix-program-references
1474 (lambda* (#:key inputs #:allow-other-keys)
1475 (substitute* "tests/common"
1476 (("CERTTOOL=certtool")
1477 (string-append "CERTTOOL="
1478 (search-input-file inputs "bin/certtool"))))
1479 (substitute* "src/swtpm_localca/swtpm_localca.c"
1480 (("CERTTOOL_NAME \"certtool\"")
1481 (string-append "CERTTOOL_NAME \""
1482 (search-input-file inputs "bin/certtool") "\""))
1483 (("g_find_program_in_path\\(\"swtpm_cert\"}\\)")
1484 (string-append "strdup(\""
1485 #$output "/bin/swtpm_cert"
1486 "\")")))
1487 (substitute* "src/swtpm_setup/swtpm_setup.c"
1488 (("g_find_program_in_path\\(\"swtpm\"\\)")
1489 (string-append "strdup(\""
1490 #$output "/bin/swtpm"
1491 "\")")))))
1492 ;; The swtpm tools reference themselves,
1493 ;; and #$output only exists after installation.
1494 (delete 'check)
1495 (add-after 'install 'check
1496 (assoc-ref %standard-phases 'check)))))
1497 (inputs (list ;; can be removed once the following is released:
1498 ;; https://github.com/stefanberger/swtpm/pull/1119
1499 gnutls
1500 gmp
1501 openssl
1502 json-glib
1503 libseccomp
1504 libselinux
1505 libtasn1
1506 libtool
1507 libtpms))
1508 (native-inputs (list autoconf
1509 automake
1510 bash-minimal
1511 expect
1512 iproute
1513 net-tools
1514 socat
1515 perl
1516 pkg-config
1517 python))
1518 (home-page "https://github.com/stefanberger/swtpm")
1519 (synopsis "TPM emulator")
1520 (description
1521 "swtpm provides a TPM emulator with socket, character device,
1522and CUSE interface. It can be combined with qemu & libvirt to expose TPM
1523functionality to virtual machines.")
1524 (license license:bsd-3)))
1525
1526(define-public incus
1527 (package
1528 (name "incus")
1529 (version "6.15.0")
1530 (source
1531 (origin
1532 (method git-fetch)
1533 (uri (git-reference
1534 (url "https://github.com/lxc/incus")
1535 (commit (string-append "v" version))))
1536 (file-name (git-file-name name version))
1537 (sha256
1538 (base32 "1j6lfx4jw6ngb2d3d48qz8q51w8x1j5vyjyhssppwd83ydkh060y"))))
1539 (build-system go-build-system)
1540 (arguments
1541 (list
1542 #:install-source? #f
1543 #:tests? #f ;TODO: tests require some set up.
1544 #:import-path "github.com/lxc/incus/v6"
1545 #:embed-files
1546 #~(list "children"
1547 "form_post.html.tmpl"
1548 "nodes"
1549 "text")
1550 #:test-flags
1551 #~(list "-tags" "libsqlite3")
1552 #:phases
1553 #~(modify-phases %standard-phases
1554 (add-after 'unpack 'fix-module-path
1555 ;; go-github-com-ovn-kubernetes-libovsdb is a successor of
1556 ;; go-github-com-ovn-org-libovsdb.
1557 (lambda* (#:key import-path #:allow-other-keys)
1558 (with-directory-excursion (string-append "src/" import-path)
1559 (substitute* (find-files "." "\\.go$")
1560 (("github.com/ovn-org/libovsdb")
1561 "github.com/ovn-kubernetes/libovsdb")))))
1562 (replace 'build
1563 (lambda* (#:key import-path #:allow-other-keys)
1564 (with-directory-excursion (string-append "src/" import-path)
1565 (invoke "make" "build"
1566 (string-append "CC=" #$(cc-for-target))
1567 "TAG_SQLITE3=libsqlite3")))))))
1568 ;; TODO:
1569 ;; - Check and wrap runtime dependencies.
1570 ;; - Build documentation.
1571 ;; - Write shepherd service.
1572 (native-inputs
1573 (list go-github-com-adhocore-gronx
1574 go-github-com-apex-log
1575 go-github-com-armon-go-proxyproto
1576 go-github-com-cenkalti-backoff-v4
1577 go-github-com-checkpoint-restore-go-criu-v6
1578 go-github-com-cowsql-go-cowsql
1579 go-github-com-digitalocean-go-smbios
1580 go-github-com-dustinkirkland-golang-petname
1581 go-github-com-flosch-pongo2-v6
1582 go-github-com-fvbommel-sortorder
1583 go-github-com-go-chi-chi-v5
1584 go-github-com-go-jose-go-jose-v4
1585 go-github-com-go-logr-logr
1586 go-github-com-golang-jwt-jwt-v5
1587 go-github-com-google-gopacket
1588 go-github-com-google-uuid
1589 go-github-com-gorilla-mux
1590 go-github-com-gorilla-websocket
1591 go-github-com-gosexy-gettext
1592 go-github-com-insomniacslk-dhcp
1593 go-github-com-jaypipes-pcidb
1594 go-github-com-jochenvg-go-udev
1595 go-github-com-kballard-go-shellquote
1596 go-github-com-linbit-golinstor
1597 go-github-com-lxc-go-lxc
1598 go-github-com-mattn-go-colorable
1599 go-github-com-mattn-go-sqlite3
1600 go-github-com-mdlayher-arp
1601 go-github-com-mdlayher-ndp
1602 go-github-com-mdlayher-netx
1603 go-github-com-mdlayher-vsock
1604 go-github-com-miekg-dns
1605 go-github-com-minio-minio-go-v7
1606 go-github-com-mitchellh-mapstructure
1607 go-github-com-olekukonko-tablewriter
1608 go-github-com-opencontainers-runtime-spec
1609 go-github-com-opencontainers-umoci
1610 go-github-com-openfga-go-sdk
1611 go-github-com-osrg-gobgp-v3
1612 go-github-com-ovn-kubernetes-libovsdb
1613 go-github-com-pierrec-lz4-v4
1614 go-github-com-pkg-sftp
1615 go-github-com-pkg-xattr
1616 go-github-com-sirupsen-logrus
1617 go-github-com-spf13-cobra
1618 go-github-com-spf13-pflag
1619 go-github-com-stretchr-testify
1620 go-github-com-vishvananda-netlink
1621 go-github-com-zitadel-oidc-v3
1622 go-go-starlark-net
1623 go-golang-org-x-crypto
1624 go-golang-org-x-exp
1625 go-golang-org-x-oauth2
1626 go-golang-org-x-sync
1627 go-golang-org-x-sys
1628 go-golang-org-x-term
1629 go-golang-org-x-text
1630 go-golang-org-x-tools
1631 go-google-golang-org-protobuf
1632 go-gopkg-in-yaml-v2
1633 go-k8s-io-utils
1634 pkg-config))
1635 (inputs
1636 (list acl
1637 cowsql
1638 dbus
1639 eudev
1640 libcap
1641 libdqlite
1642 libseccomp
1643 libselinux
1644 lxc))
1645 (home-page "https://github.com/lxc/incus")
1646 (synopsis "System container and virtual machine manager")
1647 (description
1648 "Incus is a modern, secure and powerful system container and virtual
1649machine manager.
1650
1651It provides a unified experience for running and managing full Linux systems
1652inside containers or virtual machines. Incus supports images for a large
1653number of Linux distributions (official Ubuntu images and images provided by
1654the community) and is built around a very powerful, yet pretty simple, REST
1655API. Incus scales from one instance on a single machine to a cluster in a
1656full data center rack, making it suitable for running workloads both for
1657development and in production.
1658
1659This package provides the following commands:
1660@itemize
1661@item fuidshift - tool to remap a filesystem tree, switching it from one set
1662of UID/GID ranges to another
1663@item generate-config - tool to generate documentation for Incus
1664@item generate-database - entry point for all @code{go:generate} directives
1665used in Incus' source code
1666@item incus - command line client for Incus
1667@item incus-agent - Incus virtual machine agent
1668@item incus-benchmark - tool to benchmark various actions on a local Incus
1669daemon
1670@item incusd - the Incus daemon
1671@item incus-migrate - physical to instance migration tool
1672@item incus-simplestreams - tool to manage the files on a static image server
1673using simplestreams index files as the publishing mechanism
1674@item incus-user - Incus user project daemon
1675@item lxc-to-incus - CLI client for container migration
1676@item lxd-to-incus - LXD to Incus migration tool
1677@item mini-oidc
1678@item sysinfo - basic system stats tool
1679@item tls2jwt - TLS to JWT certificate converter, reference/testing tool
1680@end itemize")
1681 (license license:asl2.0)))
1682
1683(define-public libosinfo
1684 (package
1685 (name "libosinfo")
1686 (version "1.12.0")
1687 (source
1688 (origin
1689 (method url-fetch)
1690 (uri (string-append "https://releases.pagure.org/libosinfo/libosinfo-"
1691 version ".tar.xz"))
1692 (sha256
1693 (base32
1694 "1dn6pzv0gzkxrjvi60cdzdmyxqlcsvinbrbds91xm4v7wbn5g1dd"))
1695 (patches (search-patches "libosinfo-libxml2-fix.patch"))))
1696 (build-system meson-build-system)
1697 (arguments
1698 (list
1699 #:configure-flags
1700 #~(list (string-append "-Dwith-usb-ids-path="
1701 (search-input-file %build-inputs
1702 "share/hwdata/usb.ids"))
1703 (string-append "-Dwith-pci-ids-path="
1704 (search-input-file %build-inputs
1705 "share/hwdata/pci.ids")))
1706 #:phases
1707 #~(modify-phases %standard-phases
1708 (add-after 'unpack 'patch-osinfo-path
1709 (lambda* (#:key native-inputs inputs #:allow-other-keys)
1710 (substitute* "osinfo/osinfo_loader.c"
1711 (("path = DATA_DIR.*")
1712 (format #f "path = ~s;"
1713 (search-input-directory (or native-inputs inputs)
1714 "share/osinfo")))))))))
1715 (inputs (list libsoup libxml2 libxslt osinfo-db))
1716 (native-inputs
1717 (list `(,glib "bin") ;glib-mkenums, etc.
1718 gobject-introspection
1719 gtk-doc/stable
1720 hwdata
1721 vala
1722 intltool
1723 pkg-config))
1724 (native-search-paths
1725 (list (search-path-specification
1726 (variable "OSINFO_SYSTEM_DIR")
1727 (separator #f) ;single entry
1728 (files '("share/osinfo")))))
1729 (home-page "https://libosinfo.org/")
1730 (synopsis "Operating system information database")
1731 (description "libosinfo is a GObject based library API for managing
1732information about operating systems, hypervisors and the (virtual) hardware
1733devices they can support. It includes a database containing device metadata
1734and provides APIs to match/identify optimal devices for deploying an operating
1735system on a hypervisor. Via GObject Introspection, the API is available in
1736all common programming languages. Vala bindings are also provided.")
1737 ;; The library files are released under LGPLv2.1 or later; the source
1738 ;; files in the "tools" directory are released under GPLv2+.
1739 (license (list license:lgpl2.1+ license:gpl2+))))
1740
1741(define-public lxc
1742 (package
1743 (name "lxc")
1744 (version "6.0.1")
1745 (source (origin
1746 (method url-fetch)
1747 (uri (string-append
1748 "https://linuxcontainers.org/downloads/lxc/lxc-"
1749 version ".tar.gz"))
1750 (sha256
1751 (base32
1752 "1q3p3zzm338pmc97z6ly8cjginkyljxqbk1c37l2xa46vfy8zcyc"))
1753 (patches (search-patches "lxc-no-static-bin.patch"))))
1754 (build-system meson-build-system)
1755 (native-inputs
1756 (list pkg-config docbook2x))
1757 (inputs
1758 (list apparmor dbus gnutls libcap libseccomp libselinux))
1759 (arguments
1760 (list #:configure-flags
1761 #~(list (string-append "-Ddoc-path=" #$output "/share/doc/"
1762 #$name "-" #$version)
1763 "-Ddistrosysconfdir=/etc"
1764 "-Dinit-script=sysvinit"
1765 "-Dinstall-state-dirs=false"
1766 "-Dinstall-init-files=false"
1767 "-Dspecfile=false"
1768 "-Db_lto=false")))
1769 (synopsis "Linux container tools")
1770 (home-page "https://linuxcontainers.org/")
1771 (description
1772 "LXC is a userspace interface for the Linux kernel containment features.
1773Through a powerful API and simple tools, it lets Linux users easily create and
1774manage system or application containers.")
1775 (license license:lgpl2.1+)))
1776
1777(define-public lxcfs
1778 (package
1779 (name "lxcfs")
1780 (version "5.0.4")
1781 (home-page "https://github.com/lxc/lxcfs")
1782 (source
1783 (origin
1784 (method git-fetch)
1785 (uri (git-reference (url home-page)
1786 (commit (string-append "lxcfs-" version))))
1787 (file-name (git-file-name name version))
1788 (sha256
1789 (base32 "15cc7kvnln4qqlv22hprfzmq89jbkx7yra730hap8wkvamn33sxy"))))
1790 (build-system meson-build-system)
1791 (arguments
1792 (list
1793 #:configure-flags
1794 #~(list "-Dinit-script=sysvinit"))) ; no ‘none’ option
1795 (native-inputs
1796 (list help2man pkg-config python python-jinja2))
1797 (inputs
1798 (list fuse))
1799 (synopsis "FUSE-based file system for LXC")
1800 (description "LXCFS is a small FUSE file system written with the intention
1801of making Linux containers feel more like a virtual machine.
1802It started as a side project of LXC but can be used by any run-time.")
1803 (license license:lgpl2.1+)))
1804
1805(define-public libvirt
1806 (package
1807 (name "libvirt")
1808 (version "11.5.0")
1809 (source
1810 (origin
1811 (method url-fetch)
1812 (uri (string-append "https://libvirt.org/sources/libvirt-"
1813 version ".tar.xz"))
1814 (sha256
1815 (base32 "08r4sxchhh639a8h346795971zz615j86v9z9vxf5q9q0pbbjqrb"))
1816 (patches (search-patches "libvirt-add-install-prefix.patch"
1817 "libvirt-respect-modules-path.patch"))))
1818 (build-system meson-build-system)
1819 (arguments
1820 (list
1821 #:modules '((guix build meson-build-system)
1822 (guix build utils)
1823 (ice-9 format))
1824 #:configure-flags
1825 #~(list "-Ddriver_qemu=enabled"
1826 "-Dqemu_user=nobody"
1827 "-Dqemu_group=kvm"
1828 "-Dstorage_disk=enabled"
1829 "-Dstorage_dir=enabled"
1830 "-Dpolkit=enabled"
1831 ;; XXX The default, but required to make -Dsasl ‘stick’.
1832 ;; See <https://gitlab.com/libvirt/libvirt/-/issues/185>
1833 "-Ddriver_remote=enabled"
1834 "-Dnls=enabled" ;translations
1835 (string-append "-Ddocdir=" #$output "/share/doc/"
1836 #$(package-name this-package) "-"
1837 #$(package-version this-package))
1838 "-Dbash_completion=enabled"
1839 (string-append "-Dinstall_prefix=" #$output)
1840 "--sysconfdir=/etc"
1841 "--localstatedir=/var")
1842 #:phases
1843 #~(modify-phases %standard-phases
1844 (add-after 'unpack 'skip-directory-confusion
1845 (lambda _
1846 ;; Don't try to install an (unused) /var outside of the store.
1847 (substitute* "scripts/meson-install-dirs.py"
1848 (("destdir = .*")
1849 "destdir = '/tmp'"))))
1850 (add-after 'unpack 'patch-commands
1851 (lambda* (#:key inputs #:allow-other-keys)
1852 (let-syntax
1853 ((patch-command-define
1854 ;; Patch lines of the form: #define COMMAND "command"
1855 (lambda (x)
1856 (syntax-case x ()
1857 ((_ file command)
1858 (with-syntax ((pattern (datum->syntax x 'pattern)))
1859 #'(let ((pattern
1860 (format #f "(#define ~:@(~a~) )\"~a\""
1861 command command)))
1862 (substitute* file
1863 ((pattern dummy head)
1864 (format
1865 #f "~a~s" head
1866 (search-input-file
1867 inputs (string-append "sbin/"
1868 command))))))))))))
1869 (with-directory-excursion "src/util"
1870 (patch-command-define "virdnsmasq.c" "dnsmasq")
1871 (patch-command-define "virfirewall.h" "ebtables")
1872 (patch-command-define "virfirewall.h" "iptables")
1873 (patch-command-define "virfirewall.h" "ip6tables")
1874 (patch-command-define "virfirewall.h" "nft")))))
1875 (add-before 'configure 'disable-broken-tests
1876 (lambda _
1877 (let ((tests (list "commandtest" ; hangs idly
1878 "networkxml2conftest" ; fails with absolute dnsmasq
1879 "qemuxml2argvtest" ; fails
1880 "virnetsockettest"))) ; tries to network
1881 (substitute* "tests/meson.build"
1882 (((format #f ".*'name': '(~a)'.*" (string-join tests "|")))
1883 "")))))
1884 (add-before 'configure 'fix-test-data
1885 (lambda* (#:key inputs #:allow-other-keys)
1886 (substitute* (find-files "tests/qemuvhostuserdata/usr/libexec")
1887 (("^cat") (search-input-file inputs "bin/cat"))))))))
1888 (inputs
1889 (list acl
1890 attr
1891 audit
1892 curl
1893 cyrus-sasl
1894 dbus
1895 dmidecode
1896 dnsmasq
1897 eudev
1898 fuse
1899 gnutls
1900 iproute
1901 iptables
1902 json-c
1903 libnl
1904 libpcap
1905 libpciaccess
1906 libssh2 ;optional
1907 libtirpc ;for <rpc/rpc.h>
1908 libxml2
1909 lvm2 ;for libdevmapper
1910 nftables
1911 openssl
1912 parted
1913 `(,util-linux "lib")
1914 readline
1915 yajl))
1916 (native-inputs
1917 (list bash-completion
1918 gettext-minimal
1919 libxslt
1920 perl
1921 pkg-config
1922 polkit
1923 python-wrapper
1924 python-docutils ;for rst2html
1925 rpcsvc-proto)) ;for rpcgen
1926 (home-page "https://libvirt.org")
1927 (synopsis "Simple API for virtualization")
1928 (description "Libvirt is a C toolkit to interact with the virtualization
1929capabilities of recent versions of Linux. The library aims at providing long
1930term stable C API initially for the Xen paravirtualization but should be able
1931to integrate other virtualization mechanisms if needed.")
1932 (license license:lgpl2.1+)))
1933
1934(define-public libvirt-glib
1935 (package
1936 (name "libvirt-glib")
1937 (version "5.0.0")
1938 (source (origin
1939 (method url-fetch)
1940 (uri (string-append "ftp://libvirt.org/libvirt/glib/"
1941 "libvirt-glib-" version ".tar.xz"))
1942 (sha256
1943 (base32
1944 "12rv5wxa92iigqlb3ncza6m6995j8739nac7bmbs65i4713c7zlv"))))
1945 (build-system meson-build-system)
1946 (inputs
1947 (list openssl cyrus-sasl lvm2 ; for libdevmapper
1948 yajl))
1949 (native-inputs
1950 (list pkg-config intltool
1951 `(,glib "bin") vala))
1952 (propagated-inputs
1953 ;; ‘Required:’ by the installed .pc files.
1954 (list glib libvirt libxml2 gobject-introspection))
1955 (home-page "https://libvirt.org")
1956 (synopsis "GLib wrapper around libvirt")
1957 (description "libvirt-glib wraps the libvirt library to provide a
1958high-level object-oriented API better suited for glib-based applications, via
1959three libraries:
1960
1961@enumerate
1962@item libvirt-glib - GLib main loop integration & misc helper APIs
1963@item libvirt-gconfig - GObjects for manipulating libvirt XML documents
1964@item libvirt-gobject - GObjects for managing libvirt objects
1965@end enumerate
1966")
1967 (license license:lgpl2.1+)))
1968
1969(define-public python-libvirt
1970 (package
1971 (name "python-libvirt")
1972 (version "11.5.0")
1973 (source
1974 (origin
1975 (method url-fetch)
1976 (uri (string-append "https://libvirt.org/sources/python/libvirt-python-"
1977 version ".tar.gz"))
1978 (sha256
1979 (base32 "08xcnzmahmb72rv9cw8dxwnjmrdgmm5j4bbxpwsnhll9qsgdiak9"))))
1980 (build-system pyproject-build-system)
1981 (inputs
1982 (list libvirt))
1983 (propagated-inputs
1984 (list python-lxml))
1985 (native-inputs
1986 (list pkg-config python-pytest python-setuptools python-wheel))
1987 (home-page "https://libvirt.org")
1988 (synopsis "Python bindings to libvirt")
1989 (description "This package provides Python bindings to the libvirt
1990virtualization library.")
1991 (properties
1992 '((upstream-name . "libvirt-python")))
1993 (license license:lgpl2.1+)))
1994
1995(define-public virt-manager
1996 (package
1997 (name "virt-manager")
1998 (version "5.0.0")
1999 (source (origin
2000 (method url-fetch)
2001 (uri (string-append "https://releases.pagure.org/" name
2002 "/" name "-" version ".tar.xz"))
2003 (sha256
2004 (base32
2005 "0jpqhc02ya55rr8bin734znasslwlff42ann9rsvv5y9w13ax2dw"))))
2006 (build-system meson-build-system)
2007 (arguments
2008 (list
2009 #:modules
2010 '((ice-9 match)
2011 (srfi srfi-1)
2012 (srfi srfi-26)
2013 (guix build meson-build-system)
2014 (guix build utils))
2015 #:glib-or-gtk? #t
2016 #:phases
2017 #~(modify-phases %standard-phases
2018 (add-after 'unpack 'set-SOURCE_DIR
2019 (lambda _
2020 (setenv "SOURCE_DIR" (getcwd))))
2021 (add-after 'unpack 'fix-default-uri
2022 (lambda* (#:key inputs #:allow-other-keys)
2023 (substitute* "virtManager/createconn.py"
2024 (("/usr(/bin/qemu-system-\\*)" _ suffix)
2025 (string-append #$(this-package-input "qemu") suffix)))))
2026 (add-before 'glib-or-gtk-wrap 'wrap-more
2027 (lambda* (#:key inputs #:allow-other-keys)
2028 (let* ((paths (filter-map
2029 (match-lambda
2030 ((output . directory)
2031 (let* ((girepodir (string-append
2032 directory
2033 "/lib/girepository-1.0")))
2034 (and (file-exists? girepodir)
2035 girepodir))))
2036 inputs)))
2037 (for-each (lambda (file)
2038 (format #t "wrapping ~a~%" file)
2039 (wrap-program file
2040 `("GI_TYPELIB_PATH" prefix ,paths)
2041 `("GUIX_PYTHONPATH" prefix
2042 ;; FIXME: This wraps too much (see: bug#25235).
2043 (,(getenv "GUIX_PYTHONPATH")))))
2044 (find-files (string-append #$output "/bin"))))))
2045 (replace 'check
2046 (lambda* (#:key tests? #:allow-other-keys)
2047 (with-directory-excursion (getenv "SOURCE_DIR")
2048 (invoke "pytest" "-vvv"
2049 "-k" (string-append
2050 ;; The cdrom_url and CLI0062 tests cause
2051 ;; some crash, also outside the build container.
2052 "not install_cdrom_url and "
2053 "not testCLI0062virt_install and "
2054 ;; These tests fail only inside the
2055 ;; build container, perhaps due to
2056 ;; missing /dev nodes.
2057 "not install_s390x_cdrom and "
2058 "not install_many_devices and "
2059 "not test_disk and "
2060 "not virt_clone"))))))))
2061 (native-inputs
2062 (list cpio
2063 gettext-minimal
2064 `(,glib "bin") ;glib-compile-schemas
2065 gobject-introspection
2066 `(,gtk+ "bin") ;gtk-update-icon-cache
2067 pkg-config
2068 python-docutils ;rst2ma
2069 python-pytest
2070 xorriso))
2071 (inputs
2072 (list bash-minimal
2073 dconf
2074 gtk+
2075 gtk-vnc
2076 gtksourceview-4
2077 libosinfo
2078 libvirt
2079 libvirt-glib
2080 libxml2
2081 python-minimal
2082 python-libvirt
2083 python-pycairo
2084 python-pygobject
2085 python-requests
2086 qemu
2087 spice-gtk
2088 vte/gtk+-3))
2089 (home-page "https://virt-manager.org/")
2090 (synopsis "Manage virtual machines")
2091 (description
2092 "The virt-manager application is a desktop user interface for managing
2093virtual machines through libvirt. It primarily targets KVM VMs, but also
2094manages Xen and LXC (Linux containers). It presents a summary view of running
2095domains, their live performance and resource utilization statistics.")
2096 (license license:gpl2+)))
2097
2098(define-public vmware-open-vm-tools
2099 (package
2100 (name "vmware-open-vm-tools")
2101 (version "13.1.0")
2102 (source
2103 (origin
2104 (method git-fetch)
2105 (uri (git-reference
2106 (url "https://github.com/vmware/open-vm-tools")
2107 (commit (string-append "stable-" version))))
2108 (file-name (git-file-name name version))
2109 (sha256
2110 (base32 "0dzzj240nh0f0fjsnh0kd622h7ia2dvh4hw7mr2nb652krd20cjw"))))
2111 (build-system gnu-build-system)
2112 (arguments
2113 (list
2114 #:configure-flags
2115 #~(list "--with-fuse=fuse3"
2116 "--with-dnet"
2117 "--without-kernel-modules"
2118 "--without-x"
2119 (string-append
2120 "--with-udev-rules-dir=" #$output "/lib/udev/rules.d"))
2121 ;; TODO: Add iproute2 dbus which commands wrap.
2122 #:phases
2123 #~(modify-phases %standard-phases
2124 (add-after 'unpack 'chdir
2125 (lambda _
2126 (chdir "open-vm-tools")))
2127 (replace 'bootstrap
2128 (lambda _
2129 (system* "autoreconf" "-if")))
2130 (add-after 'bootstrap 'patch-paths
2131 (lambda _
2132 (substitute* "Makefile.am"
2133 (("/etc/vmware-tools/")
2134 (string-append #$output "/etc/vmware-tools/")))
2135 (substitute* "scripts/Makefile.am"
2136 (("/etc/vmware-tools")
2137 (string-append #$output "/etc/vmware-tools"))
2138 (("/usr/bin")
2139 (string-append #$output "/bin")))
2140 (substitute* "services/vmtoolsd/Makefile.am"
2141 (("/etc/vmware-tools")
2142 (string-append #$output "/etc/vmware-tools"))
2143 (("\\$\\(PAM_PREFIX\\)")
2144 (string-append #$output "/$(PAM_PREFIX)")))
2145 (substitute* "vgauth/service/Makefile.am"
2146 (("/etc/vmware-tools/vgauth/schemas")
2147 (string-append #$output "/etc/vmware-tools/vgauth/schemas"))
2148 (("etc/vmware-tools/vgauth.conf")
2149 (string-append #$output "/etc/vmware-tools/vgauth.conf")))
2150 (substitute* "vmhgfs-fuse/config.c"
2151 (("/bin/fusermount3")
2152 (string-append
2153 #$(this-package-input "fuse") "/bin/fusermount3")))
2154 (substitute* "lib/guestApp/guestApp.c"
2155 (("/etc/vmware-tools")
2156 (string-append #$output "/etc/vmware-tools")))
2157 ;; XXX: This part might need more testing with shutdown and halt
2158 ;; commands provided by Shepherd.
2159 (substitute* "lib/system/systemLinux.c"
2160 (("/sbin/shutdown")
2161 (string-append
2162 #$(this-package-input "shepherd") "/sbin/shutdown"))
2163 (("/bin/reboot")
2164 (string-append
2165 #$(this-package-input "shepherd") "/sbin/reboot")))
2166 (substitute* "services/plugins/vix/foundryToolsDaemon.c"
2167 (("/bin/mount")
2168 (string-append
2169 #$(this-package-input "util-linux") "/bin/mount"))
2170 (("/usr/bin/vmhgfs-fuse")
2171 (string-append #$output "/bin/vmhgfs-fuse"))))))))
2172 (native-inputs
2173 (list `(,glib "bin") ; for glib-genmarshal
2174 autoconf
2175 automake
2176 libltdl
2177 libtool
2178 pkg-config))
2179 (inputs
2180 (list eudev
2181 fuse
2182 glib
2183 xmlsec-openssl
2184 libmspack
2185 libdnet
2186 libtirpc
2187 libxcrypt
2188 libxml2
2189 linux-pam
2190 openssl
2191 procps
2192 rpcsvc-proto
2193 shepherd ;for 'halt' and 'reboot', invoked from VMWare host.
2194 util-linux))
2195 (home-page "https://github.com/vmware/open-vm-tools")
2196 (synopsis "Tools for VMWare guest VM to enhance host-guest integration")
2197 (description
2198 "@code{open-vm-tools} is a set of services and modules that enable several
2199features in VMware products for better management of, and seamless user
2200interactions with, guests.
2201
2202@code{open-vm-tools} enables the following features in VMware products:
2203
2204@itemize
2205@item The ability to perform virtual machine power operations gracefully.
2206@item Execution of VMware provided or user configured scripts in guests during
2207various power operations.
2208@item The ability to run programs, commands and file system operation in guests
2209to enhance guest automation.
2210@item Authentication for guest operations.
2211@item Periodic collection of network, disk, and memory usage information from
2212the guest.
2213@item Generation of heartbeat from guests to hosts so VMware's HA solution can
2214determine guests' availability.
2215@item Clock synchronization between guests and hosts or client desktops.
2216@item Quiescing guest file systems to allow hosts to capture
2217file-system-consistent guest snapshots.
2218@item Execution of pre-freeze and post-thaw scripts while quiescing guest file
2219systems.
2220@item The ability to customize guest operating systems immediately after
2221powering on virtual machines.
2222@item Enabling shared folders between host and guest file systems on VMware
2223Workstation and VMware Fusion.
2224@item Copying and pasting text, graphics, and files between guests and hosts or
2225client desktops.
2226@end itemize")
2227 (license license:gpl2)))
2228
2229(define-public vmware-open-vm-tools-gtk
2230 (package/inherit vmware-open-vm-tools
2231 (name "vmware-open-vm-tools-gtk")
2232 (inputs
2233 (modify-inputs inputs
2234 (prepend gdk-pixbuf-xlib
2235 gtk+
2236 gtkmm
2237 libdrm
2238 libx11
2239 libxext
2240 libxi
2241 libxinerama
2242 libxrandr
2243 libxrender
2244 libxtst)))
2245 (arguments
2246 (substitute-keyword-arguments arguments
2247 ((#:configure-flags flags)
2248 #~(delete "--without-x" #$flags))))
2249 (description "This package provides a GTK+ support for @code{open-vm-tools}.")))
2250
2251(define-public criu
2252 (package
2253 (name "criu")
2254 (version "4.0")
2255 (source
2256 (origin
2257 (method git-fetch)
2258 (uri (git-reference
2259 (url "https://github.com/checkpoint-restore/criu")
2260 (commit (string-append "v" version))))
2261 (file-name (git-file-name name version))
2262 (sha256
2263 (base32 "0p46z5iclyvvg1arvqhl3bdg1g2mny0pxyz6pr5n87cnj7maqphg"))))
2264 (build-system gnu-build-system)
2265 (arguments
2266 (list
2267 #:test-target "test"
2268 #:tests? #f ; tests require mounting as root
2269 #:make-flags
2270 #~(list (string-append "PREFIX=" #$output)
2271 (string-append "LIBDIR=$(PREFIX)/lib")
2272 ;; Upstream mistakenly puts binaries in /var. Now, in practice
2273 ;; no plugins are built, but the build system still fails
2274 ;; otherwise.
2275 (string-append "PLUGINDIR=$(LIBDIR)/criu")
2276 (string-append "ASCIIDOC="
2277 (search-input-file %build-inputs "/bin/asciidoc"))
2278 (string-append "PYTHON=python3")
2279 (string-append "XMLTO="
2280 (search-input-file %build-inputs "/bin/xmlto")))
2281 #:modules '((guix build gnu-build-system)
2282 (guix build utils)
2283 ((guix build pyproject-build-system) #:prefix py:))
2284 #:imported-modules (append %default-gnu-imported-modules
2285 %pyproject-build-system-modules)
2286 #:phases
2287 #~(modify-phases %standard-phases
2288 (delete 'configure) ; no configure script
2289 (add-after 'unpack 'hardcode-variables
2290 (lambda* (#:key inputs outputs #:allow-other-keys)
2291 ;; Hardcode arm version detection
2292 (substitute* "Makefile"
2293 (("ARMV.*:=.*") "ARMV := 7\n")
2294 (("^head-name :=.*")
2295 (string-append "head-name := " #$version "\n")))
2296 ;; disable pip install
2297 (substitute* "Makefile.install"
2298 (("SKIP_PIP_INSTALL.*:=.*") "SKIP_PIP_INSTALL := 1\n"))
2299 ;; Hard-code the correct PLUGINDIR above.
2300 (substitute* "criu/include/plugin.h"
2301 (("/var") #$output))))
2302 (add-after 'unpack 'ensure-no-mtimes-pre-1980
2303 py:ensure-no-mtimes-pre-1980)
2304 (add-before 'build 'fix-symlink
2305 (lambda* (#:key inputs #:allow-other-keys)
2306 ;; The file 'images/google/protobuf/descriptor.proto' points to
2307 ;; /usr/include/..., which obviously does not exist.
2308 (let* ((file "google/protobuf/descriptor.proto")
2309 (target (string-append "images/" file))
2310 (source (search-input-file
2311 inputs
2312 (string-append "include/" file))))
2313 (delete-file target)
2314 (symlink source target))))
2315 (add-after 'install 'wrap
2316 (lambda* (#:key inputs outputs #:allow-other-keys)
2317 ;; Make sure 'crit' runs with the correct PYTHONPATH.
2318 (let* ((site (py:site-packages inputs outputs))
2319 (path (getenv "GUIX_PYTHONPATH")))
2320 ;; manually install stuff that was pip-installed
2321 (for-each (lambda (dir)
2322 (with-directory-excursion dir
2323 (setenv "GUIX_PYTHONPATH"
2324 (string-append site ":" path))
2325 (invoke "python3" "setup.py" "install"
2326 (string-append "--prefix=" #$output)
2327 "--no-compile" "--root=/"
2328 "--single-version-externally-managed")))
2329 (list "lib" "crit"))
2330 (wrap-program (string-append #$output "/bin/crit")
2331 `("GUIX_PYTHONPATH" ":" prefix (,site ,path))))))
2332 (add-after 'install 'delete-static-libraries
2333 ;; Not building/installing these at all doesn't seem to be supported.
2334 (lambda* (#:key outputs #:allow-other-keys)
2335 (for-each delete-file (find-files #$output "\\.a$")))))))
2336 (inputs
2337 (list bash-minimal
2338 protobuf
2339 python-protobuf
2340 iproute
2341 libaio
2342 libcap
2343 libnet
2344 libnl
2345 libbsd
2346 nftables))
2347 (native-inputs
2348 (list pkg-config
2349 perl
2350 asciidoc
2351 xmlto
2352 docbook-xml
2353 docbook-xsl
2354 python-wrapper
2355 python-setuptools))
2356 (propagated-inputs
2357 ;; included by 'rpc.pb-c.h'
2358 (list protobuf-c))
2359 (home-page "https://criu.org")
2360 (synopsis "Checkpoint and restore in user space")
2361 (description "Using this tool, you can freeze a running application (or
2362part of it) and checkpoint it to a hard drive as a collection of files. You
2363can then use the files to restore and run the application from the point it
2364was frozen at. The distinctive feature of the CRIU project is that it is
2365mainly implemented in user space.")
2366 ;; The project is licensed under GPLv2; files in the lib/ directory are
2367 ;; LGPLv2.1.
2368 (license (list license:gpl2 license:lgpl2.1))))
2369
2370(define-public python-qemu-qmp
2371 (package
2372 (name "python-qemu-qmp")
2373 (version "0.0.0a0")
2374 (source
2375 (origin
2376 (method url-fetch)
2377 (uri (pypi-uri "qemu.qmp" version))
2378 (sha256
2379 (base32 "1rpsbiwvngij6fjcc5cx1azcc4dxmm080crr31wc7jrm7i61p7c2"))))
2380 (build-system pyproject-build-system)
2381 (arguments
2382 (list
2383 #:phases
2384 #~(modify-phases %standard-phases
2385 (replace 'check
2386 (lambda* (#:key tests? #:allow-other-keys)
2387 (if tests?
2388 (begin ; avocado insists on writing stuff to HOME.
2389 (setenv "HOME" "/tmp")
2390 (invoke "avocado" "--show=all" "run" "tests/protocol.py"))
2391 (format #t "test suite not run~%")))))))
2392 (native-inputs
2393 (list python-avocado-framework
2394 python-flake8
2395 python-setuptools
2396 python-setuptools-scm
2397 python-wheel))
2398 (propagated-inputs
2399 (list python-pygments
2400 python-urwid
2401 python-urwid-readline))
2402 (home-page "https://gitlab.com/jsnow/qemu.qmp")
2403 (synopsis "QEMU Monitor Protocol Python library")
2404 (description "@code{emu.qmp} is a
2405@url{https://gitlab.com/qemu-project/qemu/-/blob/master/docs/interop/qmp-intro.txt,
2406QEMU Monitor Protocol (QMP)} library written in Python. It is used to send
2407QMP messages to running QEMU emulators. It can be used to communicate with
2408QEMU emulators, the QEMU Guest Agent (QGA), the QEMU Storage Daemon (QSD), or
2409any other utility or application that speaks QMP.")
2410 (license license:gpl2+)))
2411
2412(define-public qmpbackup
2413 (package
2414 (name "qmpbackup")
2415 (version "0.52")
2416 (source
2417 (origin
2418 (method git-fetch)
2419 (uri (git-reference
2420 (url "https://github.com/abbbi/qmpbackup")
2421 (commit (string-append "v" version))))
2422 (file-name (git-file-name name version))
2423 (sha256
2424 (base32 "0wf9ryc7jiwkkqjpl1y5k814zzr0cbxib2ivl6lvs8vnq6pgbzw6"))))
2425 (build-system pyproject-build-system)
2426 ;; The test suite requires to download a 241 MiB QEMU image; skip it.
2427 (arguments (list #:tests? #f))
2428 (native-inputs (list python-setuptools))
2429 (inputs (list python-qemu-qmp))
2430 (home-page "https://github.com/abbbi/qmpbackup")
2431 (synopsis "Backup and restore QEMU machines")
2432 (description
2433 "@command{qmpbackup} is designed to create and restore full and
2434incremental backups of running QEMU virtual machines via QMP, the QEMU Machine
2435Protocol.")
2436 (license license:gpl3+)))
2437
2438(define-public looking-glass-client
2439 (package
2440 (name "looking-glass-client")
2441 (version "B7")
2442 (source (origin
2443 (method url-fetch)
2444 (uri (string-append "https://looking-glass.io/artifact/" version
2445 "/source"))
2446 (file-name (string-append name "-" version ".tar.gz"))
2447 (sha256
2448 (base32
2449 "11crsvy783ig7kzmr2cr68wv9zsjkcbp1akcs28rc6yc1ik0dr89"))))
2450 (build-system cmake-build-system)
2451 (inputs (list bash-minimal
2452 font-dejavu
2453 fontconfig
2454 freetype
2455 glu
2456 gmp
2457 libglvnd
2458 libiberty
2459 libsamplerate
2460 libx11
2461 libxcursor
2462 libxfixes
2463 libxi
2464 libxinerama
2465 libxkbcommon
2466 libxpresent
2467 libxrandr
2468 libxscrnsaver
2469 mesa
2470 pipewire
2471 pulseaudio
2472 spice-protocol
2473 wayland
2474 wayland-protocols
2475 `(,zlib "static")))
2476 (native-inputs (list nettle pkg-config))
2477 (arguments
2478 (list #:tests? #f ;No tests are available.
2479 ;; Package uses "-march=native" by default. We disable that to build with the
2480 ;; lowest supported architecture for reproducibility and CPU compatibility.
2481 #:configure-flags #~'("-DOPTIMIZE_FOR_NATIVE=OFF"
2482 "-DENABLE_BACKTRACE=no")
2483 #:make-flags #~'("CC=gcc")
2484 #:phases #~(modify-phases %standard-phases
2485 (add-before 'configure 'chdir-to-client
2486 (lambda* (#:key outputs #:allow-other-keys)
2487 (chdir "client")))
2488 (replace 'install
2489 (lambda* (#:key outputs #:allow-other-keys)
2490 (install-file "looking-glass-client"
2491 (string-append (assoc-ref outputs
2492 "out")
2493 "/bin"))))
2494 (add-after 'install 'wrapper
2495 (lambda* (#:key inputs outputs #:allow-other-keys)
2496 (wrap-program (string-append (assoc-ref outputs
2497 "out")
2498 "/bin/looking-glass-client")
2499 `("LD_LIBRARY_PATH" ":" prefix
2500 ,(map (lambda (name)
2501 (let ((input (assoc-ref inputs name)))
2502 (string-append input "/lib")))
2503 '("gmp" "libxi"
2504 "nettle"
2505 "mesa"
2506 "wayland"
2507 "fontconfig-minimal"
2508 "freetype"
2509 "libx11"
2510 "libxfixes"
2511 "libxscrnsaver"
2512 "libxinerama")))))))))
2513 (home-page "https://looking-glass.io/")
2514 (synopsis "KVM Frame Relay (KVMFR) implementation")
2515 (description
2516 "Looking Glass allows the use of a KVM (Kernel-based Virtual
2517Machine) configured for VGA PCI Pass-through without an attached physical
2518monitor, keyboard or mouse. It displays the VM's rendered contents on your
2519main monitor/GPU.")
2520 ;; This package requires SSE instructions.
2521 (supported-systems '("i686-linux" "x86_64-linux"))
2522 (license license:gpl2+)))
2523
2524;; XXX: Deprecated on <2026-07-01>.
2525(define-deprecated/public-alias runc (@ (gnu packages containers) runc))
2526
2527;; XXX: Deprecated on <2026-07-01>.
2528(define-deprecated/public-alias umoci (@ (gnu packages containers) umoci))
2529
2530;; XXX: Deprecated on <2026-07-01>.
2531(define-deprecated/public-alias skopeo (@ (gnu packages containers) skopeo))
2532
2533(define-public ruby-vagrant-spec-helper-basic
2534 (package
2535 (name "ruby-vagrant-spec-helper-basic")
2536 (version "0.2.0")
2537 (source (origin
2538 (method url-fetch)
2539 (uri (rubygems-uri "vagrant-spec-helper-basic" version))
2540 (sha256
2541 (base32
2542 "1qhxxc07dhrma1s1x2g9sma7xxgwzs20s6v5pv9jrpz6bl4b527n"))))
2543 (build-system ruby-build-system)
2544 (arguments
2545 (list #:tests? #f)) ;; has not tests
2546 (synopsis "Helper for vagrant-spec")
2547 (description "This package is an internal helper for vagrant-spec. Don't
2548use it.")
2549 (home-page "https://github.com/hashicorp/vagrant-spec")
2550 (license license:mpl2.0)))
2551
2552(define-public ruby-vagrant-spec
2553 (package
2554 (name "ruby-vagrant-spec")
2555 (version "0.0.6")
2556 (source (origin
2557 (method url-fetch)
2558 (uri (rubygems-uri "vagrant_spec" version))
2559 (sha256
2560 (base32
2561 "1bkzz3mj7kzsv6k0ii8w31cgkpiqw3wvmvv2c6rknsavqqnagb4g"))))
2562 (build-system ruby-build-system)
2563 ;; (native-inputs (list ruby-rubocop ruby-vagrant-spec-helper-basic))
2564 (propagated-inputs (list ruby-coveralls ruby-serverspec))
2565 (arguments
2566 (list
2567 #:tests? #f ;; tests require vagrant
2568 ;; target 'test' includes 'cops' and running some ansible-playbook
2569 #:test-target "unit"
2570 #:phases
2571 #~(modify-phases %standard-phases
2572 (add-after 'unpack 'patch
2573 (lambda _
2574 (substitute* "Rakefile"
2575 (("Bundler::GemHelper") "require 'bundler'\nBundler::GemHelper"))))
2576 (add-before 'check 'prepare-check
2577 (lambda _
2578 (setenv "HOME" "/tmp"))))))
2579 (synopsis "Specification and tests for Vagrant")
2580 (description "@code{vagrant-spec} is a both a specification of how Vagrant
2581and its various components should behave as well as a library of testing
2582helpers that let you write your own unit and acceptance tests for Vagrant.")
2583 (home-page "https://github.com/hashicorp/vagrant-spec")
2584 (license license:mpl2.0)))
2585
2586(define-public vagrant
2587 (package
2588 (name "vagrant")
2589 (version "2.3.7") ;; last release under BSD-3 license
2590 (source (origin
2591 (method git-fetch)
2592 (uri (git-reference
2593 (url "https://github.com/hashicorp/vagrant")
2594 (commit (string-append "v" version))))
2595 (file-name (git-file-name name version))
2596 (sha256
2597 (base32
2598 "0c674c5v70skh38lpydz8cdmcp8wgr9h7rn00rxdpgizrzbfxl82"))
2599 (patches (search-patches
2600 "vagrant-bin-vagrant-silence-warning-about-installer.patch"
2601 "vagrant-Support-system-installed-plugins.patch"
2602 "vagrant-Use-a-private-temporary-dir.patch"))))
2603 (build-system ruby-build-system)
2604 (arguments
2605 (list
2606 #:tests? #f ; test require ruby-grpc-tools which are not packaged yet
2607 #:phases
2608 #~(modify-phases %standard-phases
2609 (add-after 'unpack 'patch-gemfile
2610 (lambda _
2611 (substitute* "Gemfile"
2612 ((", git:.*") "\n"))))
2613 (add-after 'unpack 'pin-executables
2614 (lambda* (#:key inputs outputs #:allow-other-keys)
2615 (let* ((bsdtar (search-input-file inputs "/bin/bsdtar"))
2616 (curl (search-input-file inputs "/bin/curl"))
2617 (dnsmasq (search-input-file inputs "/sbin/dnsmasq"))
2618 (grep (search-input-file inputs "/bin/grep"))
2619 (modinfo (search-input-file inputs "/bin/modinfo"))
2620 (ps (search-input-file inputs "/bin/ps")))
2621 ;; bsdtar
2622 (for-each
2623 (lambda (rbfile)
2624 (substitute* rbfile
2625 (("\"bsdtar\",") (string-append "\"" bsdtar "\","))))
2626 (find-files "lib/vagrant/" "\\.rb$"))
2627 ;; curl
2628 (substitute* "lib/vagrant/util/downloader.rb"
2629 (("\"curl\",") (string-append "\"" curl "\",")))
2630 (substitute* "lib/vagrant/util/uploader.rb"
2631 (("\"curl\",") (string-append "\"" curl "\",")))
2632 (substitute* "plugins/hosts/linux/cap/nfs.rb"
2633 ;; grep
2634 (("\\| grep #\\{nfs_service")
2635 (string-append "| " grep " #{nfs_service"))
2636 (("\"grep\",") (string-append "\"" grep "\","))
2637 ;; modinfo
2638 (("Vagrant::Util::Which.which\\(\"modinfo\"\\)")
2639 (string-append "\"" modinfo "\"")))
2640 ;; ssh, rsync:
2641 ;; Don't pin ssh to allow different clients and to avoid
2642 ;; configuration conflicts when running on a foreign distro.
2643 ;; (substitute* "lib/vagrant/util/ssh.rb"
2644 ;; (("Which.which\\(\"ssh\", original_path: true\\)")
2645 ;; (string-append "\"" ssh "\"")))
2646 ;; ps
2647 (substitute* "lib/vagrant/util/platform.rb"
2648 (("\"ps\",") (string-append "\"" ps "\","))))))
2649 (add-after 'extract-gemspec 'relax-requirements
2650 (lambda _
2651 (substitute* "vagrant.gemspec"
2652 ;; Relax some version specification.
2653 (("s\\.required_ruby_version ") "# s.required_ruby_version ")
2654 (("dependency \"rgl\", \"~> 0.5.10\"")
2655 "dependency \"rgl\"")
2656 (("dependency \"vagrant_cloud\", \"~> 3.0.5\"")
2657 "dependency \"vagrant_cloud\"")
2658 (("dependency \"rexml\", .*")
2659 "dependency \"rexml\"\n")
2660 ;; Remove Windows specific dependencies
2661 ((".*dependency \"(wdm|winrm(|-elevated|-fs))\".*") "")
2662 ;; Remove BSD dependency
2663 ((".*dependency \"rb-kqueue\".*") "")
2664 ;; Remove cyclic inclusion of gem
2665 (("^ gitignore_path = " line)
2666 (string-append
2667 "all_files.reject! { |file| file.match?(\"vagrant-.*\\.gem\") }\n"
2668 line))))))))
2669 (native-search-paths
2670 (list (search-path-specification
2671 (variable "GUIX_VAGRANT_PLUGINS_PATH")
2672 (files '("share/vagrant-plugins")))))
2673 ;; TODO: install bash/zsh completions, man-page, etc.
2674 ;; see http://svnweb.mageia.org/packages/cauldron/vagrant/current/SPECS/vagrant.spec
2675 (native-inputs (list ruby-fake-ftp ruby-webrick bundler ruby-vagrant-spec))
2676 (inputs (list curl dnsmasq grep kmod libarchive openssh procps))
2677 (propagated-inputs
2678 (list ruby-bcrypt-pbkdf ruby-childprocess ruby-ed25519 ruby-erubi
2679 ruby-googleapis-common-protos-types ruby-grpc
2680 ruby-hashicorp-checkpoint ruby-i18n ruby-listen ruby-log4r
2681 ruby-mime-types ruby-net-ftp ruby-net-ssh ruby-net-sftp
2682 ruby-net-scp ruby-ipaddr ruby-rexml ruby-rgl ruby-rubyzip
2683 ruby-vagrant-cloud ruby-vagrant-spec))
2684 (synopsis "Build and distribute virtualized development environments")
2685 (description "Vagrant is the command line utility for managing the
2686lifecycle of virtual machines. Isolate dependencies and their configuration
2687within a single disposable and consistent environment.
2688
2689Note: Make sure to have @code{ssh} and @code{rsync} installed — if you use the
2690respective Vagrant functions. This package does not link to any specific
2691implementation of these to allow different clients and to avoid configuration
2692conflicts when running on a `foreign distribution'.")
2693 (home-page "https://www.vagrantup.com")
2694 ;; CVE-2021-21361 is related to the gradle-vagrant-plugin
2695 (properties '((lint-hidden-cve . ("CVE-2021-21361"))))
2696 (license license:bsd-3)))
2697
2698(define-public vagrant-cachier
2699 (package
2700 (name "vagrant-cachier")
2701 (version "1.2.1")
2702 (source (origin
2703 (method url-fetch)
2704 (uri (rubygems-uri "vagrant-cachier" version))
2705 (sha256
2706 (base32
2707 "0v11nf2d2y2knwm4zackd5ap8h2927n8rc1q73b6ii4hndv98fh9"))))
2708 (build-system ruby-build-system)
2709 (arguments
2710 (list
2711 #:tests? #f ; neither gem nor source actually has tests
2712 #:phases
2713 #~(modify-phases %standard-phases
2714 (add-after 'install 'install-plugin.json
2715 (lambda _
2716 (let* ((plugins.d (string-append
2717 #$output "/share/vagrant-plugins/plugins.d"))
2718 (plugin.json (string-append
2719 plugins.d "/" #$name ".json")))
2720 (mkdir-p plugins.d)
2721 #$(with-extensions (list guile-json-4)
2722 #~(begin
2723 (use-modules (json))
2724 (call-with-output-file plugin.json
2725 (lambda (port)
2726 (scm->json
2727 '((#$name
2728 .
2729 (("ruby_version"
2730 . #$(package-version (this-package-input "ruby")))
2731 ("vagrant_version"
2732 . #$(package-version (this-package-input "vagrant")))
2733 ("gem_version" . "")
2734 ("require" . "")
2735 ("installed_gem_version" . #$version)
2736 ("sources" . #()))))
2737 port)))))))))))
2738 (inputs (list ruby vagrant))
2739 (synopsis "Share a common package cache among similar VM instances")
2740 (description "This package provides a Vagrant plugin that helps you reduce
2741the amount of coffee you drink while waiting for boxes to be provisioned by
2742sharing a common package cache among similar VM instances. Kinda like
2743vagrant-apt_cache or this magical snippet but targeting multiple package
2744managers and Linux distros.")
2745 (home-page "https://github.com/fgrehm/vagrant-cachier")
2746 (license license:expat)))
2747
2748(define-public vagrant-libvirt
2749 (package
2750 (name "vagrant-libvirt")
2751 (version "0.12.2")
2752 (source (origin
2753 (method url-fetch)
2754 (uri (rubygems-uri "vagrant-libvirt" version))
2755 (sha256
2756 (base32
2757 "013g6wn24k01lwwkzcb0vvxj959lws8c52bkyqi6b8shnn793j1l"))))
2758 (build-system ruby-build-system)
2759 (arguments
2760 (list
2761 #:tests? #f ; tests involve running vagrant, downloading a box and
2762 ; access to libvirt socket
2763 #:phases
2764 #~(modify-phases %standard-phases
2765 (add-after 'install 'install-plugin.json
2766 (lambda _
2767 (let* ((plugins.d (string-append
2768 #$output "/share/vagrant-plugins/plugins.d"))
2769 (plugin.json (string-append
2770 plugins.d "/" #$name ".json")))
2771 (mkdir-p plugins.d)
2772 #$(with-extensions (list guile-json-4)
2773 #~(begin
2774 (use-modules (json))
2775 (call-with-output-file plugin.json
2776 (lambda (port)
2777 (scm->json
2778 '((#$name
2779 .
2780 (("ruby_version"
2781 . #$(package-version (this-package-input "ruby")))
2782 ("vagrant_version"
2783 . #$(package-version (this-package-input "vagrant")))
2784 ("gem_version" . "")
2785 ("require" . "")
2786 ("installed_gem_version" . #$version)
2787 ("sources" . #()))))
2788 port)))))))))))
2789 (inputs (list ruby vagrant))
2790 (propagated-inputs (list ruby-diffy
2791 ruby-fog-core
2792 ruby-fog-libvirt
2793 ruby-nokogiri
2794 ruby-rexml
2795 ruby-xml-simple))
2796 (synopsis "Libvirt provider for Vagrant")
2797 (description "This is a Vagrant plugin that adds a Libvirt provider to
2798Vagrant, allowing Vagrant to control and provision machines via the Libvirt
2799toolkit.")
2800 (home-page "https://github.com/vagrant-libvirt/vagrant-libvirt")
2801 (license license:expat)))
2802
2803(define-public vagrant-reload
2804 (package
2805 (name "vagrant-reload")
2806 (version "0.0.1")
2807 (source (origin
2808 (method url-fetch)
2809 (uri (rubygems-uri "vagrant-reload" version))
2810 (sha256
2811 (base32
2812 "0smy0px20xgakcyki5hdbk3n63k9c6ychh5pvbannn1p4zjxa0xa"))))
2813 (build-system ruby-build-system)
2814 (arguments
2815 (list
2816 #:tests? #f ; has no tests, testing as described in the Readme requires
2817 ; running vagrant, a provider and downloading a box
2818 #:phases
2819 #~(modify-phases %standard-phases
2820 (add-after 'unpack 'patch-gemfile
2821 (lambda _
2822 (substitute* "Gemfile"
2823 ((", :git.*") "\n"))))
2824 (add-after 'install 'install-plugin.json
2825 (lambda _
2826 (let* ((plugins.d (string-append
2827 #$output "/share/vagrant-plugins/plugins.d"))
2828 (plugin.json (string-append
2829 plugins.d "/" #$name ".json")))
2830 (mkdir-p plugins.d)
2831 #$(with-extensions (list guile-json-4)
2832 #~(begin
2833 (use-modules (json))
2834 (call-with-output-file plugin.json
2835 (lambda (port)
2836 (scm->json
2837 '((#$name
2838 .
2839 (("ruby_version"
2840 . #$(package-version (this-package-input "ruby")))
2841 ("vagrant_version"
2842 . #$(package-version (this-package-input "vagrant")))
2843 ("gem_version" . "")
2844 ("require" . "")
2845 ("installed_gem_version" . #$version)
2846 ("sources" . #()))))
2847 port)))))))))))
2848 (inputs (list ruby vagrant))
2849 (synopsis "Reload a Vagrant VM as a provisioning step")
2850 (description "This Vagrant plugin enables reloading a Vagrant VM as a
2851provisioning step.")
2852 (home-page "http://www.vagrantup.com")
2853 (license license:expat)))
2854
2855(define-public vagrant-vai
2856 (package
2857 (name "vagrant-vai")
2858 (version "0.9.3")
2859 (source (origin
2860 (method url-fetch)
2861 (uri (rubygems-uri "vai" version))
2862 (sha256
2863 (base32
2864 "041bi8hk03ybhacqzhw153j3knqhwvxn8aczzq6nikmpklcs4m4a"))))
2865 (build-system ruby-build-system)
2866 (arguments
2867 (list
2868 #:tests? #f ; tests involve running vagrant and downloading a box
2869 #:phases
2870 #~(modify-phases %standard-phases
2871 (add-after 'install 'install-plugin.json
2872 (lambda _
2873 (let* ((plugins.d (string-append
2874 #$output "/share/vagrant-plugins/plugins.d"))
2875 (plugin.json (string-append
2876 plugins.d "/" #$name ".json")))
2877 (mkdir-p plugins.d)
2878 #$(with-extensions (list guile-json-4)
2879 #~(begin
2880 (use-modules (json))
2881 (call-with-output-file plugin.json
2882 (lambda (port)
2883 (scm->json
2884 '(("vai" ;; #$name
2885 .
2886 (("ruby_version"
2887 . #$(package-version (this-package-input "ruby")))
2888 ("vagrant_version"
2889 . #$(package-version (this-package-input "vagrant")))
2890 ("gem_version" . "")
2891 ("require" . "")
2892 ("installed_gem_version" . #$version)
2893 ("sources" . #()))))
2894 port)))))))))))
2895 (inputs (list ruby vagrant))
2896 (synopsis "Vagrant provisioning plugin to output an Ansible inventory")
2897 (description "This plugin creates an Ansible inventory file containing the
2898created virtual machines and the respective ssh-parameters.")
2899 (home-page "https://github.com/MatthewMi11er/vai")
2900 (license license:expat)))
2901
2902(define-public python-vagrant
2903 (package
2904 (name "python-vagrant")
2905 (version "1.1.0")
2906 (source
2907 (origin
2908 (method git-fetch)
2909 (uri (git-reference
2910 (url "https://github.com/todddeluca/python-vagrant")
2911 (commit (string-append "v" version))))
2912 (file-name (git-file-name name version))
2913 (sha256
2914 (base32 "032g398vddnaxhkvhdz0x1fxvp8qbgjqiigza1racqq8gp6di6va"))))
2915 (build-system pyproject-build-system)
2916 (arguments
2917 (list #:tests? #f)) ;tests involve running vagrant.
2918 (native-inputs (list python-setuptools))
2919 (home-page "https://github.com/todddeluca/python-vagrant")
2920 (synopsis "Python bindings for Vagrant")
2921 (description
2922 "Python-vagrant is a Python module that provides a thin wrapper around the
2923@code{vagrant} command line executable, allowing programmatic control of Vagrant
2924virtual machines.")
2925 (license license:expat)))
2926
2927(define-public bubblewrap
2928 (package
2929 (name "bubblewrap")
2930 (version "0.11.0")
2931 (source (origin
2932 (method git-fetch)
2933 (uri (git-reference
2934 (url "https://github.com/containers/bubblewrap/")
2935 (commit (string-append "v" version))))
2936 (file-name (git-file-name name version))
2937 (sha256
2938 (base32
2939 "1rb7dih12s9liwq2lfjdm1br6jaxkmdwsqjr6zx9wfyy0cnwr07h"))
2940 (patches (search-patches "bubblewrap-fix-locale-in-tests.patch"))))
2941 (build-system meson-build-system)
2942 (arguments
2943 (list #:phases
2944 #~(modify-phases %standard-phases
2945 (add-after 'unpack 'fix-test
2946 (lambda* (#:key outputs #:allow-other-keys)
2947 ;; Tests try to access /var/tmp, which is not possible in our build
2948 ;; environment. Let's give them another directory.
2949 ;; /tmp gets overridden in some tests, so we need another directory.
2950 ;; the only possibility is the output directory.
2951 (let ((tmp-dir (string-append (assoc-ref outputs "out") "/tmp")))
2952 (mkdir-p tmp-dir)
2953 (substitute* "tests/test-run.sh"
2954 (("/var/tmp") tmp-dir)
2955 ;; Tests create a temporary python script, so fix its shebang.
2956 (("/usr/bin/env python3") (which "python3"))
2957 ;; Tests call /usr/bin/env, so fix its path.
2958 (("/usr/bin/env") (which "env"))
2959 ;; Some tests try to access /usr, but that doesn't exist.
2960 ;; Give them /gnu instead.
2961 (("/usr") "/gnu")
2962 (("--ro-bind /bin /bin") "--ro-bind /gnu /bin")
2963 (("--ro-bind /sbin /sbin") "--ro-bind /gnu /sbin")
2964 (("--ro-bind /lib /lib") "--ro-bind /gnu /lib")
2965 ((" */bin/bash") (which "bash"))
2966 (("/bin/sh") (which "sh"))
2967 (("findmnt") (which "findmnt")))
2968 (substitute* "tests/libtest.sh"
2969 (("/var/tmp") tmp-dir)
2970 (("/usr") "/gnu")
2971 (("--ro-bind /bin /bin") "--ro-bind /gnu /bin")
2972 (("--ro-bind /sbin /sbin") "--ro-bind /gnu /sbin")
2973 (("--ro-bind /lib /lib") "--ro-bind /gnu /lib")))))
2974 ;; Remove the directory we gave to tests to have a clean package.
2975 (add-after 'check 'remove-tmp-dir
2976 (lambda* (#:key outputs #:allow-other-keys)
2977 (delete-file-recursively (string-append (assoc-ref outputs "out") "/tmp")))))))
2978 (inputs (list libcap))
2979 (native-inputs (list python-wrapper util-linux pkg-config))
2980 (home-page "https://github.com/containers/bubblewrap")
2981 (synopsis "Unprivileged sandboxing tool")
2982 (description "Bubblewrap is aimed at running applications in a sandbox,
2983restricting their access to parts of the operating system or user data such as
2984the home directory. Bubblewrap always creates a new mount namespace, and the
2985user can specify exactly what parts of the file system should be made visible
2986in the sandbox. These directories are mounted with the @code{nodev} option
2987by default and can be made read-only.")
2988 (license license:lgpl2.0+)))
2989
2990(define-public bochs
2991 (package
2992 (name "bochs")
2993 (version "3.0")
2994 (source (origin
2995 (method url-fetch)
2996 (uri (string-append "mirror://sourceforge/bochs/bochs/" version
2997 "/bochs-" version ".tar.gz"))
2998 (sha256
2999 (base32
3000 "1al1fx8dbb0ny7a4wbngnz8pqav0nl6rhakb434jqnpka4mm8vyb"))
3001 (snippet
3002 #~(begin
3003 (use-modules (guix build utils))
3004 ;; This file is non-free.
3005 (delete-file "bios/i440fx.bin")
3006 ;; make -C bios bios-clean
3007 (for-each delete-file
3008 (find-files "bios" "^BIOS-bochs-"))))))
3009 (build-system gnu-build-system)
3010 (arguments
3011 (list #:tests? #f ;no test suite
3012 #:configure-flags
3013 ;; Enable support for more modern machine emulation not enabled by
3014 ;; default.
3015 #~(list "--enable-x86-64"
3016 "--enable-smp"
3017 "--enable-all-optimizations"
3018 "--enable-readline"
3019 "--enable-avx"
3020 "--enable-evex"
3021 "--enable-amx"
3022 "--enable-vmx=2"
3023 "--enable-svm"
3024 "--enable-protection-keys"
3025 "--enable-cet"
3026 "--enable-es1370"
3027 "--enable-sb16"
3028 "--enable-uintr"
3029 "--enable-3dnow"
3030 "--enable-usb"
3031 "--enable-usb-ohci"
3032 "--enable-usb-ehci"
3033 "--enable-usb-xhci"
3034 "--enable-pnic"
3035 "--enable-e1000"
3036 "--enable-using-libslirp"
3037 "--with-vncsrv")
3038 #:phases
3039 #~(modify-phases %standard-phases
3040 (add-after 'unpack 'make-reproducible
3041 (lambda _
3042 (substitute* "bios/Makefile.in"
3043 (("BUILDDATE.*")
3044 "BUILDDATE = `date --utc --date='@0'")))))))
3045 (native-inputs (list pkg-config))
3046 (inputs (list libslirp libx11 libvnc readline wxwidgets))
3047 (home-page "https://bochs.sourceforge.io/")
3048 (synopsis "IA-32 (x86) PC emulator")
3049 (description "Bochs is a highly portable IA-32 (x86) PC emulator written
3050in C++. It includes emulation of the Intel x86 CPU, common I/O devices, and a
3051custom BIOS. Bochs can be compiled to emulate many different x86 CPUs, from
3052early 386 to the most recent x86-64 Intel and AMD processors. Bochs is
3053capable of running most operating systems inside the emulation including
3054GNU/Linux, DOS or Microsoft Windows.")
3055 (license license:lgpl2.1+)))
3056
3057(define-public xen
3058 (package
3059 (name "xen")
3060 (version "4.21.1") ; please update the mini-os input as well
3061 (source (origin
3062 (method git-fetch)
3063 (uri (git-reference
3064 (url "https://xenbits.xen.org/git-http/xen.git")
3065 (commit (string-append "RELEASE-" version))))
3066 (file-name (git-file-name name version))
3067 (sha256
3068 (base32
3069 "0y7qqyxx8iwhw2b7yd8y8fwmnyj1wyahbjspd02dfvcmlaifq03d"))))
3070 (build-system gnu-build-system)
3071 (arguments
3072 (list
3073 #:configure-flags
3074 #~(list "--enable-rpath"
3075 "--disable-qemu-traditional" ; tries to "git clone"
3076 "--disable-rombios" ; tries to "git clone" via etherboot
3077 ;; TODO: Re-enable stubdom (it's "more secure" to use it).
3078 "--disable-stubdom" ; tries to "git clone" old patched newlib
3079 (string-append "--with-initddir=" #$output "/etc/init.d")
3080 (string-append "--with-system-qemu="
3081 (search-input-file %build-inputs
3082 "bin/qemu-system-i386"))
3083 (string-append "--with-system-seabios="
3084 (search-input-file %build-inputs
3085 "share/firmware/bios.bin"))
3086 (string-append "--with-system-ovmf="
3087 (search-input-file %build-inputs
3088 "share/firmware/ovmf_ia32.bin")))
3089 #:make-flags
3090 #~(list "XEN_BUILD_DATE=Thu Jan 1 01:00:01 CET 1970"
3091 "XEN_BUILD_TIME=01:00:01"
3092 "XEN_BUILD_HOST="
3093 "ETHERBOOT_NICS="
3094 "SMBIOS_REL_DATE=01/01/1970"
3095 "VGABIOS_REL_DATE=01 Jan 1970"
3096 ;; QEMU_TRADITIONAL_LOC
3097 ;; QEMU_UPSTREAM_LOC
3098 "SYSCONFIG_DIR=/tmp/etc/default"
3099 (string-append "BASH_COMPLETION_DIR=" #$output
3100 "/etc/bash_completion.d")
3101 (string-append "BOOT_DIR=" #$output "/boot")
3102 (string-append "DEBUG_DIR=" #$output "/lib/debug")
3103 (string-append "EFI_DIR=" #$output "/lib/efi")
3104 (string-append "SHLIB_libxenctrl=-Wl,-rpath=" #$output "/lib")
3105 (string-append "SHLIB_libxenguest=-Wl,-rpath=" #$output "/lib")
3106 (string-append "SHLIB_libxenstore=-Wl,-rpath=" #$output "/lib")
3107 "MINIOS_UPSTREAM_URL=")
3108 #:test-target "test"
3109 #:phases
3110 #~(modify-phases %standard-phases
3111 (add-after 'unpack 'unpack-mini-os
3112 (lambda* (#:key inputs #:allow-other-keys)
3113 (let ((mini-os (dirname (search-input-file inputs "minios.mk"))))
3114 (copy-recursively mini-os "extras/mini-os"))))
3115 (add-after 'unpack-mini-os 'patch
3116 (lambda* (#:key inputs #:allow-other-keys)
3117 (substitute* "tools/firmware/Rules.mk"
3118 (("override XEN_TARGET_ARCH = x86_32" match)
3119 (string-append match "\noverride CC = "
3120 (search-input-file inputs
3121 "bin/i686-linux-gnu-gcc")))
3122 (("^CFLAGS =$" match)
3123 (string-append match " -I" (assoc-ref inputs "cross-libc")
3124 "/include\n")))
3125 (substitute* "config/x86_32.mk"
3126 (("(CFLAGS += )-m32 -march=i686" _ match)
3127 (string-append match "-march=i686 -I"
3128 (assoc-ref inputs "cross-libc") "/include")))
3129 ;; /var is not in /gnu/store, so don't try to create it.
3130 (substitute* '("tools/Makefile"
3131 "tools/xenstored/Makefile"
3132 "tools/xenpaging/Makefile")
3133 (("\\$\\(INSTALL_DIR\\) .*XEN_(DUMP|LOG|RUN|LIB|PAGING)_DIR.*")
3134 "\n")
3135 (("\\$\\(INSTALL_DIR\\) .*XEN_(RUN|LIB)_STORED.*") "\n"))
3136 ;; Prevent xen from creating /etc.
3137 (substitute* "tools/examples/Makefile"
3138 ((" install-(configs|readmes)") ""))
3139 ;; Set rpath.
3140 (substitute* "tools/pygrub/setup.py"
3141 (("library_dirs =" match)
3142 ;; TODO: extra_link_args = ['-Wl,-rpath=/opt/foo'],
3143 (string-append "runtime_library_dirs = ['" #$output "/lib'],"
3144 "\n" match)))))
3145 (add-before 'configure 'patch-xen-script-directory
3146 (lambda _
3147 (substitute* '("configure"
3148 "tools/configure"
3149 "docs/configure")
3150 (("(XEN_SCRIPT_DIR=).*" _ match)
3151 (string-append match #$output "/etc/xen/scripts")))))
3152 (add-before 'configure 'set-environment-up
3153 (lambda* (#:key make-flags #:allow-other-keys)
3154 (define (cross? x)
3155 (string-contains x "cross-i686-linux"))
3156 (define (filter-environment! filter-predicate
3157 environment-variable-names)
3158 (for-each
3159 (lambda (env-name)
3160 (let* ((env-value (getenv env-name))
3161 (search-path (search-path-as-string->list env-value))
3162 (new-search-path (filter filter-predicate
3163 search-path))
3164 (new-env-value (list->search-path-as-string
3165 new-search-path ":")))
3166 (setenv env-name new-env-value)))
3167 environment-variable-names))
3168 (setenv "CROSS_C_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
3169 (setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
3170 (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
3171 (filter-environment! cross?
3172 '("CROSS_C_INCLUDE_PATH"
3173 "CROSS_CPLUS_INCLUDE_PATH"
3174 "CROSS_LIBRARY_PATH"))
3175 (filter-environment! (lambda (e) (not (cross? e)))
3176 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
3177 "LIBRARY_PATH"))
3178 ;; Guix tries to be helpful and automatically adds
3179 ;; mini-os-git-checkout/include to the include path,
3180 ;; but actually we don't want it to be there (yet).
3181 (filter-environment! (lambda (e)
3182 (not
3183 (string-contains e
3184 "mini-os-git-checkout")))
3185 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
3186 "LIBRARY_PATH"))
3187 (setenv "EFI_VENDOR" "guix")))
3188 (replace 'build
3189 (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
3190 (apply invoke "make" "world"
3191 "-j" (number->string
3192 (if parallel-build? (parallel-job-count) 1))
3193 make-flags)))
3194 (add-after 'install 'remove-cruft
3195 (lambda _
3196 (with-directory-excursion #$output
3197 ;; Delete useless (and irreproducible) build-time left-overs.
3198 (for-each delete-file
3199 (find-files "share/doc" "^\\.deps$"))))))))
3200 (inputs
3201 (list acpica ; TODO: patch iasl invocation
3202 bridge-utils ; TODO: patch invocations
3203 glib
3204 iproute ; TODO: patch invocations
3205 libaio
3206 libx11
3207 libxcrypt ; required by Python.h
3208 yajl
3209 ncurses
3210 openssl
3211 ovmf-i686
3212 pixman
3213 qemu-minimal
3214 seabios
3215 `(,util-linux "lib") ; uuid
3216 ;; TODO: ocaml-findlib, ocaml-nox.
3217 xz ; for liblzma
3218 zlib))
3219 (native-inputs
3220 (list dev86
3221 bison
3222 cmake-minimal
3223 figlet
3224 flex
3225 gettext-minimal
3226 libnl
3227 (origin
3228 (method git-fetch)
3229 (uri (git-reference
3230 (url "https://xenbits.xen.org/git-http/mini-os.git")
3231 ;; This corresponds to (string-append "xen-RELEASE-" version))
3232 ;; at time of packaging, but upstream has unfortunately modified
3233 ;; existing tags in the past. Also, not all Xen releases get a
3234 ;; new tag. See <https://xenbits.xen.org/gitweb/?p=mini-os.git>.
3235 (commit "6732fd42d8eb8d0af9f5eb54aca17f4c250213a8")))
3236 (sha256
3237 (base32 "1v4hhdp0zq93mvwi6w6jmmsmkff439hb41w5qmp5k3g5wr1b786w"))
3238 (file-name (string-append name "-" version "-mini-os-git-checkout")))
3239 perl
3240 ;; TODO: markdown.
3241 pkg-config
3242 python
3243 python-setuptools
3244 wget
3245 (cross-gcc "i686-linux-gnu"
3246 #:xbinutils (cross-binutils "i686-linux-gnu")
3247 #:libc (cross-libc "i686-linux-gnu"))
3248 (cross-libc "i686-linux-gnu") ; header files
3249 `(,(cross-libc "i686-linux-gnu") "static")))
3250 (home-page "https://xenproject.org/")
3251 (synopsis "Hypervisor")
3252 (description "This package provides the Xen Virtual Machine Monitor
3253which is a hypervisor.")
3254 ;; TODO: Some files are licensed differently. List those.
3255 (license license:gpl2)
3256 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))))
3257
3258(define-public xen-guest-agent
3259 (package
3260 (name "xen-guest-agent")
3261 (version "0.4.0")
3262 (source (origin
3263 (method git-fetch)
3264 (uri (git-reference
3265 (url "https://gitlab.com/xen-project/xen-guest-agent")
3266 (commit version)))
3267 (file-name (git-file-name name version))
3268 (sha256
3269 (base32 "1ab6mgrvnd49m0ay9fbfyd02xaf3qvkwhyyavra4a7wpz0brg54h"))))
3270 (build-system cargo-build-system)
3271 (arguments
3272 (list #:install-source? #f))
3273 (native-inputs
3274 (list pkg-config
3275 xen ; Pull in Xen for libxenstore
3276 clang-13))
3277 (inputs (cargo-inputs 'xen-guest-agent))
3278 (home-page "https://gitlab.com/xen-project/xen-guest-agent")
3279 (synopsis "Provides guest VM information to hosting Xen hypervisor")
3280 (description "The agent gathers some guest information, and writes them to
3281xenstore so tooling in dom0 can read it. The default behavior is to be
3282compatible with the XAPI toolstack as currently used in XCP-ng and Citrix
3283Hypervisor/Xenserver, and thus roughly follow what @code{xe-guest-utilities}
3284is doing.")
3285 (license license:agpl3)))
3286
3287(define-public xe-guest-utilities
3288 (package
3289 (name "xe-guest-utilities")
3290 (version "8.4.0")
3291 (source (origin
3292 (method git-fetch)
3293 (uri (git-reference
3294 (url "https://github.com/xenserver/xe-guest-utilities")
3295 (commit (string-append "v" version))))
3296 (file-name (git-file-name name version))
3297 (sha256
3298 (base32
3299 "1yqspizhq3ii6cz2w75slaxy8838yyri9pmgc2q1radnm7w735if"))))
3300 (build-system go-build-system)
3301 (arguments
3302 (list
3303 #:import-path "github.com/xenserver/xe-guest-utilities"
3304 #:install-source? #f
3305 #:tests? #f ; There are no tests.
3306 #:phases
3307 #~(modify-phases %standard-phases
3308 ;; Despite using go-build-system, this project does not use Go's build
3309 ;; infrastructure to do anything, instead relying on a Makefile.
3310 ;; NOTE: This target builds a tarball, but it is only filled with
3311 ;; 2 binaries, 1 script, and a bunch of text files; it is tiny.
3312 (add-after 'patch-source-shebangs 'fix-udev-rule
3313 (lambda* (#:key inputs import-path #:allow-other-keys)
3314 (substitute* (string-append "src/" import-path "/mk/xen-vcpu-hotplug.rules")
3315 (("/bin/sh") (search-input-file inputs "/bin/sh")))))
3316 (replace 'build
3317 (lambda* (#:key import-path #:allow-other-keys)
3318 (with-directory-excursion (string-append "src/" import-path)
3319 ;; Explicitly state version, removes git as native-input.
3320 ;; NOTE: The final step of the Makefile's build target is to "cd"
3321 ;; to the final build directory.
3322 (invoke "make" (string-append "RELEASE=" #$version) "build"))))
3323 ;; The default "install" actions produce package-manager-specific
3324 ;; outputs, .deb, .rpm, and .tgz. We just copy the final build
3325 ;; products out.
3326 (replace 'install
3327 (lambda* (#:key outputs import-path #:allow-other-keys)
3328 (let* ((stage (string-append "src/" import-path "/build/stage"))
3329 (out (assoc-ref outputs "out")))
3330 ;; Put udev rules in #$output/lib/udev/rules.d/
3331 (copy-recursively (string-append stage "/etc/udev")
3332 (string-append out "/lib/udev"))
3333 ;; Copy produced binaries and scripts
3334 (copy-recursively (string-append stage "/usr") out)))))))
3335 (native-inputs (list go-golang-org-x-sys))
3336 (inputs (list bash-minimal))
3337 (home-page "https://github.com/xenserver/xe-guest-utilities")
3338 (synopsis "XenServer guest utilities for unix-like operating systems")
3339 (description "The XenServer guest utilities enable a Xen-based hypervisor,
3340(Citrix XenServer, XCP-NG, etc.) to work with a Xen-enabled Unix-like guest VMs.
3341This allows the guest to share information about its state back to the host,
3342such IP address, memory usage, etc. and allows the host to inform the guest VM
3343about events that change the virtualized hardware, such as hotplugging.")
3344 (license license:bsd-2)))
3345
3346(define-public osinfo-db-tools
3347 (package
3348 (name "osinfo-db-tools")
3349 (version "1.12.0")
3350 (source (origin
3351 (method url-fetch)
3352 (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-tools-"
3353 version ".tar.xz"))
3354
3355 (sha256
3356 (base32
3357 "1wz7fqvrqpw1bvp3f37n03xhxj4g1fr09vd8vqjhyxqqbmkmycgk"))))
3358 (build-system meson-build-system)
3359 (inputs
3360 (list libsoup-minimal-2 libxml2 libxslt json-glib libarchive))
3361 (native-inputs
3362 (list perl
3363 gobject-introspection
3364 gettext-minimal
3365 pkg-config
3366 ;; Tests
3367 python
3368 python-pytest
3369 python-requests))
3370 (home-page "https://gitlab.com/libosinfo/osinfo-db-tools")
3371 (synopsis "Tools for managing the osinfo database")
3372 (description "This package contains a set of tools to assist
3373administrators and developers in managing the database.")
3374 (license license:lgpl2.0+)))
3375
3376(define-public osinfo-db
3377 (package
3378 (name "osinfo-db")
3379 (version "20250124")
3380 (source
3381 (origin
3382 (method url-fetch)
3383 (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-"
3384 version ".tar.xz"))
3385 (sha256
3386 (base32 "0l3j4lxgixqys1zmqs195rlb181n2kfyz7mkl8sq2yasjzq1g9vw"))))
3387 (build-system trivial-build-system)
3388 (arguments
3389 (list
3390 #:modules '((guix build utils))
3391 #:builder
3392 #~(begin
3393 (use-modules (guix build utils))
3394 (let ((osinfo (string-append #$output "/share/osinfo"))
3395 (source (assoc-ref %build-inputs "source"))
3396 (import-osinfo-db
3397 (string-append #$(this-package-native-input "osinfo-db-tools")
3398 "/bin/osinfo-db-import")))
3399 (mkdir-p osinfo)
3400 (invoke import-osinfo-db "--dir" osinfo source)))))
3401 (native-inputs
3402 (list intltool osinfo-db-tools))
3403 (home-page "https://gitlab.com/libosinfo/osinfo-db")
3404 (synopsis "Database of information about operating systems")
3405 (description "Osinfo-db provides the database files for use with the
3406libosinfo library. It provides information about guest operating systems for
3407use with virtualization provisioning tools")
3408 (license license:lgpl2.0+)))
3409
3410(define-public python-transient
3411 (package
3412 (name "python-transient")
3413 (version "0.25")
3414 (source
3415 (origin
3416 (method git-fetch)
3417 (uri (git-reference
3418 (url "https://github.com/ALSchwalm/transient")
3419 (commit (string-append "v" version))))
3420 (file-name (git-file-name name version))
3421 (sha256
3422 (base32 "1c2v0z1amgfx747sqn8airq71bnp58syvsaqlazirahyn2yjg04d"))))
3423 (build-system pyproject-build-system)
3424 (arguments
3425 (list #:phases
3426 #~(modify-phases %standard-phases
3427 (add-after 'unpack 'fix-marshmallow-and-dependencies
3428 (lambda _
3429 ;; From marshmallow: versionchanged:: 3.13.0
3430 ;; Replace ``missing`` [..] with ``load_default``.
3431 (substitute* "transient/configuration.py"
3432 (("missing") "load_default"))
3433 (substitute* "setup.py"
3434 (("(~|=)=") ">=")
3435 (("lark-parser>=[0-9.]*") "lark")))))))
3436 (native-inputs
3437 (list python-pyhamcrest
3438 python-pytest
3439 python-setuptools
3440 python-wheel))
3441 (propagated-inputs
3442 (list python-beautifultable
3443 python-click
3444 python-importlib-resources
3445 python-lark
3446 python-marshmallow
3447 python-progressbar2
3448 python-requests
3449 python-toml))
3450 (home-page "https://github.com/ALSchwalm/transient")
3451 (synopsis "QEMU Wrapper written in Python")
3452 (description
3453 "@code{transient} is a wrapper for QEMU allowing the creation of virtual
3454machines with shared folder, ssh, and disk creation support.")
3455 (license license:expat)))
3456
3457(define-public riscv-pk
3458 ;; Last tag in 2019.
3459 (let ((commit "9c61d29846d8521d9487a57739330f9682d5b542")
3460 (revision "0"))
3461 (package
3462 (name "riscv-pk")
3463 (version (git-version "1.1.0" revision commit))
3464 (source
3465 (origin
3466 (method git-fetch)
3467 (uri (git-reference
3468 (url "https://github.com/riscv-software-src/riscv-pk")
3469 (commit commit)))
3470 (file-name (git-file-name name version))
3471 (sha256
3472 (base32
3473 "0k5ahxydxiaw2plcn3br70r8rskm0i3815jdrcywv6r8lb8xm2wd"))))
3474 (build-system gnu-build-system)
3475 (arguments
3476 (list #:out-of-source? #t
3477 ;; riscv-pk can only be built for riscv64.
3478 #:target "riscv64-linux-gnu"
3479 #:make-flags #~(list (string-append "INSTALLDIR=" #$output))
3480 ;; Add flags to keep symbols fromhost and tohost. These symbols are
3481 ;; required for the correct functioning of pk.
3482 #:strip-flags #~(list "--strip-unneeded"
3483 "--keep-symbol=fromhost"
3484 "--keep-symbol=tohost"
3485 "--enable-deterministic-archives")))
3486 (home-page "https://github.com/riscv-software-src/riscv-pk")
3487 (synopsis "RISC-V Proxy Kernel")
3488 (description "The RISC-V Proxy Kernel, @command{pk}, is a lightweight
3489application execution environment that can host statically-linked RISC-V ELF
3490binaries. It is designed to support tethered RISC-V implementations with
3491limited I/O capability and thus handles I/O-related system calls by proxying
3492them to a host computer.
3493
3494This package also contains the Berkeley Boot Loader, @command{bbl}, which is a
3495supervisor execution environment for tethered RISC-V systems. It is designed
3496to host the RISC-V Linux port.")
3497 (license license:bsd-3))))
3498
3499(define-public hivex
3500 (package
3501 (name "hivex")
3502 (version "1.3.24")
3503 (source (origin
3504 (method url-fetch)
3505 (uri (string-append "https://libguestfs.org/download/"
3506 name "/" name "-" version ".tar.gz"))
3507 (sha256
3508 (base32
3509 "0g0rib62qg81fda8lxsaa7a1ykqy4rl5sq185pdqm9y9xifa8bx5"))))
3510 (build-system gnu-build-system)
3511 (native-inputs (list automake-1.16.5
3512 autoconf
3513 gettext-minimal
3514 libtool
3515 ocaml
3516 pkg-config
3517 perl-io-stringy
3518 python-wrapper
3519 ruby
3520 ruby-rake
3521 ruby-rdoc))
3522 (inputs
3523 (list bash-minimal
3524 libxml2
3525 perl
3526 readline))
3527 (arguments
3528 (list
3529 #:configure-flags
3530 #~(list "--disable-static" "--with-readline" "--disable-rpath"
3531 (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib"))
3532 #:phases
3533 #~(modify-phases %standard-phases
3534 (add-after 'unpack 'patch-makefiles
3535 (lambda _
3536 (let* ((current-system (or #$(%current-target-system)
3537 #$(%current-system)))
3538 (ocamllib
3539 (string-append #$output "/lib/ocaml/"
3540 #$(package-version
3541 (this-package-native-input "ocaml")) "/site-lib"))
3542 (python-installdir
3543 (string-append #$output "/lib/python"
3544 #$(version-major+minor
3545 (package-version
3546 (this-package-native-input
3547 "python-wrapper")))
3548 "/site-packages"))
3549 (ruby-version
3550 #$(package-version
3551 (this-package-native-input "ruby")))
3552 (ruby-libdir
3553 (string-append #$output
3554 "/lib/ruby/site_ruby/"
3555 ruby-version))
3556 (ruby-archdir
3557 (string-append ruby-libdir "/" current-system)))
3558 (substitute* "lib/Makefile.am"
3559 (((string-append "\\$\\(VERSION_SCRIPT_FLAGS\\)"
3560 "\\$\\(srcdir\\)/hivex\\.syms"))
3561 ""))
3562 (substitute* "python/Makefile.am"
3563 (("\\$\\(PYTHON_INSTALLDIR\\)")
3564 python-installdir))
3565 (substitute* "ocaml/Makefile.am"
3566 (("\\$\\(DESTDIR\\)\\$\\(OCAMLLIB\\)")
3567 ocamllib))
3568 (substitute* "ruby/Makefile.am"
3569 (("\\$\\(DESTDIR\\)\\$\\(RUBY_ARCHDIR\\)")
3570 ruby-archdir)
3571 (("\\$\\(DESTDIR\\)\\$\\(RUBY_LIBDIR\\)")
3572 ruby-libdir))
3573 ;; The ‘validate-runpath’ phase fails to find libhivex.so.0.
3574 (substitute* "perl/Makefile.PL.in"
3575 (("CCFLAGS => \\$Config\\{ccflags\\} \\. ' @CFLAGS@',")
3576 (string-append "CCFLAGS => $Config{ccflags} . ' @CFLAGS@',
3577 LDDLFLAGS => $Config{lddlflags} . ' -Wl,-rpath," #$output "/lib',")))
3578 (substitute* "ruby/ext/hivex/extconf.rb"
3579 (("create_header")
3580 (string-append "
3581$LDFLAGS += \" -Wl,-rpath=" #$output "/lib \"
3582create_header"))))))
3583 (add-after 'install 'wrap-binaries
3584 (lambda _
3585 (let ((hivexregedit
3586 (string-append #$output "/bin/hivexregedit"))
3587 (hivexml
3588 (string-append #$output "/bin/hivexml")))
3589 (wrap-program hivexregedit
3590 `("PERL5LIB" ":" prefix
3591 (,(string-append #$output "/lib/perl5/site_perl")))
3592 `("PATH" ":" prefix
3593 (,(string-append #$output "/bin"))))
3594 (wrap-program hivexml
3595 `("PATH" ":" prefix
3596 (,(string-append #$output "/bin"))))))))))
3597 (home-page "https://github.com/libguestfs/hivex")
3598 (synopsis "Windows registry hive extraction library")
3599 (description
3600 "This package provides a self-contained library for reading and writing
3601Windows Registry \"hive\" binary files. Unlike many other tools in this area,
3602it doesn't use the textual @code{.REG} format for output, because parsing that
3603is as much trouble as parsing the original binary format. Instead it makes the
3604file available through a C API, or through a separate program to export the
3605hive as XML.")
3606 (license license:lgpl2.1)))
3607
3608(define-public libguestfs-minimal
3609 (package
3610 (name "libguestfs-minimal")
3611 (version "1.56.2")
3612 (source (origin
3613 (method url-fetch)
3614 (uri (string-append "https://download.libguestfs.org/"
3615 (version-major+minor version)
3616 "-stable/libguestfs-" version ".tar.gz"))
3617 (sha256
3618 (base32
3619 "16k8064zgmrh2xclax3j3yr69pd6jla4jb7f7hhpj2syg4d8ji5v"))
3620 (patches
3621 (search-patches "libguestfs-syms.patch"))))
3622 (build-system gnu-build-system)
3623 (arguments
3624 (list #:configure-flags
3625 #~(list "--disable-appliance"
3626 "--disable-daemon"
3627 "--disable-static"
3628 "--disable-erlang"
3629 "--disable-golang"
3630 "--disable-haskell"
3631 "--disable-java"
3632 "--disable-lua"
3633 ;; FIXME: Perl bindings have wrong rpath and break the
3634 ;; validate-runpath phase. Temporarily disable them until
3635 ;; a way is found to correctly patch perl/Build.PL.in.
3636 "--disable-perl"
3637 "--disable-php"
3638 "--with-distro=\"Guix System\""
3639 "--with-readline"
3640 (string-append "LDFLAGS=-Wl,-rpath," %output "/lib"))
3641 #:make-flags #~'("REALLY_INSTALL=yes")
3642 #:phases
3643 #~(let* ((lib (string-append #$output "/lib"))
3644 (lib/ocaml (string-append lib "/ocaml")))
3645 (modify-phases %standard-phases
3646 (add-after 'unpack 'patch-makefiles
3647 (lambda _
3648 (for-each patch-shebang
3649 (find-files "."))
3650 (substitute* "ocaml/Makefile.am"
3651 (("\\$\\(DESTDIR\\)\\$\\(INSTALL_OCAMLLIB\\)")
3652 lib/ocaml))
3653 ;; FIXME: Perl bindings have broken runpath,
3654 ;; this substitution doesn't seem to work.
3655 (substitute* "perl/Build.PL.in"
3656 (("extra_linker_flags => \\[")
3657 (string-append "extra_linker_flags => [
3658 '-L" lib "',")))))
3659 (replace 'bootstrap
3660 (lambda _
3661 (invoke "autoreconf" "-vif")))
3662 (replace 'check
3663 (lambda* (#:key tests? make-flags #:allow-other-keys)
3664 (when tests?
3665 (apply invoke `("make" ,@make-flags "check-direct")))))
3666 (replace 'install
3667 (lambda* (#:key make-flags #:allow-other-keys)
3668 (mkdir-p "temp-build-dir")
3669 (apply invoke `("make" ,@make-flags "INSTALLDIRS=vendor"
3670 "install"))))
3671 (add-after 'install 'wrap-binaries
3672 (lambda _
3673 (let ((bin (string-append #$output "/bin")))
3674 (for-each
3675 (lambda (binary)
3676 (use-modules (srfi srfi-1))
3677 (wrap-program binary
3678 `("PERL5LIB" ":" prefix
3679 (,(string-append #$output
3680 "/lib/perl5/site_perl")))
3681 `("PATH" ":" prefix
3682 ,(search-path-as-list
3683 '("bin")
3684 (map second
3685 '#$(package-inputs this-package))))))
3686 (find-files bin)))))
3687 (replace 'validate-documentation-location
3688 (lambda _
3689 (let ((man-dir
3690 (string-append #$output "/man"))
3691 (info-dir
3692 (string-append #$output "/info")))
3693 (for-each (lambda (d)
3694 (invoke "rm" "-rf" d))
3695 (list man-dir info-dir)))))))))
3696 (native-inputs (list augeas
3697 autoconf
3698 automake
3699 bison
3700 cpio
3701 flex
3702 gettext-minimal
3703 gperf
3704 libtool
3705 ocaml
3706 ocaml-findlib
3707 ncurses
3708 perl
3709 perl-getopt-long
3710 perl-module-build
3711 pkg-config
3712 po4a
3713 xorriso
3714 xz
3715 zstd
3716 (list zstd "lib")))
3717 (inputs
3718 (list file
3719 fuse
3720 json-c
3721 hivex
3722 libtirpc
3723 pcre2
3724 readline
3725 qemu))
3726 (home-page "https://libguestfs.org/")
3727 (synopsis "Access and modify virtual machine disk images")
3728 (description
3729 "@code{libguestfs} is a set of tools for accessing and modifying virtual
3730machine (VM) disk images. You can use this for viewing and editing files inside
3731guests, scripting changes to VMs, monitoring disk used/free statistics, creating
3732guests, P2V, V2V, performing backups, cloning VMs, building VMs, formatting
3733disks, resizing disks, and much more.")
3734 (license (list license:gpl2+ license:lgpl2.1+))))
3735
3736(define-public libguestfs
3737 (package/inherit libguestfs-minimal
3738 (name "libguestfs")
3739 (arguments
3740 (substitute-keyword-arguments arguments
3741 ((#:configure-flags flags)
3742 #~(append
3743 (filter
3744 (lambda (flag)
3745 (not (string-prefix? "LDFLAGS" flag)))
3746 #$flags)
3747 (list
3748 "--enable-vala=yes"
3749 (string-append "--with-python-installdir="
3750 #$output "/lib/python"
3751 #$(version-major+minor
3752 (package-version python))
3753 "/site-packages")
3754 (string-append "LDFLAGS=-Wl,-rpath," %output "/lib"))))
3755 ((#:phases phases)
3756 #~(modify-phases #$phases
3757 (add-after 'patch-makefiles 'patch-additional-makefiles
3758 (lambda _
3759 (let* ((current-system (or #$(%current-target-system)
3760 #$(%current-system)))
3761 (lib (string-append #$output "/lib"))
3762 (share (string-append #$output "/share"))
3763 (completions
3764 (string-append share "/bash-completion/completions"))
3765 (lib/lua (string-append lib "/lua"))
3766 (lib/ocaml (string-append lib "/ocaml"))
3767 (ruby-version
3768 #$(package-version
3769 (this-package-native-input "ruby")))
3770 (ruby-libdir
3771 (string-append lib
3772 "/ruby/site_ruby/"
3773 ruby-version))
3774 (ruby-archdir
3775 (string-append ruby-libdir "/" current-system)))
3776 (substitute* "m4/guestfs-bash-completion.m4"
3777 (("`pkg-config --variable=completionsdir bash-completion`")
3778 completions))
3779 (substitute* "lua/Makefile.am"
3780 (("\\$\\(DESTDIR\\)\\$\\(lualibdir\\)")
3781 lib/lua))
3782 (substitute* "ruby/Makefile.am"
3783 (("\\$\\(DESTDIR\\)\\$\\(RUBY_ARCHDIR\\)")
3784 ruby-archdir)
3785 (("\\$\\(DESTDIR\\)\\$\\(RUBY_LIBDIR\\)")
3786 ruby-libdir))
3787 ;; The ‘validate-runpath’ phase fails to find libguestfs.so.0.
3788 (substitute* "ruby/ext/guestfs/extconf.rb.in"
3789 (("create_header")
3790 (string-append "
3791$LDFLAGS += \" -Wl,-rpath=" #$output "/lib \"
3792create_header"))))))))))
3793 (native-inputs
3794 (modify-inputs native-inputs
3795 (prepend bash-completion
3796 gobject-introspection
3797 python
3798 ruby
3799 util-linux
3800 vala
3801 xorriso)))
3802 (inputs
3803 (modify-inputs inputs
3804 (prepend acl
3805 bdb
3806 fuse
3807 gmp
3808 libapparmor
3809 libcap
3810 libcap-ng
3811 libconfig
3812 libvirt
3813 libxcrypt
3814 numactl
3815 yajl)))))
3816
3817(define-public libtpms
3818 (package
3819 (name "libtpms")
3820 (version "0.10.2")
3821 (source
3822 (origin
3823 (method git-fetch)
3824 (uri (git-reference
3825 (url "https://github.com/stefanberger/libtpms")
3826 (commit (string-append "v" version))))
3827 (file-name (git-file-name name version))
3828 (sha256
3829 (base32 "190qnjp384a8i8jqh3xyxac7i3cbsbphbl6wk91kw5gzjymjj4aj"))
3830 (patches (search-patches "libtpms-pkgconfigdir.patch"))
3831 (snippet
3832 '(begin
3833 (delete-file "autogen.sh")
3834 (delete-file "bootstrap.sh")))))
3835 (build-system gnu-build-system)
3836 (home-page "https://github.com/stefanberger/libtpms")
3837 (arguments
3838 (list
3839 #:phases
3840 #~(modify-phases %standard-phases
3841 (add-after 'unpack 'drop-empty-pkg-installdir
3842 (lambda _
3843 (substitute* "configure.ac"
3844 ;; This causes a syntax error in the generated configure script.
3845 (("^PKG_INSTALLDIR\\(\\)") "")))))))
3846 (inputs (list openssl))
3847 (native-inputs (list autoconf-wrapper automake libtool
3848 ;; for pod2man
3849 perl))
3850 (synopsis "TPM emulation library")
3851 (description "The libtpms library provides software emulation of a
3852Trusted Platform Module (TPM 1.2 and TPM 2.0).")
3853 (license license:bsd-3)))
3854
3855(define-public virt-what
3856 (package
3857 (name "virt-what")
3858 (version "1.27")
3859 (source (origin
3860 (method url-fetch)
3861 (uri (string-append "https://people.redhat.com/~rjones/virt-what/"
3862 "files/" name "-" version ".tar.gz"))
3863 (sha256
3864 (base32
3865 "1wcvqs5g6b86bym75f1h8gmwf5ak95iwdyj3ficrb4759afvvnfl"))))
3866 (build-system gnu-build-system)
3867 (arguments
3868 (list #:phases
3869 #~(modify-phases %standard-phases
3870 (add-after 'install 'wrap-binaries
3871 (lambda* (#:key inputs #:allow-other-keys)
3872 (substitute* (string-append #$output "/sbin/virt-what")
3873 (("^PATH=\".*\"")
3874 (simple-format #f "PATH=\"~a\""
3875 (string-join
3876 (search-path-as-list '("bin" "sbin" "libexec")
3877 (cons #$output (map cdr inputs)))
3878 ":")))))))))
3879 (native-inputs
3880 (list perl))
3881 (inputs
3882 (list coreutils
3883 bash-minimal
3884 dmidecode
3885 util-linux
3886 which))
3887 (home-page "https://people.redhat.com/~rjones/virt-what/")
3888 (synopsis "Detect if running in a virtual machine")
3889 (description
3890 "@code{virt-what} is a program which can be used to detect if the program
3891is running in a virtual machine.
3892
3893The program prints out a list of \"facts\" about the virtual machine,
3894derived from heuristics. One fact is printed per line.")
3895 (license license:gpl2+)))