1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2020 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015, 2016, 2017, 2018 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2016, 2017, 2018. 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2016, 2017 Ricardo Wurmus <rekado@elephly.net>
6 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
7 ;;; Copyright © 2017 Andy Patterson <ajpatter@uwaterloo.ca>
8 ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
9 ;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
10 ;;; Copyright © 2018 Danny Milosavljevic <dannym@scratchpost.org>
11 ;;; Copyright © 2018 Sou Bunnbu <iyzsong@member.fsf.org>
12 ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
13 ;;; Copyright © 2019 Guy Fleury Iteriteka <hoonandon@gmail.com>
14 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
15 ;;; Copyright © 2020, 2021 Brice Waegeneire <brice@waegenei.re>
16 ;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
17 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
18 ;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
19 ;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
20 ;;; Copyright © 2021 Leo Famulari <leo@famulari.name>
21 ;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
22 ;;; Copyright © 2021 Dion Mendel <guix@dm9.info>
24 ;;; This file is part of GNU Guix.
26 ;;; GNU Guix is free software; you can redistribute it and/or modify it
27 ;;; under the terms of the GNU General Public License as published by
28 ;;; the Free Software Foundation; either version 3 of the License, or (at
29 ;;; your option) any later version.
31 ;;; GNU Guix is distributed in the hope that it will be useful, but
32 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
33 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34 ;;; GNU General Public License for more details.
36 ;;; You should have received a copy of the GNU General Public License
37 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
39 (define-module (gnu packages virtualization)
40 #:use-module (gnu packages)
41 #:use-module (gnu packages acl)
42 #:use-module (gnu packages admin)
43 #:use-module (gnu packages assembly)
44 #:use-module (gnu packages attr)
45 #:use-module (gnu packages autotools)
46 #:use-module (gnu packages backup)
47 #:use-module (gnu packages base)
48 #:use-module (gnu packages bash)
49 #:use-module (gnu packages bison)
50 #:use-module (gnu packages build-tools)
51 #:use-module (gnu packages check)
52 #:use-module (gnu packages cmake)
53 #:use-module (gnu packages compression)
54 #:use-module (gnu packages cross-base)
55 #:use-module (gnu packages curl)
56 #:use-module (gnu packages cyrus-sasl)
57 #:use-module (gnu packages debian)
58 #:use-module (gnu packages disk)
59 #:use-module (gnu packages dns)
60 #:use-module (gnu packages docbook)
61 #:use-module (gnu packages documentation)
62 #:use-module (gnu packages figlet)
63 #:use-module (gnu packages file-systems)
64 #:use-module (gnu packages firmware)
65 #:use-module (gnu packages flex)
66 #:use-module (gnu packages fontutils)
67 #:use-module (gnu packages freedesktop)
68 #:use-module (gnu packages gettext)
69 #:use-module (gnu packages gl)
70 #:use-module (gnu packages glib)
71 #:use-module (gnu packages gnome)
72 #:use-module (gnu packages gnupg)
73 #:use-module (gnu packages golang)
74 #:use-module (gnu packages graphviz)
75 #:use-module (gnu packages gtk)
76 #:use-module (gnu packages haskell)
77 #:use-module (gnu packages haskell-apps)
78 #:use-module (gnu packages haskell-check)
79 #:use-module (gnu packages haskell-crypto)
80 #:use-module (gnu packages haskell-web)
81 #:use-module (gnu packages haskell-xyz)
82 #:use-module (gnu packages image)
83 #:use-module (gnu packages libbsd)
84 #:use-module (gnu packages libusb)
85 #:use-module (gnu packages linux)
86 #:use-module (gnu packages m4)
87 #:use-module (gnu packages ncurses)
88 #:use-module (gnu packages nettle)
89 #:use-module (gnu packages networking)
90 #:use-module (gnu packages ninja)
91 #:use-module (gnu packages onc-rpc)
92 #:use-module (gnu packages package-management)
93 #:use-module (gnu packages perl)
94 #:use-module (gnu packages pcre)
95 #:use-module (gnu packages pkg-config)
96 #:use-module (gnu packages polkit)
97 #:use-module (gnu packages protobuf)
98 #:use-module (gnu packages python)
99 #:use-module (gnu packages python-build)
100 #:use-module (gnu packages python-check)
101 #:use-module (gnu packages python-crypto)
102 #:use-module (gnu packages python-web)
103 #:use-module (gnu packages python-xyz)
104 #:use-module (gnu packages pulseaudio)
105 #:use-module (gnu packages readline)
106 #:use-module (gnu packages selinux)
107 #:use-module (gnu packages sdl)
108 #:use-module (gnu packages sphinx)
109 #:use-module (gnu packages spice)
110 #:use-module (gnu packages ssh)
111 #:use-module (gnu packages texinfo)
112 #:use-module (gnu packages textutils)
113 #:use-module (gnu packages tls)
114 #:use-module (gnu packages web)
115 #:use-module (gnu packages wget)
116 #:use-module (gnu packages xdisorg)
117 #:use-module (gnu packages xml)
118 #:use-module (gnu packages xorg)
119 #:use-module (guix build-system cmake)
120 #:use-module (guix build-system gnu)
121 #:use-module (guix build-system go)
122 #:use-module (guix build-system meson)
123 #:use-module (guix build-system python)
124 #:use-module (guix build-system trivial)
125 #:use-module (guix download)
126 #:use-module (guix git-download)
127 #:use-module ((guix licenses) #:prefix license:)
128 #:use-module (guix packages)
129 #:use-module (guix utils)
130 #:use-module (srfi srfi-1)
131 #:use-module (srfi srfi-26)
132 #:use-module (ice-9 match))
134 (define (qemu-patch commit file-name sha256-bv)
135 "Return an origin for COMMIT."
139 "http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h="
141 (hash (content-hash sha256-bv sha256))
142 (file-name file-name)))
151 (uri (string-append "https://download.qemu.org/qemu-"
155 "1f9hz8rf12jm8baa7kda34yl4hyl0xh0c4ap03krfjx23i3img47"))
156 (patches (search-patches "qemu-CVE-2021-20203.patch"
157 "qemu-meson-compat.patch"
158 "qemu-sphinx-compat.patch"
159 "qemu-build-info-manual.patch"))
160 (modules '((guix build utils)))
163 ;; Delete the bundled meson copy.
164 (delete-file-recursively "meson")))))
165 (outputs '("out" "static" "doc")) ;5.3 MiB of HTML docs
166 (build-system gnu-build-system)
168 ;; FIXME: Disable tests on i686 to work around
169 ;; <https://bugs.gnu.org/40527>.
170 `(#:tests? ,(or (%current-target-system)
171 (not (string=? "i686-linux" (%current-system))))
173 (let ((gcc (string-append (assoc-ref %build-inputs "gcc") "/bin/gcc"))
174 (out (assoc-ref %outputs "out")))
175 (list (string-append "--cc=" gcc)
176 ;; Some architectures insist on using HOST_CC.
177 (string-append "--host-cc=" gcc)
178 (string-append "--prefix=" out)
180 (string-append "--smbd=" out "/libexec/samba-wrapper")
181 "--disable-debug-info" ;for space considerations
182 ;; The binaries need to be linked against -lrt.
183 (string-append "--extra-ldflags=-lrt")))
184 ;; Make build and test output verbose to facilitate investigation upon failure.
185 #:make-flags '("V=1")
186 #:modules ((srfi srfi-1)
190 ,@%gnu-build-system-modules)
192 (modify-phases %standard-phases
193 (add-after 'unpack 'extend-test-time-outs
195 ;; These tests can time out on heavily-loaded and/or slow storage.
196 (substitute* (cons* "tests/qemu-iotests/common.qemu"
197 (find-files "tests/qemu-iotests" "^[0-9]+$"))
198 (("QEMU_COMM_TIMEOUT=[0-9]+" match)
199 (string-append match "9")))))
200 (add-after 'unpack 'disable-unusable-tests
202 (substitute* "tests/unit/meson.build"
203 ;; Comment out the test-qga test, which needs /sys and
204 ;; fails within the build environment.
205 (("tests.*test-qga.*$" all)
206 (string-append "# " all))
207 ;; Comment out the test-char test, which needs networking and
208 ;; fails within the build environment.
209 ((".*'test-char':.*" all)
210 (string-append "# " all)))))
211 (add-after 'patch-source-shebangs 'patch-embedded-shebangs
213 ;; Ensure the executables created by these source files reference
214 ;; /bin/sh from the store so they work inside the build container.
215 (substitute* '("block/cloop.c" "migration/exec.c"
216 "net/tap.c" "tests/qtest/libqtest.c")
217 (("/bin/sh") (which "sh")))
218 (substitute* "Makefile"
219 (("SHELL = /usr/bin/env bash -o pipefail")
220 "SHELL = bash -o pipefail"))
221 (substitute* "tests/qemu-iotests/check"
222 (("#!/usr/bin/env python3")
223 (string-append "#!" (which "python3"))))))
224 (add-before 'configure 'fix-optionrom-makefile
226 ;; Work around the inability of the rules defined in this
227 ;; Makefile to locate the firmware files (e.g.: No rule to make
228 ;; target 'multiboot.bin') by extending the VPATH.
229 (substitute* "pc-bios/optionrom/Makefile"
230 (("^VPATH = \\$\\(SRC_DIR\\)")
231 "VPATH = $(SRC_DIR):$(TOPSRC_DIR)/pc-bios"))))
232 ;; XXX ./configure is being re-run at beginning of build phase...
234 (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
235 ;; The `configure' script doesn't understand some of the
236 ;; GNU options. Thus, add a new phase that's compatible.
237 (let ((out (assoc-ref outputs "out")))
238 (setenv "SHELL" (which "bash"))
239 ;; Ensure config.status gets the correct shebang off the bat.
240 ;; The build system gets confused if we change it later and
241 ;; attempts to re-run the whole configuration, and fails.
242 (substitute* "configure"
244 (string-append "#!" (which "sh"))))
247 (apply invoke "../../configure" configure-flags))))
248 ;; Configure, build and install QEMU user-emulation static binaries.
249 (add-after 'configure 'configure-user-static
250 (lambda* (#:key inputs outputs #:allow-other-keys)
251 (let* ((gcc (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
252 (static (assoc-ref outputs "static"))
253 ;; This is the common set of configure flags; it is
254 ;; duplicated here to isolate this phase from manipulations
255 ;; to the #:configure-flags build argument, as done in
256 ;; derived packages such as qemu-minimal.
257 (configure-flags (list (string-append "--cc=" gcc)
258 (string-append "--host-cc=" gcc)
260 "--disable-debug-info")))
261 (mkdir-p "../user-static")
262 (with-directory-excursion "../user-static"
263 (apply invoke "../../configure"
265 "--disable-docs" ;already built
267 "--enable-linux-user"
268 (string-append "--prefix=" static)
270 (add-after 'build 'build-user-static
272 (with-directory-excursion "../user-static"
273 (apply (assoc-ref %standard-phases 'build) args))))
274 (add-after 'install 'install-user-static
275 (lambda* (#:key outputs #:allow-other-keys)
276 (let* ((static (assoc-ref outputs "static"))
277 (bin (string-append static "/bin")))
278 (with-directory-excursion "../user-static"
279 (for-each (cut install-file <> bin)
280 (append-map (cut find-files <> "^qemu-" #:stat stat)
283 "-linux-user" <>))))))))
284 ;; Create a wrapper for Samba. This allows QEMU to use Samba without
285 ;; pulling it in as an input. Note that you need to explicitly install
286 ;; Samba in your Guix profile for Samba support.
287 (add-after 'install 'create-samba-wrapper
288 (lambda* (#:key inputs outputs #:allow-other-keys)
289 (let* ((out (assoc-ref outputs "out"))
290 (libexec (string-append out "/libexec")))
291 (call-with-output-file "samba-wrapper"
293 (format port "#!/bin/sh
295 (chmod "samba-wrapper" #o755)
296 (install-file "samba-wrapper" libexec))))
297 (add-after 'install 'move-html-doc
298 (lambda* (#:key inputs outputs #:allow-other-keys)
299 (let* ((out (assoc-ref outputs "out"))
300 (doc (assoc-ref outputs "doc"))
301 (qemu-doc (string-append doc "/share/doc/qemu-" ,version)))
303 (rename-file (string-append out "/share/doc/qemu")
304 (string-append qemu-doc "/html"))))))))
305 (inputs ; TODO: Add optional inputs.
306 `(("alsa-lib" ,alsa-lib)
312 ("libcacard" ,libcacard) ; smartcard support
313 ("libcap-ng" ,libcap-ng) ; virtfs support requires libcap-ng & libattr
315 ("libepoxy" ,libepoxy)
316 ("libjpeg" ,libjpeg-turbo)
318 ("libseccomp" ,libseccomp)
319 ("libusb" ,libusb) ;USB pass-through support
322 ;; ("pciutils" ,pciutils)
324 ("pulseaudio" ,pulseaudio)
327 ("usbredir" ,usbredir)
328 ("util-linux" ,util-linux)
330 ("virglrenderer" ,virglrenderer)
332 (native-inputs `(("gettext" ,gettext-minimal)
333 ("glib:bin" ,glib "bin") ; gtester, etc.
337 ;; Using meson 0.57.1 enables reproducible QEMU builds.
338 ("meson" ,meson-next)
340 ("pkg-config" ,pkg-config)
341 ("python-wrapper" ,python-wrapper)
342 ("python-sphinx" ,python-sphinx)
344 ;; The following static libraries are required to build
345 ;; the static output of QEMU.
346 ("glib-static" ,glib-static)
347 ("pcre:static" ,pcre "static")
348 ("zlib:static" ,zlib "static")))
349 (home-page "https://www.qemu.org")
350 (synopsis "Machine emulator and virtualizer")
352 "QEMU is a generic machine emulator and virtualizer.
354 When used as a machine emulator, QEMU can run OSes and programs made for one
355 machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
356 using dynamic translation, it achieves very good performance.
358 When used as a virtualizer, QEMU achieves near native performances by
359 executing the guest code directly on the host CPU. QEMU supports
360 virtualization when executing under the Xen hypervisor or using
361 the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
362 server and embedded PowerPC, and S390 guests.")
364 ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
365 (license license:gpl2)
367 ;; Several tests fail on MIPS; see <http://hydra.gnu.org/build/117914>.
368 (supported-systems (fold delete %supported-systems
369 '("mips64el-linux" "i586-gnu")))))
371 (define-public qemu-minimal
372 ;; QEMU without GUI support, only supporting the host's architecture
375 (name "qemu-minimal")
377 "Machine emulator and virtualizer (without GUI) for the host architecture")
379 (substitute-keyword-arguments (package-arguments qemu)
380 ((#:configure-flags configure-flags '(list))
381 ;; Restrict to the host's architecture.
382 (let* ((system (or (%current-target-system)
386 ((? (cut string-prefix? "i686" <>))
387 "--target-list=i386-softmmu")
388 ((? (cut string-prefix? "x86_64" <>))
389 "--target-list=i386-softmmu,x86_64-softmmu")
390 ((? (cut string-prefix? "mips64" <>))
391 (string-append "--target-list=mips-softmmu,mipsel-softmmu,"
392 "mips64-softmmu,mips64el-softmmu"))
393 ((? (cut string-prefix? "mips" <>))
394 "--target-list=mips-softmmu,mipsel-softmmu")
395 ((? (cut string-prefix? "aarch64" <>))
396 "--target-list=arm-softmmu,aarch64-softmmu")
397 ((? (cut string-prefix? "arm" <>))
398 "--target-list=arm-softmmu")
399 ((? (cut string-prefix? "alpha" <>))
400 "--target-list=alpha-softmmu")
401 ((? (cut string-prefix? "powerpc64" <>))
402 "--target-list=ppc-softmmu,ppc64-softmmu")
403 ((? (cut string-prefix? "powerpc" <>))
404 "--target-list=ppc-softmmu")
405 ((? (cut string-prefix? "s390" <>))
406 "--target-list=s390x-softmmu")
407 ((? (cut string-prefix? "riscv" <>))
408 "--target-list=riscv32-softmmu,riscv64-softmmu")
409 (else ; An empty list actually builds all the targets.
411 `(cons ,target-list-arg ,configure-flags)))))
413 ;; Remove dependencies on optional libraries, notably GUI libraries.
414 (native-inputs (fold alist-delete (package-native-inputs qemu)
416 (inputs (fold alist-delete (package-inputs qemu)
417 '("libusb" "mesa" "sdl2" "spice" "virglrenderer" "gtk+"
418 "usbredir" "libdrm" "libepoxy" "pulseaudio" "vde2"
421 (define (system->qemu-target system)
423 ((string-prefix? "i686" system)
425 ((string-prefix? "arm" system)
428 (string-append "qemu-system-" (match (string-split system #\-)
432 (define-public ganeti
435 ;; Note: we use a pre-release for Python 3 compatibility as well as many
437 (version "3.0.0beta1-24-g024cc9fa2")
441 (url "https://github.com/ganeti/ganeti")
442 (commit (string-append "v" version))))
444 (base32 "1ll34qd2mifni3bhg7cnir3xfnkafig8ch33qndqwrsby0y5ssia"))
445 (file-name (git-file-name name version))
446 (patches (search-patches "ganeti-shepherd-support.patch"
447 "ganeti-shepherd-master-failover.patch"
448 "ganeti-deterministic-manual.patch"
449 "ganeti-drbd-compat.patch"
450 "ganeti-os-disk-size.patch"
451 "ganeti-haskell-pythondir.patch"
452 "ganeti-disable-version-symlinks.patch"
453 "ganeti-preserve-PYTHONPATH.patch"))))
454 (build-system gnu-build-system)
456 `(#:imported-modules (,@%gnu-build-system-modules
457 (guix build haskell-build-system)
458 (guix build python-build-system))
459 #:modules (,@%gnu-build-system-modules
460 ((guix build haskell-build-system) #:prefix haskell:)
461 ((guix build python-build-system) #:select (python-version))
464 ;; The default test target includes a lot of checks that are only really
465 ;; relevant for developers such as NEWS file checking, line lengths, etc.
466 ;; We are only interested in the "py-tests" and "hs-tests" targets: this
467 ;; is the closest we've got even though it includes a little more.
468 #:test-target "check-TESTS"
471 (list "--localstatedir=/var"
472 "--sharedstatedir=/var"
474 "--enable-haskell-tests"
476 ;; By default, the build system installs everything to versioned
477 ;; directories such as $libdir/3.0 and relies on a $libdir/default
478 ;; symlink pointed from /etc/ganeti/{lib,share} to actually function.
479 ;; This is done to accommodate installing multiple versions in
480 ;; parallel, but is of little use to us as Guix users can just
481 ;; roll back and forth. Thus, disable it for simplicity.
482 "--disable-version-links"
484 ;; Ganeti can optionally take control over SSH host keys and
485 ;; distribute them to nodes as they are added, and also rotate keys
486 ;; with 'gnt-cluster renew-crypto --new-ssh-keys'. Thus it needs to
487 ;; know how to restart the SSH daemon.
488 "--with-sshd-restart-command='herd restart ssh-daemon'"
490 ;; Look for OS definitions in this directory by default. It can
491 ;; be changed in the cluster configuration.
492 "--with-os-search-path=/run/current-system/profile/share/ganeti/os"
494 ;; The default QEMU executable to use. We don't use the package
495 ;; here because this entry is stored in the cluster configuration.
496 (string-append "--with-kvm-path=/run/current-system/profile/bin/"
497 ,(system->qemu-target (%current-system))))
499 (modify-phases %standard-phases
500 (add-after 'unpack 'create-vcs-version
502 ;; If we are building from a git checkout, we need to create a
503 ;; 'vcs-version' file manually because the build system does
504 ;; not have access to the git repository information.
505 (unless (file-exists? "vcs-version")
506 (call-with-output-file "vcs-version"
508 (format port "v~a~%" ,version))))
510 (add-after 'unpack 'patch-absolute-file-names
512 (substitute* '("lib/utils/process.py"
514 "src/Ganeti/Constants.hs"
515 "src/Ganeti/HTools/CLI.hs"
516 "test/py/ganeti.config_unittest.py"
517 "test/py/ganeti.hooks_unittest.py"
518 "test/py/ganeti.utils.process_unittest.py"
519 "test/py/ganeti.utils.text_unittest.py"
520 "test/py/ganeti.utils.wrapper_unittest.py")
521 (("/bin/sh") (which "sh"))
522 (("/bin/bash") (which "bash"))
523 (("/usr/bin/env") (which "env"))
524 (("/bin/true") (which "true")))
526 ;; This script is called by the node daemon at startup to perform
527 ;; sanity checks on the cluster IP addresses, and it is also used
528 ;; in a master-failover scenario. Add absolute references to
529 ;; avoid propagating these executables.
530 (substitute* "tools/master-ip-setup"
531 (("arping") (which "arping"))
532 (("ndisc6") (which "ndisc6"))
533 (("fping") (which "fping"))
534 (("grep") (which "grep"))
535 (("ip addr") (string-append (which "ip") " addr")))
537 (add-after 'unpack 'override-builtin-PATH
539 ;; Ganeti runs OS install scripts and similar with a built-in
540 ;; hard coded PATH. Patch so it works on Guix System.
541 (substitute* "src/Ganeti/Constants.hs"
542 (("/sbin:/bin:/usr/sbin:/usr/bin")
543 "/run/setuid-programs:/run/current-system/profile/sbin:\
544 /run/current-system/profile/bin"))
546 (add-after 'bootstrap 'patch-sphinx-version-detection
548 ;; The build system runs 'sphinx-build --version' to verify that
549 ;; the Sphinx is recent enough, but does not expect the
550 ;; .sphinx-build-real executable name created by the Sphinx wrapper.
551 (substitute* "configure"
552 (("\\$SPHINX --version 2>&1")
553 "$SPHINX --version 2>&1 | sed 's/.sphinx-build-real/sphinx-build/g'"))
556 ;; The build system invokes Cabal and GHC, which do not work with
557 ;; GHC_PACKAGE_PATH: <https://github.com/haskell/cabal/issues/3728>.
558 ;; Tweak the build system to do roughly what haskell-build-system does.
559 (add-before 'configure 'configure-haskell
560 (assoc-ref haskell:%standard-phases 'setup-compiler))
561 (add-after 'configure 'do-not-use-GHC_PACKAGE_PATH
563 (unsetenv "GHC_PACKAGE_PATH")
564 (substitute* "Makefile"
566 "$(CABAL) --package-db=../package.conf.d")
568 "$(GHC) -package-db=../package.conf.d"))
570 (add-after 'configure 'make-ghc-use-shared-libraries
572 (substitute* "Makefile"
573 (("HFLAGS =") "HFLAGS = -dynamic -fPIC"))
575 (add-after 'configure 'fix-installation-directories
577 (substitute* "Makefile"
578 ;; Do not attempt to create /var during install.
579 (("\\$\\(DESTDIR\\)\\$\\{localstatedir\\}")
580 "$(DESTDIR)${prefix}${localstatedir}")
581 ;; Similarly, do not attempt to install the sample ifup scripts
583 (("\\$\\(DESTDIR\\)\\$\\(ifupdir\\)")
584 "$(DESTDIR)${prefix}$(ifupdir)"))
586 (add-before 'build 'adjust-tests
588 ;; Disable tests that can not run. Do it early to prevent
589 ;; touching the Makefile later and triggering a needless rebuild.
590 (substitute* "Makefile"
591 ;; These tests expect the presence of a 'root' user (via
592 ;; ganeti/runtime.py), which fails in the build environment.
593 (("test/py/ganeti\\.asyncnotifier_unittest\\.py") "")
594 (("test/py/ganeti\\.backend_unittest\\.py") "")
595 (("test/py/ganeti\\.daemon_unittest\\.py") "")
596 (("test/py/ganeti\\.tools\\.ensure_dirs_unittest\\.py") "")
597 (("test/py/ganeti\\.utils\\.io_unittest-runasroot\\.py") "")
598 ;; Disable the bash_completion test, as it requires the full
599 ;; bash instead of bash-minimal.
600 (("test/py/bash_completion\\.bash")
602 ;; This test requires networking.
603 (("test/py/import-export_unittest\\.bash")
606 ;; Many of the Makefile targets reset PYTHONPATH before running
607 ;; the Python interpreter, which does not work very well for us.
608 (substitute* "Makefile"
610 (string-append "PYTHONPATH=" (getenv "PYTHONPATH") ":")))
612 (add-after 'build 'build-bash-completions
614 (let ((orig-pythonpath (getenv "PYTHONPATH")))
615 (setenv "PYTHONPATH" (string-append ".:" orig-pythonpath))
616 (invoke "./autotools/build-bash-completion")
617 (setenv "PYTHONPATH" orig-pythonpath)
619 (add-before 'check 'pre-check
620 (lambda* (#:key inputs #:allow-other-keys)
621 ;; Set TZDIR so that time zones are found.
622 (setenv "TZDIR" (string-append (assoc-ref inputs "tzdata")
625 ;; This test checks whether PYTHONPATH is untouched, and extends
626 ;; it to include test directories if so. Add an else branch for
627 ;; our modified PYTHONPATH, in order to prevent a confusing test
628 ;; failure where expired certificates are not cleaned because
629 ;; check-cert-expired is silently crashing.
630 (substitute* "test/py/ganeti-cleaner_unittest.bash"
631 (("then export PYTHONPATH=(.*)" all testpath)
632 (string-append all "else export PYTHONPATH="
633 (getenv "PYTHONPATH") ":" testpath "\n")))
635 (substitute* "test/py/ganeti.utils.process_unittest.py"
636 ;; This test attempts to run an executable with
637 ;; RunCmd(..., reset_env=True), which fails because the default
638 ;; PATH from Constants.hs does not exist in the build container.
639 ((".*def testResetEnv.*" all)
640 (string-append " @unittest.skipIf(True, "
641 "\"cannot reset env in the build container\")\n"
644 ;; XXX: Somehow this test fails in the build container, but
645 ;; works in 'guix environment -C', even without /bin/sh?
646 ((".*def testPidFile.*" all)
647 (string-append " @unittest.skipIf(True, "
648 "\"testPidFile fails in the build container\")\n"
651 ;; XXX: Why are these links not added automatically.
652 (with-directory-excursion "test/hs"
653 (for-each (lambda (file)
654 (symlink "../../src/htools" file))
655 '("hspace" "hscan" "hinfo" "hbal" "hroller"
656 "hcheck" "hail" "hsqueeze")))
658 (add-after 'install 'install-bash-completions
659 (lambda* (#:key outputs #:allow-other-keys)
660 (let* ((out (assoc-ref outputs "out"))
661 (compdir (string-append out "/etc/bash_completion.d")))
663 (copy-file "doc/examples/bash_completion"
664 (string-append compdir "/ganeti"))
665 ;; The one file contains completions for many different
666 ;; executables. Create symlinks for found completions.
667 (with-directory-excursion compdir
669 (lambda (prog) (symlink "ganeti" prog))
670 (call-with-input-file "ganeti"
672 (let loop ((line (read-line port))
674 (if (eof-object? line)
676 (if (string-prefix? "complete" line)
677 (loop (read-line port)
678 ;; Extract "prog" from lines of the form:
679 ;; "complete -F _prog -o filenames prog".
680 ;; Note that 'burnin' is listed with the
681 ;; absolute file name, which is why we
682 ;; run everything through 'basename'.
683 (cons (basename (car (reverse (string-split
686 (loop (read-line port) progs))))))))
688 ;; Wrap all executables with PYTHONPATH. We can't borrow the phase
689 ;; from python-build-system because we also need to wrap the scripts
690 ;; in $out/lib/ganeti such as "node-daemon-setup".
691 (add-after 'install 'wrap
692 (lambda* (#:key inputs outputs #:allow-other-keys)
693 (let* ((out (assoc-ref outputs "out"))
694 (sbin (string-append out "/sbin"))
695 (lib (string-append out "/lib"))
696 (python (assoc-ref inputs "python"))
697 (major+minor (python-version python))
698 (PYTHONPATH (string-append lib "/python" major+minor
700 (getenv "PYTHONPATH"))))
701 (define (shell-script? file)
702 (call-with-ascii-input-file file
704 (let ((shebang (false-if-exception (read-line port))))
706 (string-prefix? "#!" shebang)
707 (or (string-contains shebang "/bin/bash")
708 (string-contains shebang "/bin/sh")))))))
711 ;; Do not wrap shell scripts because some are meant to be
712 ;; sourced, which breaks if they are wrapped. We do wrap
713 ;; the Haskell executables because some call out to Python
715 (and (executable-file? file)
716 (not (symbolic-link? file))
717 (not (shell-script? file))))
719 (for-each (lambda (file)
721 `("PYTHONPATH" ":" prefix (,PYTHONPATH))))
723 (append (find-files (string-append lib "/ganeti"))
728 ("cabal" ,cabal-install)
731 ;; These inputs are necessary to bootstrap the package, because we
732 ;; have patched the build system.
733 ("autoconf" ,autoconf)
734 ("automake" ,automake)
736 ;; For the documentation.
737 ("python-docutils" ,python-docutils)
738 ("sphinx" ,python-sphinx)
742 ;; Test dependencies.
743 ("fakeroot" ,fakeroot)
744 ("ghc-temporary" ,ghc-temporary)
745 ("ghc-test-framework" ,ghc-test-framework)
746 ("ghc-test-framework-hunit" ,ghc-test-framework-hunit)
747 ("ghc-test-framework-quickcheck2" ,ghc-test-framework-quickcheck2)
748 ("python-mock" ,python-mock)
749 ("python-pyyaml" ,python-pyyaml)
752 ("shelltestrunner" ,shelltestrunner)
753 ("tzdata" ,tzdata-for-tests)))
755 `(("arping" ,iputils) ;must be the iputils version
758 ("iproute2" ,iproute)
761 ("qemu" ,qemu-minimal) ;for qemu-img
762 ("ghc-attoparsec" ,ghc-attoparsec)
763 ("ghc-base64-bytestring" ,ghc-base64-bytestring)
764 ("ghc-cryptonite" ,ghc-cryptonite)
765 ("ghc-curl" ,ghc-curl)
766 ("ghc-hinotify" ,ghc-hinotify)
767 ("ghc-hslogger" ,ghc-hslogger)
768 ("ghc-json" ,ghc-json)
769 ("ghc-lens" ,ghc-lens)
770 ("ghc-lifted-base" ,ghc-lifted-base)
771 ("ghc-network" ,ghc-network)
772 ("ghc-old-time" ,ghc-old-time)
773 ("ghc-psqueue" ,ghc-psqueue)
774 ("ghc-regex-pcre" ,ghc-regex-pcre)
775 ("ghc-utf8-string" ,ghc-utf8-string)
776 ("ghc-zlib" ,ghc-zlib)
778 ;; For the optional metadata daemon.
779 ("ghc-snap-core" ,ghc-snap-core)
780 ("ghc-snap-server" ,ghc-snap-server)
783 ("python-pyopenssl" ,python-pyopenssl)
784 ("python-simplejson" ,python-simplejson)
785 ("python-pyparsing" ,python-pyparsing)
786 ("python-pyinotify" ,python-pyinotify)
787 ("python-pycurl" ,python-pycurl)
788 ("python-bitarray" ,python-bitarray)
789 ("python-paramiko" ,python-paramiko)
790 ("python-psutil" ,python-psutil)))
791 (home-page "https://www.ganeti.org/")
792 (synopsis "Cluster-based virtual machine management system")
794 "Ganeti is a virtual machine management tool built on top of existing
795 virtualization technologies such as Xen or KVM. Ganeti controls:
798 @item Disk creation management;
799 @item Operating system installation for instances (in co-operation with
800 OS-specific install scripts); and
801 @item Startup, shutdown, and failover between physical systems.
804 Ganeti is designed to facilitate cluster management of virtual servers and
805 to provide fast and simple recovery after physical failures, using
806 commodity hardware.")
807 (license license:bsd-2)))
809 (define-public ganeti-instance-guix
811 (name "ganeti-instance-guix")
813 (home-page "https://github.com/mbakke/ganeti-instance-guix")
816 (uri (git-reference (url home-page) (commit version)))
817 (file-name (git-file-name name version))
820 "0aa08irpcpns6mhjgsplc5f0p8ab1qcr9ah1gj5z66kxgqyflzrp"))))
821 (build-system gnu-build-system)
823 '(#:configure-flags '("--sysconfdir=/etc" "--localstatedir=/var")))
825 `(("autoconf" ,autoconf)
826 ("automake" ,automake)))
828 `(("util-linux" ,util-linux)
829 ("qemu-img" ,qemu-minimal)))
830 (synopsis "Guix OS integration for Ganeti")
832 "This package provides a guest OS definition for Ganeti that uses
833 Guix to build virtual machines.")
834 (license license:gpl3+)))
836 (define-public ganeti-instance-debootstrap
838 (name "ganeti-instance-debootstrap")
839 ;; We need two commits on top of the latest release for compatibility
840 ;; with newer sfdisk, as well as gnt-network integration.
841 (version "0.16-2-ge145396")
842 (home-page "https://github.com/ganeti/instance-debootstrap")
845 (uri (git-reference (url home-page) (commit version)))
846 (file-name (git-file-name name version))
849 "0f2isw9d8lawzj21rrq1q9xhq8xfa65rqbhqmrn59z201x9q1336"))))
850 (build-system gnu-build-system)
852 '(#:configure-flags '("--sysconfdir=/etc" "--localstatedir=/var")
853 #:phases (modify-phases %standard-phases
854 (add-after 'unpack 'add-absolute-references
856 (substitute* "common.sh.in"
857 (("/sbin/blkid") (which "blkid"))
859 (string-append (which "kpartx") " -")))
860 (substitute* "import"
862 (string-append (which "restore") " -r")))
863 (substitute* "export"
865 (string-append (which "dump") " -0")))
866 (substitute* "create"
867 (("debootstrap") (which "debootstrap"))
868 (("`which run-parts`") (which "run-parts"))
869 ;; Here we actually need to hard code /bin/passwd
870 ;; because it's called via chroot, which fails if
871 ;; "/bin" is not in PATH.
872 (("passwd") "/bin/passwd"))
874 (add-after 'unpack 'set-dpkg-arch
875 (lambda* (#:key system #:allow-other-keys)
876 ;; The create script passes --arch to debootstrap,
877 ;; and defaults to `dpkg --print-architecture` when
878 ;; ARCH is not set in variant.conf. Hard code the
879 ;; build-time architecture to avoid the dpkg dependency.
881 (cond ((string-prefix? "x86_64" system)
883 ((string-prefix? "i686" system)
885 ((string-prefix? "aarch64" system)
887 (else (car (string-split system #\-))))))
888 (substitute* "create"
889 (("`dpkg --print-architecture`")
892 (add-after 'configure 'adjust-Makefile
894 ;; Do not attempt to create /etc/ganeti/instance-debootstrap
895 ;; and /etc/default/ganeti-instance-debootstrap during install.
896 ;; They are created by the Ganeti service.
897 (substitute* "Makefile"
898 (("\\$\\(variantsdir\\)")
899 "$(prefix)/etc/ganeti/instance-debootstrap/variants")
900 (("\\$\\(defaultsdir\\)")
901 "$(prefix)/etc/default/ganeti-instance-debootstrap"))
903 (add-after 'install 'make-variants.list-symlink
904 (lambda* (#:key outputs #:allow-other-keys)
905 ;; The Ganeti OS API mandates a variants.list file that
906 ;; describes all supported "variants" of this OS.
907 ;; Guix generates this file, so make the original file
909 (with-directory-excursion (string-append
910 (assoc-ref outputs "out")
911 "/share/ganeti/os/debootstrap")
912 (delete-file "variants.list")
913 (symlink "/etc/ganeti/instance-debootstrap/variants/variants.list"
917 `(("autoconf" ,autoconf)
918 ("automake" ,automake)))
920 `(("debianutils" ,debianutils)
921 ("debootstrap" ,debootstrap)
923 ("kpartx" ,multipath-tools)
924 ("util-linux" ,util-linux)))
925 (synopsis "Debian OS integration for Ganeti")
927 "This package provides a guest OS definition for Ganeti. It installs
928 Debian or a derivative using @command{debootstrap}.")
929 (license license:gpl2+)))
931 (define-public libosinfo
938 (uri (string-append "https://releases.pagure.org/libosinfo/libosinfo-"
942 "1s97sv24bybggjx6hgqba2qdqz3ivfpd4cmkh4zm5y59sim109mv"))))
943 (build-system meson-build-system)
946 (list (string-append "-Dwith-usb-ids-path="
947 (assoc-ref %build-inputs "usb.ids"))
948 (string-append "-Dwith-pci-ids-path="
949 (assoc-ref %build-inputs "pci.ids")))
951 (modify-phases %standard-phases
952 (add-after 'unpack 'patch-osinfo-path
953 (lambda* (#:key inputs #:allow-other-keys)
954 (substitute* "osinfo/osinfo_loader.c"
955 (("path = DATA_DIR.*")
956 (string-append "path = \"" (assoc-ref inputs "osinfo-db")
957 "/share/osinfo\";")))
960 `(("libsoup" ,libsoup)
963 ("osinfo-db" ,osinfo-db)))
965 `(("glib" ,glib "bin") ; glib-mkenums, etc.
966 ("gobject-introspection" ,gobject-introspection)
967 ("gtk-doc" ,gtk-doc/stable)
969 ("intltool" ,intltool)
970 ("pkg-config" ,pkg-config)
974 (uri "https://github.com/pciutils/pciids/raw/ad02084f0bc143e3c15e31a6152a3dfb1d7a3156/pci.ids")
977 "0kfhpj5rnh24hz2714qhfmxk281vwc2w50sm73ggw5d15af7zfsw"))))
981 (uri "https://svn.code.sf.net/p/linux-usb/repo/trunk/htdocs/usb.ids?r=2681")
982 (file-name "usb.ids")
985 "1m6yhvz5k8aqzxgk7xj3jkk8frl1hbv0h3vgj4wbnvnx79qnvz3r"))))))
986 (home-page "https://libosinfo.org/")
987 (synopsis "Operating system information database")
988 (description "libosinfo is a GObject based library API for managing
989 information about operating systems, hypervisors and the (virtual) hardware
990 devices they can support. It includes a database containing device metadata
991 and provides APIs to match/identify optimal devices for deploying an operating
992 system on a hypervisor. Via GObject Introspection, the API is available in
993 all common programming languages. Vala bindings are also provided.")
994 ;; The library files are released under LGPLv2.1 or later; the source
995 ;; files in the "tools" directory are released under GPLv2+.
996 (license (list license:lgpl2.1+ license:gpl2+))))
1005 "https://linuxcontainers.org/downloads/lxc/lxc-"
1009 "0qz4l7mlhq7hx53q606qgvkyzyr01glsw290v8ppzvxn1fydlrci"))))
1010 (build-system gnu-build-system)
1012 `(("pkg-config" ,pkg-config)))
1014 `(("gnutls" ,gnutls)
1016 ("libseccomp" ,libseccomp)
1017 ("libselinux" ,libselinux)))
1020 (list (string-append "--docdir=" (assoc-ref %outputs "out")
1021 "/share/doc/" ,name "-" ,version)
1023 "--localstatedir=/var")
1025 (modify-phases %standard-phases
1027 (lambda* (#:key outputs #:allow-other-keys)
1028 (let* ((out (assoc-ref outputs "out"))
1029 (bashcompdir (string-append out "/etc/bash_completion.d")))
1030 (invoke "make" "install"
1031 (string-append "bashcompdir=" bashcompdir)
1032 ;; Don't install files into /var and /etc.
1033 "LXCPATH=/tmp/var/lib/lxc"
1034 "localstatedir=/tmp/var"
1035 "sysconfdir=/tmp/etc"
1036 "sysconfigdir=/tmp/etc/default")))))))
1037 (synopsis "Linux container tools")
1038 (home-page "https://linuxcontainers.org/")
1040 "LXC is a userspace interface for the Linux kernel containment features.
1041 Through a powerful API and simple tools, it lets Linux users easily create and
1042 manage system or application containers.")
1043 (license license:lgpl2.1+)))
1045 (define-public lxcfs
1049 (home-page "https://github.com/lxc/lxcfs")
1052 (uri (git-reference (url home-page)
1053 (commit (string-append "lxcfs-" version))))
1054 (file-name (git-file-name name version))
1057 "1f74wy88si2ia035pcvciq5821kc8jcb75w1f8vhbp0cd29rqdpi"))))
1059 '(#:configure-flags '("--localstatedir=/var")))
1061 `(("autoconf" ,autoconf)
1062 ("automake" ,automake)
1063 ("libtool" ,libtool)
1064 ("pkg-config" ,pkg-config)))
1067 (build-system gnu-build-system)
1068 (synopsis "FUSE-based file system for LXC")
1069 (description "LXCFS is a small FUSE file system written with the intention
1070 of making Linux containers feel more like a virtual machine.
1071 It started as a side project of LXC but can be used by any run-time.")
1072 (license license:lgpl2.1+)))
1074 (define-public libvirt
1081 (uri (string-append "https://libvirt.org/sources/libvirt-"
1084 (base32 "15987ihnsjvcgi11dzcf1k3zp1si2d4wcxj0r0i30brc0d4pn44h"))
1085 (patches (search-patches "libvirt-add-install-prefix.patch"))))
1086 (build-system meson-build-system)
1089 (list "-Ddriver_qemu=enabled"
1090 "-Dqemu_user=nobody"
1092 "-Dstorage_disk=enabled"
1093 "-Dstorage_dir=enabled"
1095 "-Dnls=enabled" ;translations
1096 (string-append "-Ddocdir=" (assoc-ref %outputs "out") "/share/doc/"
1098 "-Dbash_completion=enabled"
1099 (string-append "-Dinstall_prefix=" (assoc-ref %outputs "out"))
1101 "--localstatedir=/var")
1104 (modify-phases %standard-phases
1105 (add-after 'unpack 'skip-directory-confusion
1107 ;; Don't try to install an (unused) /var outside of the store.
1108 (substitute* "scripts/meson-install-dirs.py"
1110 "destdir = '/tmp'"))))
1111 (add-before 'configure 'disable-broken-tests
1113 (let ((tests (list "commandtest" ; hangs idly
1114 "qemuxml2argvtest" ; fails
1115 "virnetsockettest"))) ; tries to network
1116 (substitute* "tests/meson.build"
1117 (((format #f ".*'name': '(~a)'.*" (string-join tests "|")))
1122 ("libxml2" ,libxml2)
1124 ("libpciaccess" ,libpciaccess)
1127 ("libpcap" ,libpcap)
1129 ("libssh2" ,libssh2) ;optional
1130 ("libtirpc" ,libtirpc) ;for <rpc/rpc.h>
1131 ("libuuid" ,util-linux "lib")
1132 ("lvm2" ,lvm2) ;for libdevmapper
1134 ("openssl" ,openssl)
1135 ("readline" ,readline)
1136 ("cyrus-sasl" ,cyrus-sasl)
1137 ("libyajl" ,libyajl)
1139 ("dmidecode" ,dmidecode)
1140 ("dnsmasq" ,dnsmasq)
1141 ("ebtables" ,ebtables)
1143 ("iproute" ,iproute)
1144 ("iptables" ,iptables)
1147 `(("bash-completion" ,bash-completion)
1148 ("gettext" ,gettext-minimal)
1149 ("xsltproc" ,libxslt)
1151 ("pkg-config" ,pkg-config)
1153 ("python" ,python-wrapper)
1154 ("python-docutils" ,python-docutils) ;for rst2html
1155 ("rpcsvc-proto" ,rpcsvc-proto))) ;for rpcgen
1156 (home-page "https://libvirt.org")
1157 (synopsis "Simple API for virtualization")
1158 (description "Libvirt is a C toolkit to interact with the virtualization
1159 capabilities of recent versions of Linux. The library aims at providing long
1160 term stable C API initially for the Xen paravirtualization but should be able
1161 to integrate other virtualization mechanisms if needed.")
1162 (license license:lgpl2.1+)))
1164 (define-public libvirt-glib
1166 (name "libvirt-glib")
1170 (uri (string-append "ftp://libvirt.org/libvirt/glib/"
1171 "libvirt-glib-" version ".tar.xz"))
1174 "1gdcvqz88qkp402zra9csc6391f2xki1270x683n6ixakl3gf8w4"))))
1175 (build-system meson-build-system)
1177 `(("openssl" ,openssl)
1178 ("cyrus-sasl" ,cyrus-sasl)
1179 ("lvm2" ,lvm2) ; for libdevmapper
1180 ("libyajl" ,libyajl)))
1182 `(("pkg-config" ,pkg-config)
1183 ("intltool" ,intltool)
1184 ("glib" ,glib "bin")
1187 ;; ‘Required:’ by the installed .pc files.
1189 ("libvirt" ,libvirt)
1190 ("libxml2" ,libxml2)
1191 ("gobject-introspection" ,gobject-introspection)))
1192 (home-page "https://libvirt.org")
1193 (synopsis "GLib wrapper around libvirt")
1194 (description "libvirt-glib wraps the libvirt library to provide a
1195 high-level object-oriented API better suited for glib-based applications, via
1199 @item libvirt-glib - GLib main loop integration & misc helper APIs
1200 @item libvirt-gconfig - GObjects for manipulating libvirt XML documents
1201 @item libvirt-gobject - GObjects for managing libvirt objects
1204 (license license:lgpl2.1+)))
1206 (define-public python-libvirt
1208 (name "python-libvirt")
1213 (uri (string-append "https://libvirt.org/sources/python/libvirt-python-"
1216 (base32 "15pn8610ybf03xff3vbz3apz2ph42k2kh6k19r020l9nvc6jcv37"))))
1217 (build-system python-build-system)
1220 (modify-phases %standard-phases
1222 (lambda* (#:key inputs outputs tests? #:allow-other-keys)
1224 ;; No reason to explicity invoke Python on a wrapped pytest.
1225 (substitute* "setup.py"
1226 (("sys\\.executable, pytest") "pytest"))
1227 (add-installed-pythonpath inputs outputs)
1228 (setenv "LIBVIRT_API_COVERAGE" "whynot")
1229 (invoke "python" "setup.py" "test")))))))
1231 `(("libvirt" ,libvirt)))
1233 `(("python-lxml" ,python-lxml)))
1235 `(("pkg-config" ,pkg-config)
1236 ("python-pytest" ,python-pytest)))
1237 (home-page "https://libvirt.org")
1238 (synopsis "Python bindings to libvirt")
1239 (description "This package provides Python bindings to the libvirt
1240 virtualization library.")
1241 (license license:lgpl2.1+)))
1243 (define-public virt-manager
1245 (name "virt-manager")
1249 (uri (string-append "https://virt-manager.org/download/sources"
1250 "/virt-manager/virt-manager-"
1254 "11kvpzcmyir91qz0dsnk7748jbb4wr8mrc744w117qc91pcy6vrb"))))
1255 (build-system python-build-system)
1257 `(#:use-setuptools? #f ; uses custom distutils 'install' command
1258 #:tests? #f ; TODO The tests currently fail
1259 ; RuntimeError: Loop condition wasn't
1261 #:imported-modules ((guix build glib-or-gtk-build-system)
1262 ,@%python-build-system-modules)
1263 #:modules ((ice-9 match)
1265 (guix build python-build-system)
1266 ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
1269 (modify-phases %standard-phases
1270 (add-after 'unpack 'fix-setup
1271 (lambda* (#:key outputs #:allow-other-keys)
1272 (substitute* "virtinst/buildconfig.py"
1273 (("/usr") (assoc-ref outputs "out")))
1275 (add-after 'unpack 'fix-default-uri
1276 (lambda* (#:key inputs #:allow-other-keys)
1277 ;; Xen is not available for now - so only patch qemu.
1278 (substitute* "virtManager/createconn.py"
1279 (("/usr(/bin/qemu-system)" _ suffix)
1280 (string-append (assoc-ref inputs "qemu") suffix)))
1282 (add-before 'wrap 'wrap-with-GI_TYPELIB_PATH
1283 (lambda* (#:key inputs outputs #:allow-other-keys)
1284 (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
1285 (bin-files (find-files bin ".*"))
1286 (paths (map (match-lambda
1287 ((output . directory)
1288 (let* ((girepodir (string-append
1290 "/lib/girepository-1.0")))
1291 (if (file-exists? girepodir)
1294 (for-each (lambda (file)
1295 (format #t "wrapping ~a\n" file)
1297 `("GI_TYPELIB_PATH" ":" prefix
1298 ,(filter identity paths))))
1302 (lambda* (#:key tests? #:allow-other-keys)
1304 (setenv "HOME" "/tmp")
1305 (setenv "XDG_CACHE_HOME" "/tmp")
1306 (system "Xvfb :1 &")
1307 (setenv "DISPLAY" ":1")
1308 ;; Dogtail requires that Assistive Technology support be enabled
1309 (setenv "GTK_MODULES" "gail:atk-bridge")
1310 (invoke "dbus-run-session" "--" "pytest" "--uitests"))
1312 (add-after 'install 'glib-or-gtk-compile-schemas
1313 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
1314 (add-after 'install 'glib-or-gtk-wrap
1315 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
1319 ("gtk-vnc" ,gtk-vnc)
1320 ("gtksourceview" ,gtksourceview)
1321 ("libvirt" ,libvirt)
1322 ("libvirt-glib" ,libvirt-glib)
1323 ("libosinfo" ,libosinfo)
1325 ("python-libvirt" ,python-libvirt)
1326 ("python-requests" ,python-requests)
1327 ("python-pycairo" ,python-pycairo)
1328 ("python-pygobject" ,python-pygobject)
1329 ("python-libxml2" ,python-libxml2)
1330 ("spice-gtk" ,spice-gtk)))
1331 ;; virt-manager searches for qemu-img or kvm-img in the PATH.
1335 `(("glib" ,glib "bin") ; glib-compile-schemas
1336 ("gobject-introspection" ,gobject-introspection)
1337 ("gtk+" ,gtk+ "bin") ; gtk-update-icon-cache
1338 ("perl" ,perl) ; pod2man
1339 ("intltool" ,intltool)
1340 ("rst2man" ,python-docutils)
1341 ;; The following are required for running the tests
1342 ;; ("python-pytest" ,python-pytest)
1343 ;; ("python-dogtail" ,python-dogtail)
1344 ;; ("xvfb" ,xorg-server-for-tests)
1346 ;; ("at-spi2-core" ,at-spi2-core)
1347 ;; ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
1349 (home-page "https://virt-manager.org/")
1350 (synopsis "Manage virtual machines")
1352 "The virt-manager application is a desktop user interface for managing
1353 virtual machines through libvirt. It primarily targets KVM VMs, but also
1354 manages Xen and LXC (Linux containers). It presents a summary view of running
1355 domains, their live performance and resource utilization statistics.")
1356 (license license:gpl2+)))
1364 (uri (string-append "https://download.openvz.org/criu/criu-"
1365 version ".tar.bz2"))
1368 "09d0j24x0cyc7wkgi7cnxqgfjk7kbdlm79zxpj8d356sa3rw2z24"))))
1369 (build-system gnu-build-system)
1371 `(#:test-target "test"
1372 #:tests? #f ; tests require mounting as root
1374 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1375 (string-append "LIBDIR=" (assoc-ref %outputs "out")
1377 (string-append "ASCIIDOC=" (assoc-ref %build-inputs "asciidoc")
1379 (string-append "XMLTO=" (assoc-ref %build-inputs "xmlto")
1382 (modify-phases %standard-phases
1384 (lambda* (#:key inputs #:allow-other-keys)
1385 ;; The includes for libnl are located in a sub-directory.
1386 (setenv "C_INCLUDE_PATH"
1387 (string-append (assoc-ref inputs "libnl")
1389 (or (getenv "C_INCLUDE_PATH") "")))
1391 (add-after 'configure 'fix-documentation
1392 (lambda* (#:key inputs outputs #:allow-other-keys)
1393 (substitute* "Documentation/Makefile"
1396 "-m custom.xsl --skip-validation -x "
1397 (assoc-ref inputs "docbook-xsl") "/xml/xsl/"
1398 ,(package-name docbook-xsl) "-"
1399 ,(package-version docbook-xsl)
1400 "/manpages/docbook.xsl")))
1402 (add-after 'unpack 'hardcode-variables
1403 (lambda* (#:key inputs #:allow-other-keys)
1404 ;; Hardcode arm version detection
1405 (substitute* "Makefile"
1406 (("ARMV.*:=.*") "ARMV := 7\n"))
1407 ;; We are currently using python-2
1408 (substitute* "crit/Makefile"
1409 (("\\$\\(PYTHON\\)") "python2"))
1410 (substitute* "lib/Makefile"
1411 (("\\$\\(PYTHON\\)")
1412 (string-append (assoc-ref inputs "python")
1415 (add-before 'build 'fix-symlink
1416 (lambda* (#:key inputs #:allow-other-keys)
1417 ;; The file 'images/google/protobuf/descriptor.proto' points to
1418 ;; /usr/include/..., which obviously does not exist.
1419 (let* ((file "google/protobuf/descriptor.proto")
1420 (target (string-append "images/" file))
1421 (source (string-append (assoc-ref inputs "protobuf")
1423 (delete-file target)
1424 (symlink source target)
1426 (add-after 'install 'wrap
1427 (lambda* (#:key inputs outputs #:allow-other-keys)
1428 ;; Make sure 'crit' runs with the correct PYTHONPATH.
1429 (let* ((out (assoc-ref outputs "out"))
1430 (path (string-append out
1432 (string-take (string-take-right
1433 (assoc-ref inputs "python") 5) 3)
1435 (getenv "PYTHONPATH"))))
1436 (wrap-program (string-append out "/bin/crit")
1437 `("PYTHONPATH" ":" prefix (,path))))
1440 `(("protobuf" ,protobuf)
1441 ("python" ,python-2)
1442 ("python2-protobuf" ,python2-protobuf)
1443 ("python2-ipaddr" ,python2-ipaddr)
1444 ("iproute" ,iproute)
1450 ("nftables" ,nftables)))
1452 `(("pkg-config" ,pkg-config)
1454 ("protobuf-c" ,protobuf-c)
1455 ("asciidoc" ,asciidoc)
1457 ("docbook-xml" ,docbook-xml)
1458 ("docbook-xsl" ,docbook-xsl)))
1459 (home-page "https://criu.org")
1460 (synopsis "Checkpoint and restore in user space")
1461 (description "Using this tool, you can freeze a running application (or
1462 part of it) and checkpoint it to a hard drive as a collection of files. You
1463 can then use the files to restore and run the application from the point it
1464 was frozen at. The distinctive feature of the CRIU project is that it is
1465 mainly implemented in user space.")
1466 ;; The project is licensed under GPLv2; files in the lib/ directory are
1468 (license (list license:gpl2 license:lgpl2.1))))
1470 (define-public qmpbackup
1477 (url "https://github.com/abbbi/qmpbackup")
1479 (file-name (git-file-name name version))
1482 "0swhp5byz44brhyis1a39p11fyn9q84xz5q6v2fah29r7d71kmmx"))))
1483 (build-system python-build-system)
1485 `(#:python ,python-2))
1486 (home-page "https://github.com/abbbi/qmpbackup")
1487 (synopsis "Backup and restore QEMU machines")
1488 (description "qmpbackup is designed to create and restore full and
1489 incremental backups of running QEMU virtual machines via QMP, the QEMU
1491 (license license:gpl3+)))
1493 (define-public looking-glass-client
1494 (let ((commit "182c4752d57690da7f99d5e788de9b8baea33895"))
1496 (name "looking-glass-client")
1497 (version (string-append "a12-" (string-take commit 7)))
1501 (uri (git-reference (url "https://github.com/gnif/LookingGlass")
1503 (file-name (git-file-name name version))
1506 "02bq46ndmzq9cihazzn7xq1x7q5nzm7iw4l9lqzihxcxp9famkhw"))
1507 (modules '((guix build utils)))
1510 ;; Do not create binaries optimized for the CPU of the build machine,
1511 ;; for reproducibility and compatibility. TODO: in the next version
1512 ;; of looking glass, this is exposed as a CMake configure option.
1513 (substitute* "client/CMakeLists.txt"
1517 (build-system cmake-build-system)
1518 (inputs `(("fontconfig" ,fontconfig)
1521 ("openssl" ,openssl)
1523 ("sdl2-ttf" ,sdl2-ttf)
1524 ("spice-protocol" ,spice-protocol)
1525 ("wayland" ,wayland)))
1526 (native-inputs `(("libconfig" ,libconfig)
1528 ("pkg-config" ,pkg-config)))
1530 `(#:tests? #f ;; No tests are available.
1531 #:make-flags '("CC=gcc")
1532 #:phases (modify-phases %standard-phases
1533 (add-before 'configure 'chdir-to-client
1534 (lambda* (#:key outputs #:allow-other-keys)
1537 (add-after 'chdir-to-client 'add-missing-include
1539 ;; Mimic upstream commit b9797529893, required since the
1540 ;; update to Mesa 19.2.
1541 (substitute* "renderers/egl/shader.h"
1542 (("#include <stdbool\\.h>")
1543 "#include <stdbool.h>\n#include <stddef.h>"))
1546 (lambda* (#:key outputs #:allow-other-keys)
1547 (install-file "looking-glass-client"
1548 (string-append (assoc-ref outputs "out")
1551 (home-page "https://looking-glass.hostfission.com")
1552 (synopsis "KVM Frame Relay (KVMFR) implementation")
1553 (description "Looking Glass allows the use of a KVM (Kernel-based Virtual
1554 Machine) configured for VGA PCI Pass-through without an attached physical
1555 monitor, keyboard or mouse. It displays the VM's rendered contents on your main
1557 ;; This package requires SSE instructions.
1558 (supported-systems '("i686-linux" "x86_64-linux"))
1559 (license license:gpl2+))))
1564 (version "1.0.0-rc93")
1568 "https://github.com/opencontainers/runc/releases/"
1569 "download/v" version "/runc.tar.xz"))
1570 (file-name (string-append name "-" version ".tar.xz"))
1573 "0b90r1bkvlqli53ca1yc1l488dba0isd3i6l7nlhszxi8p7hzvkh"))))
1574 (build-system go-build-system)
1576 '(#:import-path "github.com/opencontainers/runc"
1577 #:install-source? #f
1578 ;; XXX: 20/139 tests fail due to missing /var, cgroups and apparmor in
1579 ;; the build environment.
1582 (modify-phases %standard-phases
1584 (lambda* (#:key import-path #:allow-other-keys)
1585 (with-directory-excursion (string-append "src/" import-path)
1586 (invoke "make" "all" "man"))))
1588 (lambda* (#:key tests? #:allow-other-keys)
1590 (invoke "make" "localunittest"))))
1592 (lambda* (#:key import-path outputs #:allow-other-keys)
1593 (with-directory-excursion (string-append "src/" import-path)
1594 (let ((out (assoc-ref outputs "out")))
1595 (invoke "make" "install" "install-bash" "install-man"
1596 (string-append "PREFIX=" out)))))))))
1598 `(("go-md2man" ,go-github-com-go-md2man)
1599 ("pkg-config" ,pkg-config)))
1601 `(("libseccomp" ,libseccomp)))
1602 (synopsis "Open container initiative runtime")
1603 (home-page "https://opencontainers.org/")
1605 "@command{runc} is a command line client for running applications
1606 packaged according to the
1607 @uref{https://github.com/opencontainers/runtime-spec/blob/master/spec.md, Open
1608 Container Initiative (OCI) format} and is a compliant implementation of the
1609 Open Container Initiative specification.")
1610 (license license:asl2.0)))
1612 (define-public umoci
1620 "https://github.com/opencontainers/umoci/releases/download/v"
1621 version "/umoci.tar.xz"))
1622 (file-name (string-append "umoci-" version ".tar.xz"))
1624 (base32 "0fvljj9k4f83wbqzd8nbijz0p1zaq633f8yxyvl5sy3wjf03ffk9"))))
1625 (build-system go-build-system)
1627 '(#:import-path "github.com/opencontainers/umoci"
1628 #:install-source? #f
1630 (modify-phases %standard-phases
1632 (lambda* (#:key source import-path #:allow-other-keys)
1633 ;; Unpack the tarball into 'umoci' instead of "runc-${version}".
1634 (let ((dest (string-append "src/" import-path)))
1636 (invoke "tar" "-C" (string-append "src/" import-path)
1637 "--strip-components=1"
1640 (lambda* (#:key import-path #:allow-other-keys)
1641 (with-directory-excursion (string-append "src/" import-path)
1642 ;; TODO: build manpages with 'go-md2man'.
1643 (invoke "make" "SHELL=bash"))))
1645 (lambda* (#:key import-path outputs #:allow-other-keys)
1646 (let* ((out (assoc-ref outputs "out"))
1647 (bindir (string-append out "/bin")))
1648 (install-file (string-append "src/" import-path "/umoci")
1651 (home-page "https://umo.ci/")
1652 (synopsis "Tool for modifying Open Container images")
1654 "@command{umoci} is a tool that allows for high-level modification of an
1655 Open Container Initiative (OCI) image layout and its tagged images.")
1656 (license license:asl2.0)))
1658 (define-public skopeo
1665 (url "https://github.com/containers/skopeo")
1666 (commit (string-append "v" version))))
1667 (file-name (git-file-name name version))
1670 "0n22sdif437ddg5ch0ipwim3fg0n6ihc9bfi52qkhy3r1grz04hs"))))
1671 (build-system go-build-system)
1673 `(("pkg-config" ,pkg-config)
1674 ("go-github-com-go-md2man" ,go-github-com-go-md2man)))
1676 `(("btrfs-progs" ,btrfs-progs)
1678 ("libassuan" ,libassuan)
1679 ("libselinux" ,libselinux)
1680 ("libostree" ,libostree)
1685 '(#:import-path "github.com/containers/skopeo"
1686 #:install-source? #f
1687 #:tests? #f ; The tests require Docker
1689 (modify-phases %standard-phases
1691 (lambda* (#:key import-path #:allow-other-keys)
1692 (with-directory-excursion (string-append "src/" import-path)
1693 (invoke "make" "bin/skopeo"))))
1694 (add-after 'build 'build-docs
1695 (lambda* (#:key import-path #:allow-other-keys)
1696 (with-directory-excursion (string-append "src/" import-path)
1697 (invoke "make" "docs"))))
1699 (lambda* (#:key import-path outputs #:allow-other-keys)
1700 (with-directory-excursion (string-append "src/" import-path)
1701 (let ((out (assoc-ref outputs "out")))
1702 (install-file "default-policy.json"
1703 (string-append out "/etc/containers"))
1704 (invoke "make" "install-binary" "install-completions" "install-docs"
1705 (string-append "PREFIX=" out)))))))))
1706 (home-page "https://github.com/containers/skopeo")
1707 (synopsis "Interact with container images and container image registries")
1709 "@command{skopeo} is a command line utility providing various operations
1710 with container images and container image registries. It can:
1713 @item Copy container images between various containers image stores,
1714 converting them as necessary.
1716 @item Convert a Docker schema 2 or schema 1 container image to an OCI image.
1718 @item Inspect a repository on a container registry without needlessly pulling
1721 @item Sign and verify container images.
1723 @item Delete container images from a remote container registry.
1726 (license license:asl2.0)))
1728 (define-public python-vagrant
1730 (name "python-vagrant")
1735 (uri (pypi-uri "python-vagrant" version))
1738 "1ikrh6canhcxg5y7pzmkcnnydikppv7s6sm9prfx90nk0ac8m6mg"))))
1739 (build-system python-build-system)
1741 '(#:tests? #f)) ; tests involve running vagrant.
1742 (home-page "https://github.com/todddeluca/python-vagrant")
1743 (synopsis "Python bindings for Vagrant")
1745 "Python-vagrant is a Python module that provides a thin wrapper around the
1746 @code{vagrant} command line executable, allowing programmatic control of Vagrant
1748 (license license:expat)))
1750 (define-public bubblewrap
1756 (uri (string-append "https://github.com/containers/bubblewrap/"
1757 "releases/download/v" version "/bubblewrap-"
1761 "00ycgi6q2yngh06bnz50wkvar6r2jnjf3j158grhi9k13jdrpimr"))))
1762 (build-system gnu-build-system)
1765 (modify-phases %standard-phases
1766 (add-after 'unpack 'fix-test
1767 (lambda* (#:key outputs #:allow-other-keys)
1768 ;; Tests try to access /var/tmp, which is not possible in our build
1769 ;; environment. Let's give them another directory.
1770 ;; /tmp gets overriden in some tests, so we need another directory.
1771 ;; the only possibility is the output directory.
1772 (let ((tmp-dir (string-append (assoc-ref outputs "out") "/tmp")))
1774 (substitute* "tests/test-run.sh"
1775 (("/var/tmp") tmp-dir)
1776 ;; Tests create a temporary python script, so fix its shebang.
1777 (("/usr/bin/env python") (which "python"))
1778 ;; Some tests try to access /usr, but that doesn't exist.
1779 ;; Give them /gnu instead.
1781 (("--ro-bind /bin /bin") "--ro-bind /gnu /bin")
1782 (("--ro-bind /sbin /sbin") "--ro-bind /gnu /sbin")
1783 (("--ro-bind /lib /lib") "--ro-bind /gnu /lib")
1784 ((" */bin/bash") (which "bash"))
1785 (("/bin/sh") (which "sh"))
1786 (("findmnt") (which "findmnt"))))
1788 ;; Remove the directory we gave to tests to have a clean package.
1789 (add-after 'check 'remove-tmp-dir
1790 (lambda* (#:key outputs #:allow-other-keys)
1791 (delete-file-recursively (string-append (assoc-ref outputs "out") "/tmp"))
1794 `(("libcap" ,libcap)))
1796 `(("python" ,python-wrapper)
1797 ("util-linux" ,util-linux)))
1798 (home-page "https://github.com/containers/bubblewrap")
1799 (synopsis "Unprivileged sandboxing tool")
1800 (description "Bubblewrap is aimed at running applications in a sandbox,
1801 restricting their access to parts of the operating system or user data such as
1802 the home directory. Bubblewrap always creates a new mount namespace, and the
1803 user can specify exactly what parts of the file system should be made visible
1804 in the sandbox. These directories are mounted with the @code{nodev} option
1805 by default and can be made read-only.")
1806 (license license:lgpl2.0+)))
1808 (define-public bochs
1815 (uri (string-append "https://sourceforge.net/projects/bochs/files/bochs/"
1816 version "/bochs-" version ".tar.gz"))
1818 (base32 "0ql8q6y1k356li1g9gbvl21448mlxphxxi6kjb2b3pxvzd0pp2b3"))))
1819 (build-system gnu-build-system)
1821 `(#:tests? #f)) ; no tests exist
1823 `(("libxrandr" ,libxrandr)))
1824 (home-page "http://bochs.sourceforge.net/")
1825 (synopsis "Emulator for x86 PC")
1827 "Bochs is an emulator which can emulate Intel x86 CPU, common I/O
1828 devices, and a custom BIOS. It can also be compiled to emulate many different
1829 x86 CPUs, from early 386 to the most recent x86-64 Intel and AMD processors.
1830 Bochs can run most Operating Systems inside the emulation including Linux,
1831 DOS or Microsoft Windows.")
1832 (license license:lgpl2.0+)))
1841 (url "git://xenbits.xenproject.org/xen.git")
1842 (commit (string-append "RELEASE-" version))))
1843 (file-name (git-file-name name version))
1846 "1r90rvypw76ya9clqw5p02gm1k8hxz73f7gr95ca778nnzvb7xjw"))))
1847 (build-system gnu-build-system)
1850 (list "--enable-rpath"
1851 "--disable-qemu-traditional" ; It tries to do "git clone"
1852 "--disable-rombios" ; would try to "git clone" via etherboot.
1853 ;; TODO: Re-enable stubdom (it's "more secure" to use it).
1854 "--disable-stubdom" ; tries to "git clone" old patched newlib.
1855 (string-append "--with-initddir="
1856 (assoc-ref %outputs "out")
1858 (string-append "--with-system-qemu="
1859 (assoc-ref %build-inputs "qemu")
1860 "/bin/qemu-system-i386")
1861 (string-append "--with-system-seabios="
1862 (assoc-ref %build-inputs "seabios")
1863 "/share/firmware/bios.bin")
1864 (string-append "--with-system-ovmf="
1865 (assoc-ref %build-inputs "ovmf")
1866 "/share/firmware/ovmf_ia32.bin"))
1867 #:make-flags (list "-j" "1"
1868 "XEN_BUILD_DATE=Thu Jan 1 01:00:01 CET 1970"
1869 "XEN_BUILD_TIME=01:00:01"
1872 "SMBIOS_REL_DATE=01/01/1970"
1873 "VGABIOS_REL_DATE=01 Jan 1970"
1874 ; QEMU_TRADITIONAL_LOC
1876 "SYSCONFIG_DIR=/tmp/etc/default"
1877 (string-append "BASH_COMPLETION_DIR="
1878 (assoc-ref %outputs "out")
1879 "/etc/bash_completion.d")
1880 (string-append "BOOT_DIR="
1881 (assoc-ref %outputs "out")
1883 (string-append "DEBUG_DIR="
1884 (assoc-ref %outputs "out")
1886 (string-append "EFI_DIR="
1887 (assoc-ref %outputs "out")
1888 "/lib/efi") ; TODO lib64 ?
1889 "MINIOS_UPSTREAM_URL="
1890 ;(string-append "DISTDIR="
1891 ; (assoc-ref %outputs "out"))
1893 #:test-target "test"
1895 (modify-phases %standard-phases
1896 (add-after 'unpack 'unpack-mini-os
1897 (lambda* (#:key inputs #:allow-other-keys)
1898 (copy-recursively (assoc-ref inputs "mini-os") "extras/mini-os")
1900 (add-after 'unpack-mini-os 'patch
1901 (lambda* (#:key inputs outputs #:allow-other-keys)
1902 (substitute* "tools/firmware/Rules.mk"
1903 (("override XEN_TARGET_ARCH = x86_32")
1904 (string-append "override XEN_TARGET_ARCH = x86_32
1905 override CC = " (assoc-ref inputs "cross-gcc") "/bin/i686-linux-gnu-gcc"))
1907 (string-append "CFLAGS=-I" (assoc-ref inputs "cross-libc")
1909 (substitute* "config/x86_32.mk"
1910 (("CFLAGS += -m32 -march=i686")
1911 (string-append "CFLAGS += -march=i686 -I"
1912 (assoc-ref inputs "cross-libc")
1914 ;; /var is not in /gnu/store , so don't try to create it.
1915 (substitute* '("tools/Makefile"
1916 "tools/xenstore/Makefile"
1917 "tools/xenpaging/Makefile")
1918 (("\\$\\(INSTALL_DIR\\) .*XEN_(DUMP|LOG|RUN|LIB|PAGING)_DIR.*")
1920 (("\\$\\(INSTALL_DIR\\) .*XEN_(RUN|LIB)_STORED.*")
1922 ;; Prevent xen from creating /etc .
1923 (substitute* "tools/examples/Makefile"
1924 ((" install-readmes") "")
1925 ((" install-configs") ""))
1927 (substitute* "tools/pygrub/setup.py"
1929 ; TODO: extra_link_args = ['-Wl,-rpath=/opt/foo'],
1930 (string-append "runtime_library_dirs = ['"
1931 (assoc-ref outputs "out")
1932 "/lib'],\nlibrary_dirs =")))
1934 (add-before 'configure 'patch-xen-script-directory
1935 (lambda* (#:key outputs #:allow-other-keys)
1936 (substitute* '("configure"
1939 (("XEN_SCRIPT_DIR=.*")
1940 (string-append "XEN_SCRIPT_DIR="
1941 (assoc-ref outputs "out")
1942 "/etc/xen/scripts")))
1944 (add-before 'configure 'set-environment-up
1945 (lambda* (#:key make-flags #:allow-other-keys)
1947 (string-contains x "cross-i686-linux"))
1948 (define (filter-environment! filter-predicate
1949 environment-variable-names)
1952 (let* ((env-value (getenv env-name))
1953 (search-path (search-path-as-string->list env-value))
1954 (new-search-path (filter filter-predicate
1956 (new-env-value (list->search-path-as-string
1957 new-search-path ":")))
1958 (setenv env-name new-env-value)))
1959 environment-variable-names))
1960 (setenv "CROSS_C_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
1961 (setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
1962 (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
1963 (filter-environment! cross?
1964 '("CROSS_C_INCLUDE_PATH" "CROSS_CPLUS_INCLUDE_PATH"
1965 "CROSS_LIBRARY_PATH"))
1966 (filter-environment! (lambda (e) (not (cross? e)))
1967 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
1969 ;; Guix tries to be helpful and automatically adds
1970 ;; mini-os-git-checkout/include to the include path,
1971 ;; but actually we don't want it to be there (yet).
1972 (filter-environment! (lambda (e)
1975 "mini-os-git-checkout")))
1976 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
1978 (setenv "EFI_VENDOR" "guix")
1981 (lambda* (#:key make-flags #:allow-other-keys)
1982 (apply invoke "make" "world" make-flags))))))
1984 `(("acpica" ,acpica) ; TODO: patch iasl invocation.
1985 ("bridge-utils" ,bridge-utils) ; TODO: patch invocations.
1987 ("iproute" ,iproute) ; TODO: patch invocations.
1990 ("libyajl" ,libyajl)
1991 ("ncurses" ,ncurses)
1992 ("openssl" ,openssl)
1995 ("qemu" ,qemu-minimal)
1996 ("seabios" ,seabios)
1997 ("util-linux" ,util-linux "lib") ; uuid
1998 ; TODO: ocaml-findlib, ocaml-nox.
1999 ("xz" ,xz) ; for liblzma
2004 ("cmake" ,cmake-minimal)
2007 ("gettext" ,gettext-minimal)
2013 (url "http://xenbits.xen.org/git-http/mini-os.git")
2014 (commit (string-append "xen-RELEASE-" version))))
2017 "1i8pcl19n60i2m9vlg79q3nknpj209c9ic5x10wxaicx45kc107f"))
2018 (file-name "mini-os-git-checkout")))
2021 ("pkg-config" ,pkg-config)
2022 ("python" ,python-2)
2024 ("cross-gcc" ,(cross-gcc "i686-linux-gnu"
2025 #:xbinutils (cross-binutils "i686-linux-gnu")
2026 #:libc (cross-libc "i686-linux-gnu")))
2027 ("cross-libc" ,(cross-libc "i686-linux-gnu")) ; header files
2028 ("cross-libc-static" ,(cross-libc "i686-linux-gnu") "static")))
2029 (home-page "https://xenproject.org/")
2030 (synopsis "Xen Virtual Machine Monitor")
2031 (description "This package provides the Xen Virtual Machine Monitor
2032 which is a hypervisor.")
2033 ;; TODO: Some files are licensed differently. List those.
2034 (license license:gpl2)
2035 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))))
2037 (define-public osinfo-db-tools
2039 (name "osinfo-db-tools")
2043 (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-tools-"
2048 "038q3gzdbkfkhpicj0755mw1q4gbvn57pslpw8n2dp3lds9im0g9"))))
2049 (build-system meson-build-system)
2051 `(("libsoup" ,libsoup)
2052 ("libxml2" ,libxml2)
2053 ("libxslt" ,libxslt)
2054 ("json-glib" ,json-glib)
2055 ("libarchive" ,libarchive)))
2058 ("gobject-introspection" ,gobject-introspection)
2059 ("gettext" ,gettext-minimal)
2060 ("pkg-config" ,pkg-config)
2063 ("pytest" ,python-pytest)
2064 ("requests" ,python-requests)))
2065 (home-page "https://gitlab.com/libosinfo/osinfo-db-tools")
2066 (synopsis "Tools for managing the osinfo database")
2067 (description "This package contains a set of tools to assist
2068 administrators and developers in managing the database.")
2069 (license license:lgpl2.0+)))
2071 (define-public osinfo-db
2074 (version "20201218")
2077 (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-"
2081 "0ydbindwgw7kg861rqii5036gq0dbbbmv35dzrmmv937ddfsxwh0"))))
2082 (build-system trivial-build-system)
2084 `(#:modules ((guix build utils))
2087 (use-modules (guix build utils))
2088 (let* ((out (assoc-ref %outputs "out"))
2089 (osinfo-dir (string-append out "/share/osinfo"))
2090 (source (assoc-ref %build-inputs "source"))
2092 (string-append (assoc-ref %build-inputs "osinfo-db-tools")
2093 "/bin/osinfo-db-import")))
2094 (mkdir-p osinfo-dir)
2095 (invoke osinfo-db-import "--dir" osinfo-dir source)
2098 `(("intltool" ,intltool)
2099 ("osinfo-db-tools" ,osinfo-db-tools)))
2100 (home-page "https://gitlab.com/libosinfo/osinfo-db")
2101 (synopsis "Database of information about operating systems")
2102 (description "Osinfo-db provides the database files for use with the
2103 libosinfo library. It provides information about guest operating systems for
2104 use with virtualization provisioning tools")
2105 (license license:lgpl2.0+)))
2107 (define-public python-transient
2109 (name "python-transient")
2114 (uri (pypi-uri "transient" version))
2117 "148yiqrmcscsi6787y0f27i1y9cf0gcw3mqfv5frhpmsmv62mv5z"))))
2118 (build-system python-build-system)
2120 `(#:tests? #f ; Requires behave
2121 #:phases (modify-phases %standard-phases
2122 (add-after 'unpack 'fix-dependencies
2124 (substitute* "setup.py"
2129 `(("python-beautifultable" ,python-beautifultable)
2130 ("python-click" ,python-click)
2131 ("python-importlib-resources"
2132 ,python-importlib-resources)
2133 ("python-lark-parser" ,python-lark-parser)
2134 ("python-marshmallow" ,python-marshmallow)
2135 ("python-progressbar2" ,python-progressbar2)
2136 ("python-requests" ,python-requests)
2137 ("python-toml" ,python-toml)))
2139 `(("python-black" ,python-black)
2140 ("python-mypy" ,python-mypy)
2141 ("python-pyhamcrest" ,python-pyhamcrest)
2142 ("python-twine" ,python-twine)))
2144 "https://github.com/ALSchwalm/transient")
2146 "QEMU Wrapper written in Python")
2148 "@code{transient} is a wrapper for QEMU allowing the creation of virtual
2149 machines with shared folder, ssh, and disk creation support.")
2150 (license license:expat)))