projects/guix·blob python-team · refs

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