projects/guix·blob ruby-team · refs

3889 lines · 168.9 KiB

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