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 admin)
42 #:use-module (gnu packages assembly)
43 #:use-module (gnu packages attr)
44 #:use-module (gnu packages autotools)
45 #:use-module (gnu packages backup)
46 #:use-module (gnu packages base)
47 #:use-module (gnu packages bash)
48 #:use-module (gnu packages bison)
49 #:use-module (gnu packages build-tools)
50 #:use-module (gnu packages check)
51 #:use-module (gnu packages cmake)
52 #:use-module (gnu packages compression)
53 #:use-module (gnu packages cross-base)
54 #:use-module (gnu packages curl)
55 #:use-module (gnu packages cyrus-sasl)
56 #:use-module (gnu packages debian)
57 #:use-module (gnu packages disk)
58 #:use-module (gnu packages dns)
59 #:use-module (gnu packages docbook)
60 #:use-module (gnu packages documentation)
61 #:use-module (gnu packages figlet)
62 #:use-module (gnu packages firmware)
63 #:use-module (gnu packages flex)
64 #:use-module (gnu packages fontutils)
65 #:use-module (gnu packages freedesktop)
66 #:use-module (gnu packages gettext)
67 #:use-module (gnu packages gl)
68 #:use-module (gnu packages glib)
69 #:use-module (gnu packages gnome)
70 #:use-module (gnu packages gnupg)
71 #:use-module (gnu packages golang)
72 #:use-module (gnu packages graphviz)
73 #:use-module (gnu packages gtk)
74 #:use-module (gnu packages haskell)
75 #:use-module (gnu packages haskell-apps)
76 #:use-module (gnu packages haskell-check)
77 #:use-module (gnu packages haskell-crypto)
78 #:use-module (gnu packages haskell-web)
79 #:use-module (gnu packages haskell-xyz)
80 #:use-module (gnu packages image)
81 #:use-module (gnu packages libbsd)
82 #:use-module (gnu packages libusb)
83 #:use-module (gnu packages linux)
84 #:use-module (gnu packages m4)
85 #:use-module (gnu packages ncurses)
86 #:use-module (gnu packages nettle)
87 #:use-module (gnu packages networking)
88 #:use-module (gnu packages ninja)
89 #:use-module (gnu packages onc-rpc)
90 #:use-module (gnu packages package-management)
91 #:use-module (gnu packages perl)
92 #:use-module (gnu packages pcre)
93 #:use-module (gnu packages pkg-config)
94 #:use-module (gnu packages polkit)
95 #:use-module (gnu packages protobuf)
96 #:use-module (gnu packages python)
97 #:use-module (gnu packages python-build)
98 #:use-module (gnu packages python-check)
99 #:use-module (gnu packages python-crypto)
100 #:use-module (gnu packages python-web)
101 #:use-module (gnu packages python-xyz)
102 #:use-module (gnu packages pulseaudio)
103 #:use-module (gnu packages readline)
104 #:use-module (gnu packages selinux)
105 #:use-module (gnu packages sdl)
106 #:use-module (gnu packages sphinx)
107 #:use-module (gnu packages spice)
108 #:use-module (gnu packages ssh)
109 #:use-module (gnu packages texinfo)
110 #:use-module (gnu packages textutils)
111 #:use-module (gnu packages tls)
112 #:use-module (gnu packages web)
113 #:use-module (gnu packages wget)
114 #:use-module (gnu packages xdisorg)
115 #:use-module (gnu packages xml)
116 #:use-module (gnu packages xorg)
117 #:use-module (guix build-system cmake)
118 #:use-module (guix build-system gnu)
119 #:use-module (guix build-system go)
120 #:use-module (guix build-system meson)
121 #:use-module (guix build-system python)
122 #:use-module (guix build-system trivial)
123 #:use-module (guix download)
124 #:use-module (guix git-download)
125 #:use-module ((guix licenses) #:prefix license:)
126 #:use-module (guix packages)
127 #:use-module (guix utils)
128 #:use-module (srfi srfi-1)
129 #:use-module (srfi srfi-26)
130 #:use-module (ice-9 match))
132 (define (qemu-patch commit file-name sha256-bv)
133 "Return an origin for COMMIT."
137 "http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h="
139 (hash (content-hash sha256-bv sha256))
140 (file-name file-name)))
149 (uri (string-append "https://download.qemu.org/qemu-"
153 "1g0pvx4qbirpcn9mni704y03n3lvkmw2c0rbcwvydyr8ns4xh66b"))
154 (patches (search-patches "qemu-CVE-2021-20203.patch"
155 "qemu-build-info-manual.patch"))
156 (modules '((guix build utils)))
159 ;; Fix a bug in the do_ioctl_ifconf() function of qemu to
160 ;; make ioctl(…, SIOCGIFCONF, …) work for emulated 64 bit
161 ;; architectures. The size of struct ifreq is handled
163 ;; https://lists.nongnu.org/archive/html/qemu-devel/2021-01/msg01545.html
164 (substitute* '("linux-user/syscall.c")
165 (("^([[:blank:]]*)const argtype ifreq_arg_type.*$" line indent)
166 (string-append line indent "const argtype ifreq_max_type[] = "
167 "{ MK_STRUCT(STRUCT_ifmap_ifreq) };\n"))
168 (("^([[:blank:]]*)target_ifreq_size[[:blank:]]=.*$" _ indent)
169 (string-append indent "target_ifreq_size = "
170 "thunk_type_size(ifreq_max_type, 0);")))
171 ;; Delete the bundled meson copy.
172 (delete-file-recursively "meson")))))
173 (outputs '("out" "static" "doc")) ;5.3 MiB of HTML docs
174 (build-system gnu-build-system)
176 ;; FIXME: Disable tests on i686 to work around
177 ;; <https://bugs.gnu.org/40527>.
178 `(#:tests? ,(or (%current-target-system)
179 (not (string=? "i686-linux" (%current-system))))
181 (let ((gcc (string-append (assoc-ref %build-inputs "gcc") "/bin/gcc"))
182 (out (assoc-ref %outputs "out")))
183 (list (string-append "--cc=" gcc)
184 ;; Some architectures insist on using HOST_CC.
185 (string-append "--host-cc=" gcc)
186 (string-append "--prefix=" out)
188 (string-append "--smbd=" out "/libexec/samba-wrapper")
189 "--disable-debug-info" ;for space considerations
190 ;; The binaries need to be linked against -lrt.
191 (string-append "--extra-ldflags=-lrt")))
192 ;; Make build and test output verbose to facilitate investigation upon failure.
193 #:make-flags '("V=1")
194 #:modules ((srfi srfi-1)
198 ,@%gnu-build-system-modules)
200 (modify-phases %standard-phases
201 (add-after 'set-paths 'hide-glibc
202 (lambda* (#:key inputs #:allow-other-keys)
203 ;; Work around https://issues.guix.info/issue/36882. We need to
204 ;; remove glibc from C_INCLUDE_PATH so that the one hardcoded in GCC,
205 ;; at the bottom of GCC include search-path is used.
206 (let* ((filters '("libc"))
208 (filter-map (lambda (input)
211 (and (not (member name filters))
214 (set-path-environment-variable "C_INCLUDE_PATH"
216 input-directories))))
217 (add-after 'unpack 'extend-test-time-outs
219 ;; These tests can time out on heavily-loaded and/or slow storage.
220 (substitute* (cons* "tests/qemu-iotests/common.qemu"
221 (find-files "tests/qemu-iotests" "^[0-9]+$"))
222 (("QEMU_COMM_TIMEOUT=[0-9]+" match)
223 (string-append match "9")))))
224 (add-after 'unpack 'disable-unusable-tests
226 (substitute* "tests/meson.build"
227 ;; Comment out the test-qga test, which needs /sys and
228 ;; fails within the build environment.
229 (("tests.*test-qga.*$" all)
230 (string-append "# " all))
231 ;; Comment out the test-char test, which needs networking and
232 ;; fails within the build environment.
233 (("check-unit-.* tests/test-char" all)
234 (string-append "# " all)))))
235 (add-after 'patch-source-shebangs 'patch-embedded-shebangs
237 ;; Ensure the executables created by these source files reference
238 ;; /bin/sh from the store so they work inside the build container.
239 (substitute* '("block/cloop.c" "migration/exec.c"
240 "net/tap.c" "tests/qtest/libqtest.c")
241 (("/bin/sh") (which "sh")))
242 (substitute* "Makefile"
243 (("SHELL = /usr/bin/env bash -o pipefail")
244 "SHELL = bash -o pipefail"))
245 (substitute* "tests/qemu-iotests/check"
246 (("#!/usr/bin/env python3")
247 (string-append "#!" (which "python3"))))))
248 (add-before 'configure 'fix-optionrom-makefile
250 ;; Work around the inability of the rules defined in this
251 ;; Makefile to locate the firmware files (e.g.: No rule to make
252 ;; target 'multiboot.bin') by extending the VPATH.
253 (substitute* "pc-bios/optionrom/Makefile"
254 (("^VPATH = \\$\\(SRC_DIR\\)")
255 "VPATH = $(SRC_DIR):$(TOPSRC_DIR)/pc-bios"))))
256 ;; XXX ./configure is being re-run at beginning of build phase...
258 (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
259 ;; The `configure' script doesn't understand some of the
260 ;; GNU options. Thus, add a new phase that's compatible.
261 (let ((out (assoc-ref outputs "out")))
262 (setenv "SHELL" (which "bash"))
263 ;; Ensure config.status gets the correct shebang off the bat.
264 ;; The build system gets confused if we change it later and
265 ;; attempts to re-run the whole configuration, and fails.
266 (substitute* "configure"
268 (string-append "#!" (which "sh"))))
271 (apply invoke "../../configure" configure-flags))))
272 ;; Configure, build and install QEMU user-emulation static binaries.
273 (add-after 'configure 'configure-user-static
274 (lambda* (#:key inputs outputs #:allow-other-keys)
275 (let* ((gcc (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
276 (static (assoc-ref outputs "static"))
277 ;; This is the common set of configure flags; it is
278 ;; duplicated here to isolate this phase from manipulations
279 ;; to the #:configure-flags build argument, as done in
280 ;; derived packages such as qemu-minimal.
281 (configure-flags (list (string-append "--cc=" gcc)
282 (string-append "--host-cc=" gcc)
284 "--disable-debug-info")))
285 (mkdir-p "../user-static")
286 (with-directory-excursion "../user-static"
287 (apply invoke "../../configure"
289 "--disable-docs" ;already built
291 "--enable-linux-user"
292 (string-append "--prefix=" static)
294 (add-after 'build 'build-user-static
296 (with-directory-excursion "../user-static"
297 (apply (assoc-ref %standard-phases 'build) args))))
298 (add-after 'install 'install-user-static
299 (lambda* (#:key outputs #:allow-other-keys)
300 (let* ((static (assoc-ref outputs "static"))
301 (bin (string-append static "/bin")))
302 (with-directory-excursion "../user-static"
303 (for-each (cut install-file <> bin)
304 (append-map (cut find-files <> "^qemu-" #:stat stat)
307 "-linux-user" <>))))))))
308 ;; Create a wrapper for Samba. This allows QEMU to use Samba without
309 ;; pulling it in as an input. Note that you need to explicitly install
310 ;; Samba in your Guix profile for Samba support.
311 (add-after 'install 'create-samba-wrapper
312 (lambda* (#:key inputs outputs #:allow-other-keys)
313 (let* ((out (assoc-ref outputs "out"))
314 (libexec (string-append out "/libexec")))
315 (call-with-output-file "samba-wrapper"
317 (format port "#!/bin/sh
319 (chmod "samba-wrapper" #o755)
320 (install-file "samba-wrapper" libexec))))
321 (add-after 'install 'move-html-doc
322 (lambda* (#:key inputs outputs #:allow-other-keys)
323 (let* ((out (assoc-ref outputs "out"))
324 (doc (assoc-ref outputs "doc"))
325 (qemu-doc (string-append doc "/share/doc/qemu-" ,version)))
327 (rename-file (string-append out "/share/doc/qemu")
328 (string-append qemu-doc "/html"))))))))
329 (inputs ; TODO: Add optional inputs.
330 `(("alsa-lib" ,alsa-lib)
336 ("libcacard" ,libcacard) ; smartcard support
337 ("libcap-ng" ,libcap-ng) ; virtfs support requires libcap-ng & libattr
339 ("libepoxy" ,libepoxy)
340 ("libjpeg" ,libjpeg-turbo)
342 ("libseccomp" ,libseccomp)
343 ("libusb" ,libusb) ;USB pass-through support
346 ;; ("pciutils" ,pciutils)
348 ("pulseaudio" ,pulseaudio)
351 ("usbredir" ,usbredir)
352 ("util-linux" ,util-linux)
354 ("virglrenderer" ,virglrenderer)
356 (native-inputs `(("gettext" ,gettext-minimal)
357 ("glib:bin" ,glib "bin") ; gtester, etc.
361 ;; Using meson 0.57.1 enables reproducible QEMU builds.
362 ("meson" ,meson-next)
364 ("pkg-config" ,pkg-config)
365 ("python-wrapper" ,python-wrapper)
366 ("python-sphinx" ,python-sphinx)
368 ;; The following static libraries are required to build
369 ;; the static output of QEMU.
370 ("glib-static" ,glib-static)
371 ("pcre:static" ,pcre "static")
372 ("zlib:static" ,zlib "static")))
373 (home-page "https://www.qemu.org")
374 (synopsis "Machine emulator and virtualizer")
376 "QEMU is a generic machine emulator and virtualizer.
378 When used as a machine emulator, QEMU can run OSes and programs made for one
379 machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
380 using dynamic translation, it achieves very good performance.
382 When used as a virtualizer, QEMU achieves near native performances by
383 executing the guest code directly on the host CPU. QEMU supports
384 virtualization when executing under the Xen hypervisor or using
385 the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
386 server and embedded PowerPC, and S390 guests.")
388 ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
389 (license license:gpl2)
391 ;; Several tests fail on MIPS; see <http://hydra.gnu.org/build/117914>.
392 (supported-systems (fold delete %supported-systems
393 '("mips64el-linux" "i586-gnu")))))
395 (define-public qemu-minimal
396 ;; QEMU without GUI support, only supporting the host's architecture
399 (name "qemu-minimal")
401 "Machine emulator and virtualizer (without GUI) for the host architecture")
403 (substitute-keyword-arguments (package-arguments qemu)
404 ((#:configure-flags configure-flags '(list))
405 ;; Restrict to the host's architecture.
406 (let* ((system (or (%current-target-system)
410 ((? (cut string-prefix? "i686" <>))
411 "--target-list=i386-softmmu")
412 ((? (cut string-prefix? "x86_64" <>))
413 "--target-list=i386-softmmu,x86_64-softmmu")
414 ((? (cut string-prefix? "mips64" <>))
415 (string-append "--target-list=mips-softmmu,mipsel-softmmu,"
416 "mips64-softmmu,mips64el-softmmu"))
417 ((? (cut string-prefix? "mips" <>))
418 "--target-list=mips-softmmu,mipsel-softmmu")
419 ((? (cut string-prefix? "aarch64" <>))
420 "--target-list=arm-softmmu,aarch64-softmmu")
421 ((? (cut string-prefix? "arm" <>))
422 "--target-list=arm-softmmu")
423 ((? (cut string-prefix? "alpha" <>))
424 "--target-list=alpha-softmmu")
425 ((? (cut string-prefix? "powerpc64" <>))
426 "--target-list=ppc-softmmu,ppc64-softmmu")
427 ((? (cut string-prefix? "powerpc" <>))
428 "--target-list=ppc-softmmu")
429 ((? (cut string-prefix? "s390" <>))
430 "--target-list=s390x-softmmu")
431 ((? (cut string-prefix? "riscv" <>))
432 "--target-list=riscv32-softmmu,riscv64-softmmu")
433 (else ; An empty list actually builds all the targets.
435 `(cons ,target-list-arg ,configure-flags)))))
437 ;; Remove dependencies on optional libraries, notably GUI libraries.
438 (native-inputs (fold alist-delete (package-native-inputs qemu)
440 (inputs (fold alist-delete (package-inputs qemu)
441 '("libusb" "mesa" "sdl2" "spice" "virglrenderer" "gtk+"
442 "usbredir" "libdrm" "libepoxy" "pulseaudio" "vde2"
445 (define (system->qemu-target system)
447 ((string-prefix? "i686" system)
449 ((string-prefix? "arm" system)
452 (string-append "qemu-system-" (match (string-split system #\-)
456 (define-public ganeti
459 ;; Note: we use a pre-release for Python 3 compatibility as well as many
461 (version "3.0.0beta1-24-g024cc9fa2")
465 (url "https://github.com/ganeti/ganeti")
466 (commit (string-append "v" version))))
468 (base32 "1ll34qd2mifni3bhg7cnir3xfnkafig8ch33qndqwrsby0y5ssia"))
469 (file-name (git-file-name name version))
470 (patches (search-patches "ganeti-shepherd-support.patch"
471 "ganeti-shepherd-master-failover.patch"
472 "ganeti-deterministic-manual.patch"
473 "ganeti-drbd-compat.patch"
474 "ganeti-os-disk-size.patch"
475 "ganeti-haskell-pythondir.patch"
476 "ganeti-disable-version-symlinks.patch"
477 "ganeti-preserve-PYTHONPATH.patch"))))
478 (build-system gnu-build-system)
480 `(#:imported-modules (,@%gnu-build-system-modules
481 (guix build haskell-build-system)
482 (guix build python-build-system))
483 #:modules (,@%gnu-build-system-modules
484 ((guix build haskell-build-system) #:prefix haskell:)
485 ((guix build python-build-system) #:select (python-version))
488 ;; The default test target includes a lot of checks that are only really
489 ;; relevant for developers such as NEWS file checking, line lengths, etc.
490 ;; We are only interested in the "py-tests" and "hs-tests" targets: this
491 ;; is the closest we've got even though it includes a little more.
492 #:test-target "check-TESTS"
495 (list "--localstatedir=/var"
496 "--sharedstatedir=/var"
498 "--enable-haskell-tests"
500 ;; By default, the build system installs everything to versioned
501 ;; directories such as $libdir/3.0 and relies on a $libdir/default
502 ;; symlink pointed from /etc/ganeti/{lib,share} to actually function.
503 ;; This is done to accommodate installing multiple versions in
504 ;; parallel, but is of little use to us as Guix users can just
505 ;; roll back and forth. Thus, disable it for simplicity.
506 "--disable-version-links"
508 ;; Ganeti can optionally take control over SSH host keys and
509 ;; distribute them to nodes as they are added, and also rotate keys
510 ;; with 'gnt-cluster renew-crypto --new-ssh-keys'. Thus it needs to
511 ;; know how to restart the SSH daemon.
512 "--with-sshd-restart-command='herd restart ssh-daemon'"
514 ;; Look for OS definitions in this directory by default. It can
515 ;; be changed in the cluster configuration.
516 "--with-os-search-path=/run/current-system/profile/share/ganeti/os"
518 ;; The default QEMU executable to use. We don't use the package
519 ;; here because this entry is stored in the cluster configuration.
520 (string-append "--with-kvm-path=/run/current-system/profile/bin/"
521 ,(system->qemu-target (%current-system))))
523 (modify-phases %standard-phases
524 (add-after 'unpack 'create-vcs-version
526 ;; If we are building from a git checkout, we need to create a
527 ;; 'vcs-version' file manually because the build system does
528 ;; not have access to the git repository information.
529 (unless (file-exists? "vcs-version")
530 (call-with-output-file "vcs-version"
532 (format port "v~a~%" ,version))))
534 (add-after 'unpack 'patch-absolute-file-names
536 (substitute* '("lib/utils/process.py"
538 "src/Ganeti/Constants.hs"
539 "src/Ganeti/HTools/CLI.hs"
540 "test/py/ganeti.config_unittest.py"
541 "test/py/ganeti.hooks_unittest.py"
542 "test/py/ganeti.utils.process_unittest.py"
543 "test/py/ganeti.utils.text_unittest.py"
544 "test/py/ganeti.utils.wrapper_unittest.py")
545 (("/bin/sh") (which "sh"))
546 (("/bin/bash") (which "bash"))
547 (("/usr/bin/env") (which "env"))
548 (("/bin/true") (which "true")))
550 ;; This script is called by the node daemon at startup to perform
551 ;; sanity checks on the cluster IP addresses, and it is also used
552 ;; in a master-failover scenario. Add absolute references to
553 ;; avoid propagating these executables.
554 (substitute* "tools/master-ip-setup"
555 (("arping") (which "arping"))
556 (("ndisc6") (which "ndisc6"))
557 (("fping") (which "fping"))
558 (("grep") (which "grep"))
559 (("ip addr") (string-append (which "ip") " addr")))
561 (add-after 'unpack 'override-builtin-PATH
563 ;; Ganeti runs OS install scripts and similar with a built-in
564 ;; hard coded PATH. Patch so it works on Guix System.
565 (substitute* "src/Ganeti/Constants.hs"
566 (("/sbin:/bin:/usr/sbin:/usr/bin")
567 "/run/setuid-programs:/run/current-system/profile/sbin:\
568 /run/current-system/profile/bin"))
570 (add-after 'bootstrap 'patch-sphinx-version-detection
572 ;; The build system runs 'sphinx-build --version' to verify that
573 ;; the Sphinx is recent enough, but does not expect the
574 ;; .sphinx-build-real executable name created by the Sphinx wrapper.
575 (substitute* "configure"
576 (("\\$SPHINX --version 2>&1")
577 "$SPHINX --version 2>&1 | sed 's/.sphinx-build-real/sphinx-build/g'"))
580 ;; The build system invokes Cabal and GHC, which do not work with
581 ;; GHC_PACKAGE_PATH: <https://github.com/haskell/cabal/issues/3728>.
582 ;; Tweak the build system to do roughly what haskell-build-system does.
583 (add-before 'configure 'configure-haskell
584 (assoc-ref haskell:%standard-phases 'setup-compiler))
585 (add-after 'configure 'do-not-use-GHC_PACKAGE_PATH
587 (unsetenv "GHC_PACKAGE_PATH")
588 (substitute* "Makefile"
590 "$(CABAL) --package-db=../package.conf.d")
592 "$(GHC) -package-db=../package.conf.d"))
594 (add-after 'configure 'make-ghc-use-shared-libraries
596 (substitute* "Makefile"
597 (("HFLAGS =") "HFLAGS = -dynamic -fPIC"))
599 (add-after 'configure 'fix-installation-directories
601 (substitute* "Makefile"
602 ;; Do not attempt to create /var during install.
603 (("\\$\\(DESTDIR\\)\\$\\{localstatedir\\}")
604 "$(DESTDIR)${prefix}${localstatedir}")
605 ;; Similarly, do not attempt to install the sample ifup scripts
607 (("\\$\\(DESTDIR\\)\\$\\(ifupdir\\)")
608 "$(DESTDIR)${prefix}$(ifupdir)"))
610 (add-before 'build 'adjust-tests
612 ;; Disable tests that can not run. Do it early to prevent
613 ;; touching the Makefile later and triggering a needless rebuild.
614 (substitute* "Makefile"
615 ;; These tests expect the presence of a 'root' user (via
616 ;; ganeti/runtime.py), which fails in the build environment.
617 (("test/py/ganeti\\.asyncnotifier_unittest\\.py") "")
618 (("test/py/ganeti\\.backend_unittest\\.py") "")
619 (("test/py/ganeti\\.daemon_unittest\\.py") "")
620 (("test/py/ganeti\\.tools\\.ensure_dirs_unittest\\.py") "")
621 (("test/py/ganeti\\.utils\\.io_unittest-runasroot\\.py") "")
622 ;; Disable the bash_completion test, as it requires the full
623 ;; bash instead of bash-minimal.
624 (("test/py/bash_completion\\.bash")
626 ;; This test requires networking.
627 (("test/py/import-export_unittest\\.bash")
630 ;; Many of the Makefile targets reset PYTHONPATH before running
631 ;; the Python interpreter, which does not work very well for us.
632 (substitute* "Makefile"
634 (string-append "PYTHONPATH=" (getenv "PYTHONPATH") ":")))
636 (add-after 'build 'build-bash-completions
638 (let ((orig-pythonpath (getenv "PYTHONPATH")))
639 (setenv "PYTHONPATH" (string-append ".:" orig-pythonpath))
640 (invoke "./autotools/build-bash-completion")
641 (setenv "PYTHONPATH" orig-pythonpath)
643 (add-before 'check 'pre-check
644 (lambda* (#:key inputs #:allow-other-keys)
645 ;; Set TZDIR so that time zones are found.
646 (setenv "TZDIR" (string-append (assoc-ref inputs "tzdata")
649 ;; This test checks whether PYTHONPATH is untouched, and extends
650 ;; it to include test directories if so. Add an else branch for
651 ;; our modified PYTHONPATH, in order to prevent a confusing test
652 ;; failure where expired certificates are not cleaned because
653 ;; check-cert-expired is silently crashing.
654 (substitute* "test/py/ganeti-cleaner_unittest.bash"
655 (("then export PYTHONPATH=(.*)" all testpath)
656 (string-append all "else export PYTHONPATH="
657 (getenv "PYTHONPATH") ":" testpath "\n")))
659 (substitute* "test/py/ganeti.utils.process_unittest.py"
660 ;; This test attempts to run an executable with
661 ;; RunCmd(..., reset_env=True), which fails because the default
662 ;; PATH from Constants.hs does not exist in the build container.
663 ((".*def testResetEnv.*" all)
664 (string-append " @unittest.skipIf(True, "
665 "\"cannot reset env in the build container\")\n"
668 ;; XXX: Somehow this test fails in the build container, but
669 ;; works in 'guix environment -C', even without /bin/sh?
670 ((".*def testPidFile.*" all)
671 (string-append " @unittest.skipIf(True, "
672 "\"testPidFile fails in the build container\")\n"
675 ;; XXX: Why are these links not added automatically.
676 (with-directory-excursion "test/hs"
677 (for-each (lambda (file)
678 (symlink "../../src/htools" file))
679 '("hspace" "hscan" "hinfo" "hbal" "hroller"
680 "hcheck" "hail" "hsqueeze")))
682 (add-after 'install 'install-bash-completions
683 (lambda* (#:key outputs #:allow-other-keys)
684 (let* ((out (assoc-ref outputs "out"))
685 (compdir (string-append out "/etc/bash_completion.d")))
687 (copy-file "doc/examples/bash_completion"
688 (string-append compdir "/ganeti"))
689 ;; The one file contains completions for many different
690 ;; executables. Create symlinks for found completions.
691 (with-directory-excursion compdir
693 (lambda (prog) (symlink "ganeti" prog))
694 (call-with-input-file "ganeti"
696 (let loop ((line (read-line port))
698 (if (eof-object? line)
700 (if (string-prefix? "complete" line)
701 (loop (read-line port)
702 ;; Extract "prog" from lines of the form:
703 ;; "complete -F _prog -o filenames prog".
704 ;; Note that 'burnin' is listed with the
705 ;; absolute file name, which is why we
706 ;; run everything through 'basename'.
707 (cons (basename (car (reverse (string-split
710 (loop (read-line port) progs))))))))
712 ;; Wrap all executables with PYTHONPATH. We can't borrow the phase
713 ;; from python-build-system because we also need to wrap the scripts
714 ;; in $out/lib/ganeti such as "node-daemon-setup".
715 (add-after 'install 'wrap
716 (lambda* (#:key inputs outputs #:allow-other-keys)
717 (let* ((out (assoc-ref outputs "out"))
718 (sbin (string-append out "/sbin"))
719 (lib (string-append out "/lib"))
720 (python (assoc-ref inputs "python"))
721 (major+minor (python-version python))
722 (PYTHONPATH (string-append lib "/python" major+minor
724 (getenv "PYTHONPATH"))))
725 (define (shell-script? file)
726 (call-with-ascii-input-file file
728 (let ((shebang (false-if-exception (read-line port))))
730 (string-prefix? "#!" shebang)
731 (or (string-contains shebang "/bin/bash")
732 (string-contains shebang "/bin/sh")))))))
735 ;; Do not wrap shell scripts because some are meant to be
736 ;; sourced, which breaks if they are wrapped. We do wrap
737 ;; the Haskell executables because some call out to Python
739 (and (executable-file? file)
740 (not (symbolic-link? file))
741 (not (shell-script? file))))
743 (for-each (lambda (file)
745 `("PYTHONPATH" ":" prefix (,PYTHONPATH))))
747 (append (find-files (string-append lib "/ganeti"))
752 ("cabal" ,cabal-install)
755 ;; These inputs are necessary to bootstrap the package, because we
756 ;; have patched the build system.
757 ("autoconf" ,autoconf)
758 ("automake" ,automake)
760 ;; For the documentation.
761 ("python-docutils" ,python-docutils)
762 ("sphinx" ,python-sphinx)
766 ;; Test dependencies.
767 ("fakeroot" ,fakeroot)
768 ("ghc-temporary" ,ghc-temporary)
769 ("ghc-test-framework" ,ghc-test-framework)
770 ("ghc-test-framework-hunit" ,ghc-test-framework-hunit)
771 ("ghc-test-framework-quickcheck2" ,ghc-test-framework-quickcheck2)
772 ("python-mock" ,python-mock)
773 ("python-pyyaml" ,python-pyyaml)
776 ("shelltestrunner" ,shelltestrunner)
777 ("tzdata" ,tzdata-for-tests)))
779 `(("arping" ,iputils) ;must be the iputils version
782 ("iproute2" ,iproute)
785 ("qemu" ,qemu-minimal) ;for qemu-img
786 ("ghc-attoparsec" ,ghc-attoparsec)
787 ("ghc-base64-bytestring" ,ghc-base64-bytestring)
788 ("ghc-cryptonite" ,ghc-cryptonite)
789 ("ghc-curl" ,ghc-curl)
790 ("ghc-hinotify" ,ghc-hinotify)
791 ("ghc-hslogger" ,ghc-hslogger)
792 ("ghc-json" ,ghc-json)
793 ("ghc-lens" ,ghc-lens)
794 ("ghc-lifted-base" ,ghc-lifted-base)
795 ("ghc-network" ,ghc-network)
796 ("ghc-old-time" ,ghc-old-time)
797 ("ghc-psqueue" ,ghc-psqueue)
798 ("ghc-regex-pcre" ,ghc-regex-pcre)
799 ("ghc-utf8-string" ,ghc-utf8-string)
800 ("ghc-zlib" ,ghc-zlib)
802 ;; For the optional metadata daemon.
803 ("ghc-snap-core" ,ghc-snap-core)
804 ("ghc-snap-server" ,ghc-snap-server)
807 ("python-pyopenssl" ,python-pyopenssl)
808 ("python-simplejson" ,python-simplejson)
809 ("python-pyparsing" ,python-pyparsing)
810 ("python-pyinotify" ,python-pyinotify)
811 ("python-pycurl" ,python-pycurl)
812 ("python-bitarray" ,python-bitarray)
813 ("python-paramiko" ,python-paramiko)
814 ("python-psutil" ,python-psutil)))
815 (home-page "https://www.ganeti.org/")
816 (synopsis "Cluster-based virtual machine management system")
818 "Ganeti is a virtual machine management tool built on top of existing
819 virtualization technologies such as Xen or KVM. Ganeti controls:
822 @item Disk creation management;
823 @item Operating system installation for instances (in co-operation with
824 OS-specific install scripts); and
825 @item Startup, shutdown, and failover between physical systems.
828 Ganeti is designed to facilitate cluster management of virtual servers and
829 to provide fast and simple recovery after physical failures, using
830 commodity hardware.")
831 (license license:bsd-2)))
833 (define-public ganeti-instance-guix
835 (name "ganeti-instance-guix")
837 (home-page "https://github.com/mbakke/ganeti-instance-guix")
840 (uri (git-reference (url home-page) (commit version)))
841 (file-name (git-file-name name version))
844 "0aa08irpcpns6mhjgsplc5f0p8ab1qcr9ah1gj5z66kxgqyflzrp"))))
845 (build-system gnu-build-system)
847 '(#:configure-flags '("--sysconfdir=/etc" "--localstatedir=/var")))
849 `(("autoconf" ,autoconf)
850 ("automake" ,automake)))
852 `(("util-linux" ,util-linux)
853 ("qemu-img" ,qemu-minimal)))
854 (synopsis "Guix OS integration for Ganeti")
856 "This package provides a guest OS definition for Ganeti that uses
857 Guix to build virtual machines.")
858 (license license:gpl3+)))
860 (define-public ganeti-instance-debootstrap
862 (name "ganeti-instance-debootstrap")
863 ;; We need two commits on top of the latest release for compatibility
864 ;; with newer sfdisk, as well as gnt-network integration.
865 (version "0.16-2-ge145396")
866 (home-page "https://github.com/ganeti/instance-debootstrap")
869 (uri (git-reference (url home-page) (commit version)))
870 (file-name (git-file-name name version))
873 "0f2isw9d8lawzj21rrq1q9xhq8xfa65rqbhqmrn59z201x9q1336"))))
874 (build-system gnu-build-system)
876 '(#:configure-flags '("--sysconfdir=/etc" "--localstatedir=/var")
877 #:phases (modify-phases %standard-phases
878 (add-after 'unpack 'add-absolute-references
880 (substitute* "common.sh.in"
881 (("/sbin/blkid") (which "blkid"))
883 (string-append (which "kpartx") " -")))
884 (substitute* "import"
886 (string-append (which "restore") " -r")))
887 (substitute* "export"
889 (string-append (which "dump") " -0")))
890 (substitute* "create"
891 (("debootstrap") (which "debootstrap"))
892 (("`which run-parts`") (which "run-parts"))
893 ;; Here we actually need to hard code /bin/passwd
894 ;; because it's called via chroot, which fails if
895 ;; "/bin" is not in PATH.
896 (("passwd") "/bin/passwd"))
898 (add-after 'unpack 'set-dpkg-arch
899 (lambda* (#:key system #:allow-other-keys)
900 ;; The create script passes --arch to debootstrap,
901 ;; and defaults to `dpkg --print-architecture` when
902 ;; ARCH is not set in variant.conf. Hard code the
903 ;; build-time architecture to avoid the dpkg dependency.
905 (cond ((string-prefix? "x86_64" system)
907 ((string-prefix? "i686" system)
909 ((string-prefix? "aarch64" system)
911 (else (car (string-split system #\-))))))
912 (substitute* "create"
913 (("`dpkg --print-architecture`")
916 (add-after 'configure 'adjust-Makefile
918 ;; Do not attempt to create /etc/ganeti/instance-debootstrap
919 ;; and /etc/default/ganeti-instance-debootstrap during install.
920 ;; They are created by the Ganeti service.
921 (substitute* "Makefile"
922 (("\\$\\(variantsdir\\)")
923 "$(prefix)/etc/ganeti/instance-debootstrap/variants")
924 (("\\$\\(defaultsdir\\)")
925 "$(prefix)/etc/default/ganeti-instance-debootstrap"))
927 (add-after 'install 'make-variants.list-symlink
928 (lambda* (#:key outputs #:allow-other-keys)
929 ;; The Ganeti OS API mandates a variants.list file that
930 ;; describes all supported "variants" of this OS.
931 ;; Guix generates this file, so make the original file
933 (with-directory-excursion (string-append
934 (assoc-ref outputs "out")
935 "/share/ganeti/os/debootstrap")
936 (delete-file "variants.list")
937 (symlink "/etc/ganeti/instance-debootstrap/variants/variants.list"
941 `(("autoconf" ,autoconf)
942 ("automake" ,automake)))
944 `(("debianutils" ,debianutils)
945 ("debootstrap" ,debootstrap)
947 ("kpartx" ,multipath-tools)
948 ("util-linux" ,util-linux)))
949 (synopsis "Debian OS integration for Ganeti")
951 "This package provides a guest OS definition for Ganeti. It installs
952 Debian or a derivative using @command{debootstrap}.")
953 (license license:gpl2+)))
955 (define-public libosinfo
962 (uri (string-append "https://releases.pagure.org/libosinfo/libosinfo-"
966 "1s97sv24bybggjx6hgqba2qdqz3ivfpd4cmkh4zm5y59sim109mv"))))
967 (build-system meson-build-system)
970 (list (string-append "-Dwith-usb-ids-path="
971 (assoc-ref %build-inputs "usb.ids"))
972 (string-append "-Dwith-pci-ids-path="
973 (assoc-ref %build-inputs "pci.ids")))
975 (modify-phases %standard-phases
976 (add-after 'unpack 'patch-osinfo-path
977 (lambda* (#:key inputs #:allow-other-keys)
978 (substitute* "osinfo/osinfo_loader.c"
979 (("path = DATA_DIR.*")
980 (string-append "path = \"" (assoc-ref inputs "osinfo-db")
981 "/share/osinfo\";")))
984 `(("libsoup" ,libsoup)
987 ("osinfo-db" ,osinfo-db)))
989 `(("glib" ,glib "bin") ; glib-mkenums, etc.
990 ("gobject-introspection" ,gobject-introspection)
991 ("gtk-doc" ,gtk-doc/stable)
993 ("intltool" ,intltool)
994 ("pkg-config" ,pkg-config)
998 (uri "https://github.com/pciutils/pciids/raw/ad02084f0bc143e3c15e31a6152a3dfb1d7a3156/pci.ids")
1001 "0kfhpj5rnh24hz2714qhfmxk281vwc2w50sm73ggw5d15af7zfsw"))))
1005 (uri "https://svn.code.sf.net/p/linux-usb/repo/trunk/htdocs/usb.ids?r=2681")
1006 (file-name "usb.ids")
1009 "1m6yhvz5k8aqzxgk7xj3jkk8frl1hbv0h3vgj4wbnvnx79qnvz3r"))))))
1010 (home-page "https://libosinfo.org/")
1011 (synopsis "Operating system information database")
1012 (description "libosinfo is a GObject based library API for managing
1013 information about operating systems, hypervisors and the (virtual) hardware
1014 devices they can support. It includes a database containing device metadata
1015 and provides APIs to match/identify optimal devices for deploying an operating
1016 system on a hypervisor. Via GObject Introspection, the API is available in
1017 all common programming languages. Vala bindings are also provided.")
1018 ;; The library files are released under LGPLv2.1 or later; the source
1019 ;; files in the "tools" directory are released under GPLv2+.
1020 (license (list license:lgpl2.1+ license:gpl2+))))
1029 "https://linuxcontainers.org/downloads/lxc/lxc-"
1033 "0qz4l7mlhq7hx53q606qgvkyzyr01glsw290v8ppzvxn1fydlrci"))))
1034 (build-system gnu-build-system)
1036 `(("pkg-config" ,pkg-config)))
1038 `(("gnutls" ,gnutls)
1040 ("libseccomp" ,libseccomp)
1041 ("libselinux" ,libselinux)))
1044 (list (string-append "--docdir=" (assoc-ref %outputs "out")
1045 "/share/doc/" ,name "-" ,version)
1047 "--localstatedir=/var")
1049 (modify-phases %standard-phases
1051 (lambda* (#:key outputs #:allow-other-keys)
1052 (let* ((out (assoc-ref outputs "out"))
1053 (bashcompdir (string-append out "/etc/bash_completion.d")))
1054 (invoke "make" "install"
1055 (string-append "bashcompdir=" bashcompdir)
1056 ;; Don't install files into /var and /etc.
1057 "LXCPATH=/tmp/var/lib/lxc"
1058 "localstatedir=/tmp/var"
1059 "sysconfdir=/tmp/etc"
1060 "sysconfigdir=/tmp/etc/default")))))))
1061 (synopsis "Linux container tools")
1062 (home-page "https://linuxcontainers.org/")
1064 "LXC is a userspace interface for the Linux kernel containment features.
1065 Through a powerful API and simple tools, it lets Linux users easily create and
1066 manage system or application containers.")
1067 (license license:lgpl2.1+)))
1069 (define-public lxcfs
1073 (home-page "https://github.com/lxc/lxcfs")
1076 (uri (git-reference (url home-page)
1077 (commit (string-append "lxcfs-" version))))
1078 (file-name (git-file-name name version))
1081 "1f74wy88si2ia035pcvciq5821kc8jcb75w1f8vhbp0cd29rqdpi"))))
1083 '(#:configure-flags '("--localstatedir=/var")))
1085 `(("autoconf" ,autoconf)
1086 ("automake" ,automake)
1087 ("libtool" ,libtool)
1088 ("pkg-config" ,pkg-config)))
1091 (build-system gnu-build-system)
1092 (synopsis "FUSE based filesystem for LXC")
1093 (description "LXCFS is a small FUSE filesystem written with the intention
1094 of making Linux containers feel more like a virtual machine.
1095 It started as a side-project of LXC but is useable by any runtime.")
1096 (license license:lgpl2.1+)))
1098 (define-public libvirt
1105 (uri (string-append "https://libvirt.org/sources/libvirt-"
1108 (base32 "1gn13mfwbdhp31pkzvrba7avz84yc9f1ik9f3ympa51hq22vpg97"))
1109 (patches (search-patches "libvirt-add-install-prefix.patch"))))
1110 (build-system meson-build-system)
1113 (list "-Ddriver_qemu=enabled"
1114 "-Dqemu_user=nobody"
1116 "-Dstorage_disk=enabled"
1117 "-Dstorage_dir=enabled"
1119 "-Dnls=enabled" ;translations
1120 (string-append "-Ddocdir=" (assoc-ref %outputs "out") "/share/doc/"
1122 "-Dbash_completion=enabled"
1123 (string-append "-Dinstall_prefix=" (assoc-ref %outputs "out"))
1125 "--localstatedir=/var")
1128 (modify-phases %standard-phases
1129 (add-before 'configure 'disable-broken-tests
1131 (let ((tests (list "commandtest" ; hangs idly
1132 "qemuxml2argvtest" ; fails
1133 "virnetsockettest"))) ; tries to network
1134 (substitute* "tests/meson.build"
1135 (((format #f ".*'name': '(~a)'.*" (string-join tests "|")))
1138 (add-before 'install 'no-polkit-magic
1139 ;; Meson ‘magically’ invokes pkexec, which fails (not setuid).
1141 (setenv "PKEXEC_UID" "something")
1144 `(("libxml2" ,libxml2)
1146 ("libpciaccess" ,libpciaccess)
1149 ("libpcap" ,libpcap)
1151 ("libssh2" ,libssh2) ;optional
1152 ("libtirpc" ,libtirpc) ;for <rpc/rpc.h>
1153 ("libuuid" ,util-linux "lib")
1154 ("lvm2" ,lvm2) ;for libdevmapper
1156 ("openssl" ,openssl)
1157 ("readline" ,readline)
1158 ("cyrus-sasl" ,cyrus-sasl)
1159 ("libyajl" ,libyajl)
1161 ("dmidecode" ,dmidecode)
1162 ("dnsmasq" ,dnsmasq)
1163 ("ebtables" ,ebtables)
1165 ("iproute" ,iproute)
1166 ("iptables" ,iptables)))
1168 `(("bash-completion" ,bash-completion)
1169 ("gettext" ,gettext-minimal)
1170 ("xsltproc" ,libxslt)
1172 ("pkg-config" ,pkg-config)
1174 ("python" ,python-wrapper)
1175 ("python-docutils" ,python-docutils) ;for rst2html
1176 ("rpcsvc-proto" ,rpcsvc-proto))) ;for rpcgen
1177 (home-page "https://libvirt.org")
1178 (synopsis "Simple API for virtualization")
1179 (description "Libvirt is a C toolkit to interact with the virtualization
1180 capabilities of recent versions of Linux. The library aims at providing long
1181 term stable C API initially for the Xen paravirtualization but should be able
1182 to integrate other virtualization mechanisms if needed.")
1183 (license license:lgpl2.1+)))
1185 (define-public libvirt-glib
1187 (name "libvirt-glib")
1191 (uri (string-append "ftp://libvirt.org/libvirt/glib/"
1192 "libvirt-glib-" version ".tar.xz"))
1195 "1gdcvqz88qkp402zra9csc6391f2xki1270x683n6ixakl3gf8w4"))))
1196 (build-system meson-build-system)
1198 `(("openssl" ,openssl)
1199 ("cyrus-sasl" ,cyrus-sasl)
1200 ("lvm2" ,lvm2) ; for libdevmapper
1201 ("libyajl" ,libyajl)))
1203 `(("pkg-config" ,pkg-config)
1204 ("intltool" ,intltool)
1205 ("glib" ,glib "bin")
1208 ;; ‘Required:’ by the installed .pc files.
1210 ("libvirt" ,libvirt)
1211 ("libxml2" ,libxml2)
1212 ("gobject-introspection" ,gobject-introspection)))
1213 (home-page "https://libvirt.org")
1214 (synopsis "GLib wrapper around libvirt")
1215 (description "libvirt-glib wraps the libvirt library to provide a
1216 high-level object-oriented API better suited for glib-based applications, via
1220 @item libvirt-glib - GLib main loop integration & misc helper APIs
1221 @item libvirt-gconfig - GObjects for manipulating libvirt XML documents
1222 @item libvirt-gobject - GObjects for managing libvirt objects
1225 (license license:lgpl2.1+)))
1227 (define-public python-libvirt
1229 (name "python-libvirt")
1234 (uri (string-append "https://libvirt.org/sources/python/libvirt-python-"
1237 (base32 "15pn8610ybf03xff3vbz3apz2ph42k2kh6k19r020l9nvc6jcv37"))))
1238 (build-system python-build-system)
1241 (modify-phases %standard-phases
1243 (lambda* (#:key inputs outputs tests? #:allow-other-keys)
1245 ;; No reason to explicity invoke Python on a wrapped pytest.
1246 (substitute* "setup.py"
1247 (("sys\\.executable, pytest") "pytest"))
1248 (add-installed-pythonpath inputs outputs)
1249 (setenv "LIBVIRT_API_COVERAGE" "whynot")
1250 (invoke "python" "setup.py" "test")))))))
1252 `(("libvirt" ,libvirt)))
1254 `(("python-lxml" ,python-lxml)))
1256 `(("pkg-config" ,pkg-config)
1257 ("python-pytest" ,python-pytest)))
1258 (home-page "https://libvirt.org")
1259 (synopsis "Python bindings to libvirt")
1260 (description "This package provides Python bindings to the libvirt
1261 virtualization library.")
1262 (license license:lgpl2.1+)))
1264 (define-public python2-libvirt
1265 (package-with-python2 python-libvirt))
1267 (define-public virt-manager
1269 (name "virt-manager")
1273 (uri (string-append "https://virt-manager.org/download/sources"
1274 "/virt-manager/virt-manager-"
1278 "11kvpzcmyir91qz0dsnk7748jbb4wr8mrc744w117qc91pcy6vrb"))))
1279 (build-system python-build-system)
1281 `(#:use-setuptools? #f ; uses custom distutils 'install' command
1282 #:tests? #f ; TODO The tests currently fail
1283 ; RuntimeError: Loop condition wasn't
1285 #:imported-modules ((guix build glib-or-gtk-build-system)
1286 ,@%python-build-system-modules)
1287 #:modules ((ice-9 match)
1289 (guix build python-build-system)
1290 ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
1293 (modify-phases %standard-phases
1294 (add-after 'unpack 'fix-setup
1295 (lambda* (#:key outputs #:allow-other-keys)
1296 (substitute* "virtinst/buildconfig.py"
1297 (("/usr") (assoc-ref outputs "out")))
1299 (add-after 'unpack 'fix-default-uri
1300 (lambda* (#:key inputs #:allow-other-keys)
1301 ;; Xen is not available for now - so only patch qemu.
1302 (substitute* "virtManager/createconn.py"
1303 (("/usr(/bin/qemu-system)" _ suffix)
1304 (string-append (assoc-ref inputs "qemu") suffix)))
1306 (add-before 'wrap 'wrap-with-GI_TYPELIB_PATH
1307 (lambda* (#:key inputs outputs #:allow-other-keys)
1308 (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
1309 (bin-files (find-files bin ".*"))
1310 (paths (map (match-lambda
1311 ((output . directory)
1312 (let* ((girepodir (string-append
1314 "/lib/girepository-1.0")))
1315 (if (file-exists? girepodir)
1318 (for-each (lambda (file)
1319 (format #t "wrapping ~a\n" file)
1321 `("GI_TYPELIB_PATH" ":" prefix
1322 ,(filter identity paths))))
1326 (lambda* (#:key tests? #:allow-other-keys)
1328 (setenv "HOME" "/tmp")
1329 (setenv "XDG_CACHE_HOME" "/tmp")
1330 (system "Xvfb :1 &")
1331 (setenv "DISPLAY" ":1")
1332 ;; Dogtail requires that Assistive Technology support be enabled
1333 (setenv "GTK_MODULES" "gail:atk-bridge")
1334 (invoke "dbus-run-session" "--" "pytest" "--uitests"))
1336 (add-after 'install 'glib-or-gtk-compile-schemas
1337 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
1338 (add-after 'install 'glib-or-gtk-wrap
1339 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
1343 ("gtk-vnc" ,gtk-vnc)
1344 ("gtksourceview" ,gtksourceview)
1345 ("libvirt" ,libvirt)
1346 ("libvirt-glib" ,libvirt-glib)
1347 ("libosinfo" ,libosinfo)
1349 ("python-libvirt" ,python-libvirt)
1350 ("python-requests" ,python-requests)
1351 ("python-pycairo" ,python-pycairo)
1352 ("python-pygobject" ,python-pygobject)
1353 ("python-libxml2" ,python-libxml2)
1354 ("spice-gtk" ,spice-gtk)))
1355 ;; virt-manager searches for qemu-img or kvm-img in the PATH.
1359 `(("glib" ,glib "bin") ; glib-compile-schemas
1360 ("gobject-introspection" ,gobject-introspection)
1361 ("gtk+" ,gtk+ "bin") ; gtk-update-icon-cache
1362 ("perl" ,perl) ; pod2man
1363 ("intltool" ,intltool)
1364 ("rst2man" ,python-docutils)
1365 ;; The following are required for running the tests
1366 ;; ("python-pytest" ,python-pytest)
1367 ;; ("python-dogtail" ,python-dogtail)
1368 ;; ("xvfb" ,xorg-server-for-tests)
1370 ;; ("at-spi2-core" ,at-spi2-core)
1371 ;; ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
1373 (home-page "https://virt-manager.org/")
1374 (synopsis "Manage virtual machines")
1376 "The virt-manager application is a desktop user interface for managing
1377 virtual machines through libvirt. It primarily targets KVM VMs, but also
1378 manages Xen and LXC (Linux containers). It presents a summary view of running
1379 domains, their live performance and resource utilization statistics.")
1380 (license license:gpl2+)))
1388 (uri (string-append "https://download.openvz.org/criu/criu-"
1389 version ".tar.bz2"))
1392 "09d0j24x0cyc7wkgi7cnxqgfjk7kbdlm79zxpj8d356sa3rw2z24"))))
1393 (build-system gnu-build-system)
1395 `(#:test-target "test"
1396 #:tests? #f ; tests require mounting as root
1398 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1399 (string-append "LIBDIR=" (assoc-ref %outputs "out")
1401 (string-append "ASCIIDOC=" (assoc-ref %build-inputs "asciidoc")
1403 (string-append "XMLTO=" (assoc-ref %build-inputs "xmlto")
1406 (modify-phases %standard-phases
1408 (lambda* (#:key inputs #:allow-other-keys)
1409 ;; The includes for libnl are located in a sub-directory.
1410 (setenv "C_INCLUDE_PATH"
1411 (string-append (assoc-ref inputs "libnl")
1413 (or (getenv "C_INCLUDE_PATH") "")))
1415 (add-after 'configure 'fix-documentation
1416 (lambda* (#:key inputs outputs #:allow-other-keys)
1417 (substitute* "Documentation/Makefile"
1420 "-m custom.xsl --skip-validation -x "
1421 (assoc-ref inputs "docbook-xsl") "/xml/xsl/"
1422 ,(package-name docbook-xsl) "-"
1423 ,(package-version docbook-xsl)
1424 "/manpages/docbook.xsl")))
1426 (add-after 'unpack 'hardcode-variables
1427 (lambda* (#:key inputs #:allow-other-keys)
1428 ;; Hardcode arm version detection
1429 (substitute* "Makefile"
1430 (("ARMV.*:=.*") "ARMV := 7\n"))
1431 ;; We are currently using python-2
1432 (substitute* "crit/Makefile"
1433 (("\\$\\(PYTHON\\)") "python2"))
1434 (substitute* "lib/Makefile"
1435 (("\\$\\(PYTHON\\)")
1436 (string-append (assoc-ref inputs "python")
1439 (add-before 'build 'fix-symlink
1440 (lambda* (#:key inputs #:allow-other-keys)
1441 ;; The file 'images/google/protobuf/descriptor.proto' points to
1442 ;; /usr/include/..., which obviously does not exist.
1443 (let* ((file "google/protobuf/descriptor.proto")
1444 (target (string-append "images/" file))
1445 (source (string-append (assoc-ref inputs "protobuf")
1447 (delete-file target)
1448 (symlink source target)
1450 (add-after 'install 'wrap
1451 (lambda* (#:key inputs outputs #:allow-other-keys)
1452 ;; Make sure 'crit' runs with the correct PYTHONPATH.
1453 (let* ((out (assoc-ref outputs "out"))
1454 (path (string-append out
1456 (string-take (string-take-right
1457 (assoc-ref inputs "python") 5) 3)
1459 (getenv "PYTHONPATH"))))
1460 (wrap-program (string-append out "/bin/crit")
1461 `("PYTHONPATH" ":" prefix (,path))))
1464 `(("protobuf" ,protobuf)
1465 ("python" ,python-2)
1466 ("python2-protobuf" ,python2-protobuf)
1467 ("python2-ipaddr" ,python2-ipaddr)
1468 ("iproute" ,iproute)
1474 ("nftables" ,nftables)))
1476 `(("pkg-config" ,pkg-config)
1478 ("protobuf-c" ,protobuf-c)
1479 ("asciidoc" ,asciidoc)
1481 ("docbook-xml" ,docbook-xml)
1482 ("docbook-xsl" ,docbook-xsl)))
1483 (home-page "https://criu.org")
1484 (synopsis "Checkpoint and restore in user space")
1485 (description "Using this tool, you can freeze a running application (or
1486 part of it) and checkpoint it to a hard drive as a collection of files. You
1487 can then use the files to restore and run the application from the point it
1488 was frozen at. The distinctive feature of the CRIU project is that it is
1489 mainly implemented in user space.")
1490 ;; The project is licensed under GPLv2; files in the lib/ directory are
1492 (license (list license:gpl2 license:lgpl2.1))))
1494 (define-public qmpbackup
1501 (url "https://github.com/abbbi/qmpbackup")
1503 (file-name (git-file-name name version))
1506 "0swhp5byz44brhyis1a39p11fyn9q84xz5q6v2fah29r7d71kmmx"))))
1507 (build-system python-build-system)
1509 `(#:python ,python-2))
1510 (home-page "https://github.com/abbbi/qmpbackup")
1511 (synopsis "Backup and restore QEMU machines")
1512 (description "qmpbackup is designed to create and restore full and
1513 incremental backups of running QEMU virtual machines via QMP, the QEMU
1515 (license license:gpl3+)))
1517 (define-public looking-glass-client
1518 (let ((commit "182c4752d57690da7f99d5e788de9b8baea33895"))
1520 (name "looking-glass-client")
1521 (version (string-append "a12-" (string-take commit 7)))
1525 (uri (git-reference (url "https://github.com/gnif/LookingGlass")
1527 (file-name (git-file-name name version))
1530 "02bq46ndmzq9cihazzn7xq1x7q5nzm7iw4l9lqzihxcxp9famkhw"))
1531 (modules '((guix build utils)))
1534 ;; Do not create binaries optimized for the CPU of the build machine,
1535 ;; for reproducibility and compatibility. TODO: in the next version
1536 ;; of looking glass, this is exposed as a CMake configure option.
1537 (substitute* "client/CMakeLists.txt"
1541 (build-system cmake-build-system)
1542 (inputs `(("fontconfig" ,fontconfig)
1545 ("openssl" ,openssl)
1547 ("sdl2-ttf" ,sdl2-ttf)
1548 ("spice-protocol" ,spice-protocol)
1549 ("wayland" ,wayland)))
1550 (native-inputs `(("libconfig" ,libconfig)
1552 ("pkg-config" ,pkg-config)))
1554 `(#:tests? #f ;; No tests are available.
1555 #:make-flags '("CC=gcc")
1556 #:phases (modify-phases %standard-phases
1557 (add-before 'configure 'chdir-to-client
1558 (lambda* (#:key outputs #:allow-other-keys)
1561 (add-after 'chdir-to-client 'add-missing-include
1563 ;; Mimic upstream commit b9797529893, required since the
1564 ;; update to Mesa 19.2.
1565 (substitute* "renderers/egl/shader.h"
1566 (("#include <stdbool\\.h>")
1567 "#include <stdbool.h>\n#include <stddef.h>"))
1570 (lambda* (#:key outputs #:allow-other-keys)
1571 (install-file "looking-glass-client"
1572 (string-append (assoc-ref outputs "out")
1575 (home-page "https://looking-glass.hostfission.com")
1576 (synopsis "KVM Frame Relay (KVMFR) implementation")
1577 (description "Looking Glass allows the use of a KVM (Kernel-based Virtual
1578 Machine) configured for VGA PCI Pass-through without an attached physical
1579 monitor, keyboard or mouse. It displays the VM's rendered contents on your main
1581 ;; This package requires SSE instructions.
1582 (supported-systems '("i686-linux" "x86_64-linux"))
1583 (license license:gpl2+))))
1588 (version "1.0.0-rc93")
1592 "https://github.com/opencontainers/runc/releases/"
1593 "download/v" version "/runc.tar.xz"))
1594 (file-name (string-append name "-" version ".tar.xz"))
1597 "0b90r1bkvlqli53ca1yc1l488dba0isd3i6l7nlhszxi8p7hzvkh"))))
1598 (build-system go-build-system)
1600 '(#:import-path "github.com/opencontainers/runc"
1601 #:install-source? #f
1602 ;; XXX: 20/139 tests fail due to missing /var, cgroups and apparmor in
1603 ;; the build environment.
1606 (modify-phases %standard-phases
1608 (lambda* (#:key import-path #:allow-other-keys)
1609 (with-directory-excursion (string-append "src/" import-path)
1610 (invoke "make" "all" "man"))))
1612 (lambda* (#:key tests? #:allow-other-keys)
1614 (invoke "make" "localunittest"))))
1616 (lambda* (#:key import-path outputs #:allow-other-keys)
1617 (with-directory-excursion (string-append "src/" import-path)
1618 (let ((out (assoc-ref outputs "out")))
1619 (invoke "make" "install" "install-bash" "install-man"
1620 (string-append "PREFIX=" out)))))))))
1622 `(("go-md2man" ,go-github-com-go-md2man)
1623 ("pkg-config" ,pkg-config)))
1625 `(("libseccomp" ,libseccomp)))
1626 (synopsis "Open container initiative runtime")
1627 (home-page "https://opencontainers.org/")
1629 "@command{runc} is a command line client for running applications
1630 packaged according to the
1631 @uref{https://github.com/opencontainers/runtime-spec/blob/master/spec.md, Open
1632 Container Initiative (OCI) format} and is a compliant implementation of the
1633 Open Container Initiative specification.")
1634 (license license:asl2.0)))
1636 (define-public umoci
1644 "https://github.com/opencontainers/umoci/releases/download/v"
1645 version "/umoci.tar.xz"))
1646 (file-name (string-append "umoci-" version ".tar.xz"))
1648 (base32 "0fvljj9k4f83wbqzd8nbijz0p1zaq633f8yxyvl5sy3wjf03ffk9"))))
1649 (build-system go-build-system)
1651 '(#:import-path "github.com/opencontainers/umoci"
1652 #:install-source? #f
1654 (modify-phases %standard-phases
1656 (lambda* (#:key source import-path #:allow-other-keys)
1657 ;; Unpack the tarball into 'umoci' instead of "runc-${version}".
1658 (let ((dest (string-append "src/" import-path)))
1660 (invoke "tar" "-C" (string-append "src/" import-path)
1661 "--strip-components=1"
1664 (lambda* (#:key import-path #:allow-other-keys)
1665 (with-directory-excursion (string-append "src/" import-path)
1666 ;; TODO: build manpages with 'go-md2man'.
1667 (invoke "make" "SHELL=bash"))))
1669 (lambda* (#:key import-path outputs #:allow-other-keys)
1670 (let* ((out (assoc-ref outputs "out"))
1671 (bindir (string-append out "/bin")))
1672 (install-file (string-append "src/" import-path "/umoci")
1675 (home-page "https://umo.ci/")
1676 (synopsis "Tool for modifying Open Container images")
1678 "@command{umoci} is a tool that allows for high-level modification of an
1679 Open Container Initiative (OCI) image layout and its tagged images.")
1680 (license license:asl2.0)))
1682 (define-public skopeo
1689 (url "https://github.com/containers/skopeo")
1690 (commit (string-append "v" version))))
1691 (file-name (git-file-name name version))
1694 "0n22sdif437ddg5ch0ipwim3fg0n6ihc9bfi52qkhy3r1grz04hs"))))
1695 (build-system go-build-system)
1697 `(("pkg-config" ,pkg-config)
1698 ("go-github-com-go-md2man" ,go-github-com-go-md2man)))
1700 `(("btrfs-progs" ,btrfs-progs)
1702 ("libassuan" ,libassuan)
1703 ("libselinux" ,libselinux)
1704 ("libostree" ,libostree)
1709 '(#:import-path "github.com/containers/skopeo"
1710 #:install-source? #f
1711 #:tests? #f ; The tests require Docker
1713 (modify-phases %standard-phases
1715 (lambda* (#:key import-path #:allow-other-keys)
1716 (with-directory-excursion (string-append "src/" import-path)
1717 (invoke "make" "bin/skopeo"))))
1718 (add-after 'build 'build-docs
1719 (lambda* (#:key import-path #:allow-other-keys)
1720 (with-directory-excursion (string-append "src/" import-path)
1721 (invoke "make" "docs"))))
1723 (lambda* (#:key import-path outputs #:allow-other-keys)
1724 (with-directory-excursion (string-append "src/" import-path)
1725 (let ((out (assoc-ref outputs "out")))
1726 (install-file "default-policy.json"
1727 (string-append out "/etc/containers"))
1728 (invoke "make" "install-binary" "install-completions" "install-docs"
1729 (string-append "PREFIX=" out)))))))))
1730 (home-page "https://github.com/containers/skopeo")
1731 (synopsis "Interact with container images and container image registries")
1733 "@command{skopeo} is a command line utility providing various operations
1734 with container images and container image registries. It can:
1737 @item Copy container images between various containers image stores,
1738 converting them as necessary.
1740 @item Convert a Docker schema 2 or schema 1 container image to an OCI image.
1742 @item Inspect a repository on a container registry without needlessly pulling
1745 @item Sign and verify container images.
1747 @item Delete container images from a remote container registry.
1750 (license license:asl2.0)))
1752 (define-public python-vagrant
1754 (name "python-vagrant")
1759 (uri (pypi-uri "python-vagrant" version))
1762 "1ikrh6canhcxg5y7pzmkcnnydikppv7s6sm9prfx90nk0ac8m6mg"))))
1763 (build-system python-build-system)
1765 '(#:tests? #f)) ; tests involve running vagrant.
1766 (home-page "https://github.com/todddeluca/python-vagrant")
1767 (synopsis "Python bindings for Vagrant")
1769 "Python-vagrant is a Python module that provides a thin wrapper around the
1770 @code{vagrant} command line executable, allowing programmatic control of Vagrant
1772 (license license:expat)))
1774 (define-public bubblewrap
1780 (uri (string-append "https://github.com/containers/bubblewrap/"
1781 "releases/download/v" version "/bubblewrap-"
1785 "00ycgi6q2yngh06bnz50wkvar6r2jnjf3j158grhi9k13jdrpimr"))))
1786 (build-system gnu-build-system)
1789 (modify-phases %standard-phases
1790 (add-after 'unpack 'fix-test
1791 (lambda* (#:key outputs #:allow-other-keys)
1792 ;; Tests try to access /var/tmp, which is not possible in our build
1793 ;; environment. Let's give them another directory.
1794 ;; /tmp gets overriden in some tests, so we need another directory.
1795 ;; the only possibility is the output directory.
1796 (let ((tmp-dir (string-append (assoc-ref outputs "out") "/tmp")))
1798 (substitute* "tests/test-run.sh"
1799 (("/var/tmp") tmp-dir)
1800 ;; Tests create a temporary python script, so fix its shebang.
1801 (("/usr/bin/env python") (which "python"))
1802 ;; Some tests try to access /usr, but that doesn't exist.
1803 ;; Give them /gnu instead.
1805 (("--ro-bind /bin /bin") "--ro-bind /gnu /bin")
1806 (("--ro-bind /sbin /sbin") "--ro-bind /gnu /sbin")
1807 (("--ro-bind /lib /lib") "--ro-bind /gnu /lib")
1808 ((" */bin/bash") (which "bash"))
1809 (("/bin/sh") (which "sh"))
1810 (("findmnt") (which "findmnt"))))
1812 ;; Remove the directory we gave to tests to have a clean package.
1813 (add-after 'check 'remove-tmp-dir
1814 (lambda* (#:key outputs #:allow-other-keys)
1815 (delete-file-recursively (string-append (assoc-ref outputs "out") "/tmp"))
1818 `(("libcap" ,libcap)))
1820 `(("python" ,python-wrapper)
1821 ("util-linux" ,util-linux)))
1822 (home-page "https://github.com/containers/bubblewrap")
1823 (synopsis "Unprivileged sandboxing tool")
1824 (description "Bubblewrap is aimed at running applications in a sandbox,
1825 restricting their access to parts of the operating system or user data such as
1826 the home directory. Bubblewrap always creates a new mount namespace, and the
1827 user can specify exactly what parts of the file system should be made visible
1828 in the sandbox. These directories are mounted with the @code{nodev} option
1829 by default and can be made read-only.")
1830 (license license:lgpl2.0+)))
1832 (define-public bochs
1839 (uri (string-append "https://sourceforge.net/projects/bochs/files/bochs/"
1840 version "/bochs-" version ".tar.gz"))
1842 (base32 "0ql8q6y1k356li1g9gbvl21448mlxphxxi6kjb2b3pxvzd0pp2b3"))))
1843 (build-system gnu-build-system)
1845 `(#:tests? #f)) ; no tests exist
1847 `(("libxrandr" ,libxrandr)))
1848 (home-page "http://bochs.sourceforge.net/")
1849 (synopsis "Emulator for x86 PC")
1851 "Bochs is an emulator which can emulate Intel x86 CPU, common I/O
1852 devices, and a custom BIOS. It can also be compiled to emulate many different
1853 x86 CPUs, from early 386 to the most recent x86-64 Intel and AMD processors.
1854 Bochs can run most Operating Systems inside the emulation including Linux,
1855 DOS or Microsoft Windows.")
1856 (license license:lgpl2.0+)))
1865 (url "git://xenbits.xenproject.org/xen.git")
1866 (commit (string-append "RELEASE-" version))))
1867 (file-name (git-file-name name version))
1870 "1r90rvypw76ya9clqw5p02gm1k8hxz73f7gr95ca778nnzvb7xjw"))))
1871 (build-system gnu-build-system)
1874 (list "--enable-rpath"
1875 "--disable-qemu-traditional" ; It tries to do "git clone"
1876 "--disable-rombios" ; would try to "git clone" via etherboot.
1877 ;; TODO: Re-enable stubdom (it's "more secure" to use it).
1878 "--disable-stubdom" ; tries to "git clone" old patched newlib.
1879 (string-append "--with-initddir="
1880 (assoc-ref %outputs "out")
1882 (string-append "--with-system-qemu="
1883 (assoc-ref %build-inputs "qemu")
1884 "/bin/qemu-system-i386")
1885 (string-append "--with-system-seabios="
1886 (assoc-ref %build-inputs "seabios")
1887 "/share/firmware/bios.bin")
1888 (string-append "--with-system-ovmf="
1889 (assoc-ref %build-inputs "ovmf")
1890 "/share/firmware/ovmf_ia32.bin"))
1891 #:make-flags (list "-j" "1"
1892 "XEN_BUILD_DATE=Thu Jan 1 01:00:01 CET 1970"
1893 "XEN_BUILD_TIME=01:00:01"
1896 "SMBIOS_REL_DATE=01/01/1970"
1897 "VGABIOS_REL_DATE=01 Jan 1970"
1898 ; QEMU_TRADITIONAL_LOC
1900 "SYSCONFIG_DIR=/tmp/etc/default"
1901 (string-append "BASH_COMPLETION_DIR="
1902 (assoc-ref %outputs "out")
1903 "/etc/bash_completion.d")
1904 (string-append "BOOT_DIR="
1905 (assoc-ref %outputs "out")
1907 (string-append "DEBUG_DIR="
1908 (assoc-ref %outputs "out")
1910 (string-append "EFI_DIR="
1911 (assoc-ref %outputs "out")
1912 "/lib/efi") ; TODO lib64 ?
1913 "MINIOS_UPSTREAM_URL="
1914 ;(string-append "DISTDIR="
1915 ; (assoc-ref %outputs "out"))
1917 #:test-target "test"
1919 (modify-phases %standard-phases
1920 (add-after 'unpack 'unpack-mini-os
1921 (lambda* (#:key inputs #:allow-other-keys)
1922 (copy-recursively (assoc-ref inputs "mini-os") "extras/mini-os")
1924 (add-after 'unpack-mini-os 'patch
1925 (lambda* (#:key inputs outputs #:allow-other-keys)
1926 (substitute* "tools/firmware/Rules.mk"
1927 (("override XEN_TARGET_ARCH = x86_32")
1928 (string-append "override XEN_TARGET_ARCH = x86_32
1929 override CC = " (assoc-ref inputs "cross-gcc") "/bin/i686-linux-gnu-gcc"))
1931 (string-append "CFLAGS=-I" (assoc-ref inputs "cross-libc")
1933 (substitute* "config/x86_32.mk"
1934 (("CFLAGS += -m32 -march=i686")
1935 (string-append "CFLAGS += -march=i686 -I"
1936 (assoc-ref inputs "cross-libc")
1938 ;; /var is not in /gnu/store , so don't try to create it.
1939 (substitute* '("tools/Makefile"
1940 "tools/xenstore/Makefile"
1941 "tools/xenpaging/Makefile")
1942 (("\\$\\(INSTALL_DIR\\) .*XEN_(DUMP|LOG|RUN|LIB|PAGING)_DIR.*")
1944 (("\\$\\(INSTALL_DIR\\) .*XEN_(RUN|LIB)_STORED.*")
1946 ;; Prevent xen from creating /etc .
1947 (substitute* "tools/examples/Makefile"
1948 ((" install-readmes") "")
1949 ((" install-configs") ""))
1951 (substitute* "tools/pygrub/setup.py"
1953 ; TODO: extra_link_args = ['-Wl,-rpath=/opt/foo'],
1954 (string-append "runtime_library_dirs = ['"
1955 (assoc-ref outputs "out")
1956 "/lib'],\nlibrary_dirs =")))
1958 (add-before 'configure 'patch-xen-script-directory
1959 (lambda* (#:key outputs #:allow-other-keys)
1960 (substitute* '("configure"
1963 (("XEN_SCRIPT_DIR=.*")
1964 (string-append "XEN_SCRIPT_DIR="
1965 (assoc-ref outputs "out")
1966 "/etc/xen/scripts")))
1968 (add-before 'configure 'set-environment-up
1969 (lambda* (#:key make-flags #:allow-other-keys)
1971 (string-contains x "cross-i686-linux"))
1972 (define (filter-environment! filter-predicate
1973 environment-variable-names)
1976 (let* ((env-value (getenv env-name))
1977 (search-path (search-path-as-string->list env-value))
1978 (new-search-path (filter filter-predicate
1980 (new-env-value (list->search-path-as-string
1981 new-search-path ":")))
1982 (setenv env-name new-env-value)))
1983 environment-variable-names))
1984 (setenv "CROSS_C_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
1985 (setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
1986 (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
1987 (filter-environment! cross?
1988 '("CROSS_C_INCLUDE_PATH" "CROSS_CPLUS_INCLUDE_PATH"
1989 "CROSS_LIBRARY_PATH"))
1990 (filter-environment! (lambda (e) (not (cross? e)))
1991 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
1993 ;; Guix tries to be helpful and automatically adds
1994 ;; mini-os-git-checkout/include to the include path,
1995 ;; but actually we don't want it to be there (yet).
1996 (filter-environment! (lambda (e)
1999 "mini-os-git-checkout")))
2000 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
2002 (setenv "EFI_VENDOR" "guix")
2005 (lambda* (#:key make-flags #:allow-other-keys)
2006 (apply invoke "make" "world" make-flags))))))
2008 `(("acpica" ,acpica) ; TODO: patch iasl invocation.
2009 ("bridge-utils" ,bridge-utils) ; TODO: patch invocations.
2011 ("iproute" ,iproute) ; TODO: patch invocations.
2014 ("libyajl" ,libyajl)
2015 ("ncurses" ,ncurses)
2016 ("openssl" ,openssl)
2019 ("qemu" ,qemu-minimal)
2020 ("seabios" ,seabios)
2021 ("util-linux" ,util-linux "lib") ; uuid
2022 ; TODO: ocaml-findlib, ocaml-nox.
2023 ("xz" ,xz) ; for liblzma
2028 ("cmake" ,cmake-minimal)
2031 ("gettext" ,gettext-minimal)
2037 (url "http://xenbits.xen.org/git-http/mini-os.git")
2038 (commit (string-append "xen-RELEASE-" version))))
2041 "1i8pcl19n60i2m9vlg79q3nknpj209c9ic5x10wxaicx45kc107f"))
2042 (file-name "mini-os-git-checkout")))
2045 ("pkg-config" ,pkg-config)
2046 ("python" ,python-2)
2048 ("cross-gcc" ,(cross-gcc "i686-linux-gnu"
2049 #:xbinutils (cross-binutils "i686-linux-gnu")
2050 #:libc (cross-libc "i686-linux-gnu")))
2051 ("cross-libc" ,(cross-libc "i686-linux-gnu")) ; header files
2052 ("cross-libc-static" ,(cross-libc "i686-linux-gnu") "static")))
2053 (home-page "https://xenproject.org/")
2054 (synopsis "Xen Virtual Machine Monitor")
2055 (description "This package provides the Xen Virtual Machine Monitor
2056 which is a hypervisor.")
2057 ;; TODO: Some files are licensed differently. List those.
2058 (license license:gpl2)
2059 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))))
2061 (define-public osinfo-db-tools
2063 (name "osinfo-db-tools")
2067 (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-tools-"
2072 "038q3gzdbkfkhpicj0755mw1q4gbvn57pslpw8n2dp3lds9im0g9"))))
2073 (build-system meson-build-system)
2075 `(("libsoup" ,libsoup)
2076 ("libxml2" ,libxml2)
2077 ("libxslt" ,libxslt)
2078 ("json-glib" ,json-glib)
2079 ("libarchive" ,libarchive)))
2082 ("gobject-introspection" ,gobject-introspection)
2083 ("gettext" ,gettext-minimal)
2084 ("pkg-config" ,pkg-config)
2087 ("pytest" ,python-pytest)
2088 ("requests" ,python-requests)))
2089 (home-page "https://gitlab.com/libosinfo/osinfo-db-tools")
2090 (synopsis "Tools for managing the osinfo database")
2091 (description "This package contains a set of tools to assist
2092 administrators and developers in managing the database.")
2093 (license license:lgpl2.0+)))
2095 (define-public osinfo-db
2098 (version "20201218")
2101 (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-"
2105 "0ydbindwgw7kg861rqii5036gq0dbbbmv35dzrmmv937ddfsxwh0"))))
2106 (build-system trivial-build-system)
2108 `(#:modules ((guix build utils))
2111 (use-modules (guix build utils))
2112 (let* ((out (assoc-ref %outputs "out"))
2113 (osinfo-dir (string-append out "/share/osinfo"))
2114 (source (assoc-ref %build-inputs "source"))
2116 (string-append (assoc-ref %build-inputs "osinfo-db-tools")
2117 "/bin/osinfo-db-import")))
2118 (mkdir-p osinfo-dir)
2119 (invoke osinfo-db-import "--dir" osinfo-dir source)
2122 `(("intltool" ,intltool)
2123 ("osinfo-db-tools" ,osinfo-db-tools)))
2124 (home-page "https://gitlab.com/libosinfo/osinfo-db")
2125 (synopsis "Database of information about operating systems")
2126 (description "Osinfo-db provides the database files for use with the
2127 libosinfo library. It provides information about guest operating systems for
2128 use with virtualization provisioning tools")
2129 (license license:lgpl2.0+)))
2131 (define-public python-transient
2133 (name "python-transient")
2138 (uri (pypi-uri "transient" version))
2141 "148yiqrmcscsi6787y0f27i1y9cf0gcw3mqfv5frhpmsmv62mv5z"))))
2142 (build-system python-build-system)
2144 `(#:tests? #f ; Requires behave
2145 #:phases (modify-phases %standard-phases
2146 (add-after 'unpack 'fix-dependencies
2148 (substitute* "setup.py"
2153 `(("python-beautifultable" ,python-beautifultable)
2154 ("python-click" ,python-click)
2155 ("python-importlib-resources"
2156 ,python-importlib-resources)
2157 ("python-lark-parser" ,python-lark-parser)
2158 ("python-marshmallow" ,python-marshmallow)
2159 ("python-progressbar2" ,python-progressbar2)
2160 ("python-requests" ,python-requests)
2161 ("python-toml" ,python-toml)))
2163 `(("python-black" ,python-black)
2164 ("python-mypy" ,python-mypy)
2165 ("python-pyhamcrest" ,python-pyhamcrest)
2166 ("python-twine" ,python-twine)))
2168 "https://github.com/ALSchwalm/transient")
2170 "QEMU Wrapper written in Python")
2172 "@code{transient} is a wrapper for QEMU allowing the creation of virtual
2173 machines with shared folder, ssh, and disk creation support.")
2174 (license license:expat)))