1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015, 2016, 2017, 2018 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2016, 2017, 2018. 2019 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, 2018, 2019, 2020 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>
15 ;;; This file is part of GNU Guix.
17 ;;; GNU Guix is free software; you can redistribute it and/or modify it
18 ;;; under the terms of the GNU General Public License as published by
19 ;;; the Free Software Foundation; either version 3 of the License, or (at
20 ;;; your option) any later version.
22 ;;; GNU Guix is distributed in the hope that it will be useful, but
23 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 ;;; GNU General Public License for more details.
27 ;;; You should have received a copy of the GNU General Public License
28 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
30 (define-module (gnu packages virtualization)
31 #:use-module (gnu packages)
32 #:use-module (gnu packages admin)
33 #:use-module (gnu packages assembly)
34 #:use-module (gnu packages attr)
35 #:use-module (gnu packages autotools)
36 #:use-module (gnu packages bison)
37 #:use-module (gnu packages check)
38 #:use-module (gnu packages cmake)
39 #:use-module (gnu packages compression)
40 #:use-module (gnu packages cross-base)
41 #:use-module (gnu packages curl)
42 #:use-module (gnu packages cyrus-sasl)
43 #:use-module (gnu packages disk)
44 #:use-module (gnu packages dns)
45 #:use-module (gnu packages docbook)
46 #:use-module (gnu packages documentation)
47 #:use-module (gnu packages figlet)
48 #:use-module (gnu packages firmware)
49 #:use-module (gnu packages flex)
50 #:use-module (gnu packages fontutils)
51 #:use-module (gnu packages freedesktop)
52 #:use-module (gnu packages gettext)
53 #:use-module (gnu packages gl)
54 #:use-module (gnu packages glib)
55 #:use-module (gnu packages gnome)
56 #:use-module (gnu packages gnupg)
57 #:use-module (gnu packages golang)
58 #:use-module (gnu packages gtk)
59 #:use-module (gnu packages image)
60 #:use-module (gnu packages libbsd)
61 #:use-module (gnu packages libusb)
62 #:use-module (gnu packages linux)
63 #:use-module (gnu packages ncurses)
64 #:use-module (gnu packages nettle)
65 #:use-module (gnu packages networking)
66 #:use-module (gnu packages onc-rpc)
67 #:use-module (gnu packages package-management)
68 #:use-module (gnu packages perl)
69 #:use-module (gnu packages pkg-config)
70 #:use-module (gnu packages polkit)
71 #:use-module (gnu packages protobuf)
72 #:use-module (gnu packages python)
73 #:use-module (gnu packages python-web)
74 #:use-module (gnu packages python-xyz)
75 #:use-module (gnu packages pulseaudio)
76 #:use-module (gnu packages selinux)
77 #:use-module (gnu packages sdl)
78 #:use-module (gnu packages sphinx)
79 #:use-module (gnu packages spice)
80 #:use-module (gnu packages texinfo)
81 #:use-module (gnu packages textutils)
82 #:use-module (gnu packages tls)
83 #:use-module (gnu packages web)
84 #:use-module (gnu packages wget)
85 #:use-module (gnu packages xdisorg)
86 #:use-module (gnu packages xml)
87 #:use-module (gnu packages xorg)
88 #:use-module (guix build-system cmake)
89 #:use-module (guix build-system gnu)
90 #:use-module (guix build-system go)
91 #:use-module (guix build-system meson)
92 #:use-module (guix build-system python)
93 #:use-module (guix download)
94 #:use-module (guix git-download)
95 #:use-module ((guix licenses) #:prefix license:)
96 #:use-module (guix packages)
97 #:use-module (guix utils)
98 #:use-module (srfi srfi-1))
100 (define (qemu-patch commit file-name sha256)
101 "Return an origin for COMMIT."
105 "http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h="
108 (file-name file-name)))
116 (uri (string-append "https://download.qemu.org/qemu-"
118 (patches (search-patches "qemu-CVE-2020-1711.patch"
119 "qemu-CVE-2020-7039.patch"
120 "qemu-CVE-2020-7211.patch"
121 "qemu-fix-documentation-build-failure.patch"))
124 "1w38hzlw7xp05gcq1nhga7hxvndxy6dfcnzi7q2il8ff110isj6k"))))
125 (build-system gnu-build-system)
127 '(;; Running tests in parallel can occasionally lead to failures, like:
128 ;; boot_sector_test: assertion failed (signature == SIGNATURE): (0x00000000 == 0x0000dead)
130 #:configure-flags (list "--enable-usb-redir" "--enable-opengl"
132 (string-append "--smbd="
133 (assoc-ref %outputs "out")
134 "/libexec/samba-wrapper")
135 "--audio-drv-list=alsa,pa,sdl")
136 ;; Make build and test output verbose to facilitate investigation upon failure.
137 #:make-flags '("V=1")
139 (modify-phases %standard-phases
141 (lambda* (#:key inputs outputs (configure-flags '())
143 ;; The `configure' script doesn't understand some of the
144 ;; GNU options. Thus, add a new phase that's compatible.
145 (let ((out (assoc-ref outputs "out")))
146 (setenv "SHELL" (which "bash"))
148 ;; While we're at it, patch for tests.
149 (substitute* "tests/libqtest.c"
150 (("/bin/sh") (which "sh")))
152 ;; The binaries need to be linked against -lrt.
153 (setenv "LDFLAGS" "-lrt")
156 ,(string-append "--cc=" (which "gcc"))
157 ;; Some architectures insist on using HOST_CC
158 ,(string-append "--host-cc=" (which "gcc"))
159 "--disable-debug-info" ; save build space
160 "--enable-virtfs" ; just to be sure
161 ,(string-append "--prefix=" out)
162 ,(string-append "--sysconfdir=/etc")
163 ,@configure-flags)))))
164 (add-after 'install 'install-info
165 (lambda* (#:key inputs outputs #:allow-other-keys)
166 ;; Install the Info manual, unless Texinfo is missing.
167 (when (assoc-ref inputs "texinfo")
168 (let* ((out (assoc-ref outputs "out"))
169 (dir (string-append out "/share/info")))
170 (invoke "make" "info")
171 (for-each (lambda (info)
172 (install-file info dir))
173 (find-files "." "\\.info"))))
175 ;; Create a wrapper for Samba. This allows QEMU to use Samba without
176 ;; pulling it in as an input. Note that you need to explicitly install
177 ;; Samba in your Guix profile for Samba support.
178 (add-after 'install-info 'create-samba-wrapper
179 (lambda* (#:key inputs outputs #:allow-other-keys)
180 (let* ((out (assoc-ref %outputs "out"))
181 (libexec (string-append out "/libexec")))
182 (call-with-output-file "samba-wrapper"
184 (format port "#!/bin/sh
186 (chmod "samba-wrapper" #o755)
187 (install-file "samba-wrapper" libexec))
189 (add-before 'configure 'prevent-network-configuration
191 ;; Prevent the build from trying to use git to fetch from the net.
192 (substitute* "Makefile"
193 (("@./config.status")
195 (add-before 'check 'disable-unusable-tests
196 (lambda* (#:key inputs outputs #:allow-other-keys)
197 (substitute* "tests/Makefile.include"
198 ;; Comment out the test-qga test, which needs /sys and
199 ;; fails within the build environment.
200 (("check-unit-.* tests/test-qga" all)
201 (string-append "# " all)))
202 (substitute* "tests/Makefile.include"
203 ;; Comment out the test-char test, which needs networking and
204 ;; fails within the build environment.
205 (("check-unit-.* tests/test-char" all)
206 (string-append "# " all)))
208 (inputs ; TODO: Add optional inputs.
209 `(("alsa-lib" ,alsa-lib)
215 ("libcap" ,libcap) ; virtfs support requires libcap & libattr
217 ("libepoxy" ,libepoxy)
218 ("libjpeg" ,libjpeg-turbo)
220 ("libseccomp" ,libseccomp)
221 ("libusb" ,libusb) ;USB pass-through support
224 ;; ("pciutils" ,pciutils)
226 ("pulseaudio" ,pulseaudio)
229 ("usbredir" ,usbredir)
230 ("util-linux" ,util-linux)
232 ("virglrenderer" ,virglrenderer)
234 (native-inputs `(("gettext" ,gettext-minimal)
235 ("glib:bin" ,glib "bin") ; gtester, etc.
239 ("pkg-config" ,pkg-config)
240 ("python-wrapper" ,python-wrapper)
241 ("python-sphinx" ,python-sphinx)
242 ("texinfo" ,texinfo)))
243 (home-page "https://www.qemu.org")
244 (synopsis "Machine emulator and virtualizer")
246 "QEMU is a generic machine emulator and virtualizer.
248 When used as a machine emulator, QEMU can run OSes and programs made for one
249 machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
250 using dynamic translation, it achieves very good performance.
252 When used as a virtualizer, QEMU achieves near native performances by
253 executing the guest code directly on the host CPU. QEMU supports
254 virtualization when executing under the Xen hypervisor or using
255 the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
256 server and embedded PowerPC, and S390 guests.")
258 ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
259 (license license:gpl2)
261 ;; Several tests fail on MIPS; see <http://hydra.gnu.org/build/117914>.
262 (supported-systems (delete "mips64el-linux" %supported-systems))))
264 (define-public qemu-minimal
265 ;; QEMU without GUI support.
266 (package (inherit qemu)
267 (name "qemu-minimal")
268 (synopsis "Machine emulator and virtualizer (without GUI)")
270 (substitute-keyword-arguments (package-arguments qemu)
271 ((#:configure-flags _ '(list))
272 ;; Restrict to the targets supported by Guix.
273 ''("--target-list=i386-softmmu,x86_64-softmmu,mips64el-softmmu,arm-softmmu,aarch64-softmmu"))))
275 ;; Remove dependencies on optional libraries, notably GUI libraries.
276 (native-inputs (fold alist-delete (package-native-inputs qemu)
278 (inputs (fold alist-delete (package-inputs qemu)
279 '("libusb" "mesa" "sdl2" "spice" "virglrenderer" "gtk+"
280 "usbredir" "libdrm" "libepoxy" "pulseaudio" "vde2")))))
282 ;; The GRUB test suite fails with later versions of Qemu, so we
283 ;; keep it at 2.10 for now. See
284 ;; <https://lists.gnu.org/archive/html/bug-grub/2018-02/msg00004.html>.
285 ;; This package is hidden since we do not backport updates to it.
286 (define-public qemu-minimal-2.10
289 (inherit qemu-minimal)
293 (uri (string-append "https://download.qemu.org/qemu-"
297 "17w21spvaxaidi2am5lpsln8yjpyp2zi3s3gc6nsxj5arlgamzgw"))
299 (search-patches "qemu-glibc-2.27.patch"))))
300 ;; qemu-minimal-2.10 needs Python 2. Remove below once no longer necessary.
301 (native-inputs `(("python-2" ,python-2)
302 ,@(fold alist-delete (package-native-inputs qemu)
303 '("python-wrapper" "python-sphinx"))))
305 (fold alist-delete (package-inputs qemu)
306 ;; Disable seccomp support, because it's not required for the GRUB
307 ;; test suite, and because it fails with libseccomp 2.4.2 and later.
310 (define-public libosinfo
317 (uri (string-append "https://releases.pagure.org/libosinfo/libosinfo-"
321 "1s97sv24bybggjx6hgqba2qdqz3ivfpd4cmkh4zm5y59sim109mv"))))
322 (build-system meson-build-system)
325 (list (string-append "-Dwith-usb-ids-path="
326 (assoc-ref %build-inputs "usb.ids"))
327 (string-append "-Dwith-pci-ids-path="
328 (assoc-ref %build-inputs "pci.ids")))))
330 `(("libsoup" ,libsoup)
333 ("gobject-introspection" ,gobject-introspection)))
335 `(("glib" ,glib "bin") ; glib-mkenums, etc.
338 ("intltool" ,intltool)
339 ("pkg-config" ,pkg-config)
343 (uri "https://github.com/pciutils/pciids/raw/ad02084f0bc143e3c15e31a6152a3dfb1d7a3156/pci.ids")
346 "0kfhpj5rnh24hz2714qhfmxk281vwc2w50sm73ggw5d15af7zfsw"))))
350 (uri "https://svn.code.sf.net/p/linux-usb/repo/trunk/htdocs/usb.ids?r=2681")
351 (file-name "usb.ids")
354 "1m6yhvz5k8aqzxgk7xj3jkk8frl1hbv0h3vgj4wbnvnx79qnvz3r"))))))
355 (home-page "https://libosinfo.org/")
356 (synopsis "Operating system information database")
357 (description "libosinfo is a GObject based library API for managing
358 information about operating systems, hypervisors and the (virtual) hardware
359 devices they can support. It includes a database containing device metadata
360 and provides APIs to match/identify optimal devices for deploying an operating
361 system on a hypervisor. Via GObject Introspection, the API is available in
362 all common programming languages. Vala bindings are also provided.")
363 ;; The library files are released under LGPLv2.1 or later; the source
364 ;; files in the "tools" directory are released under GPLv2+.
365 (license (list license:lgpl2.1+ license:gpl2+))))
374 "https://linuxcontainers.org/downloads/lxc/lxc-"
378 "1igxqgx8q9cp15mcp1y8j564bl85ijw04jcmgb1s5bmfbg1751sd"))))
379 (build-system gnu-build-system)
381 `(("pkg-config" ,pkg-config)))
385 ("libseccomp" ,libseccomp)
386 ("libselinux" ,libselinux)))
389 (list (string-append "--docdir=" (assoc-ref %outputs "out")
390 "/share/doc/" ,name "-" ,version)
392 "--localstatedir=/var")
394 ;; Treat the kernel headers as system headers to silence
395 ;; compiler warnings from those.
396 (list (string-append "C_INCLUDE_PATH="
397 (assoc-ref %build-inputs "kernel-headers")
400 (modify-phases %standard-phases
402 (lambda* (#:key outputs #:allow-other-keys)
403 (let* ((out (assoc-ref outputs "out"))
404 (bashcompdir (string-append out "/etc/bash_completion.d")))
405 (invoke "make" "install"
406 (string-append "bashcompdir=" bashcompdir)
407 ;; Don't install files into /var and /etc.
408 "LXCPATH=/tmp/var/lib/lxc"
409 "localstatedir=/tmp/var"
410 "sysconfdir=/tmp/etc"
411 "sysconfigdir=/tmp/etc/default")))))))
412 (synopsis "Linux container tools")
413 (home-page "https://linuxcontainers.org/")
415 "LXC is a userspace interface for the Linux kernel containment features.
416 Through a powerful API and simple tools, it lets Linux users easily create and
417 manage system or application containers.")
418 (license license:lgpl2.1+)))
420 (define-public libvirt
427 (uri (string-append "https://libvirt.org/sources/libvirt-"
430 (base32 "0m8cqaqflvys5kaqpvb0qr4k365j09jc5xk6x70yvg8qkcl2hcz2"))
432 (search-patches "libvirt-create-machine-cgroup.patch"))))
433 (build-system gnu-build-system)
437 "--with-qemu-user=nobody"
438 "--with-qemu-group=kvm"
440 (string-append "--docdir=" (assoc-ref %outputs "out") "/share/doc/"
443 "--localstatedir=/var")
445 (modify-phases %standard-phases
446 (add-before 'configure 'fix-BOURNE_SHELL-definition
447 ;; BOURNE_SHELL is hard-#defined to ‘/bin/sh’, causing test failures.
449 (substitute* "config.h.in"
450 (("/bin/sh") (which "sh")))
452 (add-before 'configure 'patch-libtirpc-file-names
453 (lambda* (#:key inputs #:allow-other-keys)
454 ;; libvirt uses an m4 macro instead of pkg-config to determine where
455 ;; the RPC headers are located. Tell it to look in the right place.
456 (substitute* "configure"
457 (("/usr/include/tirpc") ;defined in m4/virt-xdr.m4
458 (string-append (assoc-ref inputs "libtirpc")
461 (add-before 'configure 'disable-broken-tests
463 (let ((tests (list "commandtest" ; hangs idly
464 "qemuxml2argvtest" ; fails
465 "qemuhotplugtest" ; fails
466 "virnetsockettest" ; tries to network
467 "virshtest"))) ; fails
468 (substitute* "tests/Makefile.in"
469 (((format #f "(~a)\\$\\(EXEEXT\\)" (string-join tests "|")))
473 ;; Since the sysconfdir and localstatedir should be /etc and /var
474 ;; at runtime, we must prevent writing to them at installation
476 (lambda* (#:key make-flags #:allow-other-keys)
477 (apply invoke "make" "install"
478 "sysconfdir=/tmp/etc"
479 "localstatedir=/tmp/var"
482 `(("libxml2" ,libxml2)
484 ("libpciaccess" ,libpciaccess)
489 ("libtirpc" ,libtirpc) ;for <rpc/rpc.h>
490 ("libuuid" ,util-linux)
491 ("lvm2" ,lvm2) ;for libdevmapper
494 ("cyrus-sasl" ,cyrus-sasl)
497 ("dmidecode" ,dmidecode)
499 ("ebtables" ,ebtables)
501 ("iptables" ,iptables)))
503 `(("xsltproc" ,libxslt)
505 ("pkg-config" ,pkg-config)
507 ("python" ,python-wrapper)))
508 (home-page "https://libvirt.org")
509 (synopsis "Simple API for virtualization")
510 (description "Libvirt is a C toolkit to interact with the virtualization
511 capabilities of recent versions of Linux. The library aims at providing long
512 term stable C API initially for the Xen paravirtualization but should be able
513 to integrate other virtualization mechanisms if needed.")
514 (license license:lgpl2.1+)))
516 (define-public libvirt-glib
518 (name "libvirt-glib")
522 (uri (string-append "ftp://libvirt.org/libvirt/glib/"
523 "libvirt-glib-" version ".tar.gz"))
526 "0six9ckmvlwwyavyjkgc262qkpvfqgi8rjij7cyk00bmqq8c9s4l"))))
527 (build-system gnu-build-system)
529 `(("openssl" ,openssl)
530 ("cyrus-sasl" ,cyrus-sasl)
531 ("lvm2" ,lvm2) ; for libdevmapper
532 ("libyajl" ,libyajl)))
534 `(("pkg-config" ,pkg-config)
535 ("intltool" ,intltool)
539 ;; ‘Required:’ by the installed .pc files.
543 ("gobject-introspection" ,gobject-introspection)))
544 (home-page "https://libvirt.org")
545 (synopsis "GLib wrapper around libvirt")
546 (description "libvirt-glib wraps the libvirt library to provide a
547 high-level object-oriented API better suited for glib-based applications, via
551 @item libvirt-glib - GLib main loop integration & misc helper APIs
552 @item libvirt-gconfig - GObjects for manipulating libvirt XML documents
553 @item libvirt-gobject - GObjects for managing libvirt objects
556 (license license:lgpl2.1+)))
558 (define-public python-libvirt
560 (name "python-libvirt")
565 (uri (string-append "https://libvirt.org/sources/python/libvirt-python-"
568 (base32 "0kyz3lx49d8p75mvbzinxc1zgs8g7adn77y9bm15b8b4ad9zl5s6"))))
569 (build-system python-build-system)
572 (modify-phases %standard-phases
573 (add-after 'unpack 'patch-nosetests-path
574 (lambda* (#:key inputs #:allow-other-keys)
575 (substitute* "setup.py"
576 (("\"/usr/bin/nosetests\"")
577 (string-append "\"" (which "nosetests") "\""))
578 (("self\\.spawn\\(\\[sys\\.executable, nose\\]\\)")
579 (format #f "self.spawn([\"~a\", nose])" (which "bash"))))
582 `(("libvirt" ,libvirt)))
584 `(("python-lxml" ,python-lxml)))
586 `(("pkg-config" ,pkg-config)
587 ("python-nose" ,python-nose)))
588 (home-page "https://libvirt.org")
589 (synopsis "Python bindings to libvirt")
590 (description "This package provides Python bindings to the libvirt
591 virtualization library.")
592 (license license:lgpl2.1+)))
594 (define-public python2-libvirt
595 (package-with-python2 python-libvirt))
597 (define-public virt-manager
599 (name "virt-manager")
603 (uri (string-append "https://virt-manager.org/download/sources"
604 "/virt-manager/virt-manager-"
608 "06ws0agxlip6p6n3n43knsnjyd91gqhh2dadgc33wl9lx1k8vn6g"))))
609 (build-system python-build-system)
611 `(#:use-setuptools? #f ; uses custom distutils 'install' command
612 ;; Some of the tests seem to require network access to install virtual
615 #:imported-modules ((guix build glib-or-gtk-build-system)
616 ,@%python-build-system-modules)
617 #:modules ((ice-9 match)
619 (guix build python-build-system)
620 ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
623 (modify-phases %standard-phases
624 (add-after 'unpack 'fix-setup
625 (lambda* (#:key outputs #:allow-other-keys)
626 (substitute* "virtinst/buildconfig.py"
627 (("/usr") (assoc-ref outputs "out")))
629 (add-after 'unpack 'fix-qemu-img-reference
630 (lambda* (#:key inputs #:allow-other-keys)
631 (substitute* "virtconv/formats.py"
632 (("/usr(/bin/qemu-img)" _ suffix)
633 (string-append (assoc-ref inputs "qemu") suffix)))
635 (add-after 'unpack 'fix-default-uri
636 (lambda* (#:key inputs #:allow-other-keys)
637 ;; Xen is not available for now - so only patch qemu.
638 (substitute* "virtManager/createconn.py"
639 (("/usr(/bin/qemu-system)" _ suffix)
640 (string-append (assoc-ref inputs "qemu") suffix)))
642 (add-before 'wrap 'wrap-with-GI_TYPELIB_PATH
643 (lambda* (#:key inputs outputs #:allow-other-keys)
644 (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
645 (bin-files (find-files bin ".*"))
646 (paths (map (match-lambda
647 ((output . directory)
648 (let* ((girepodir (string-append
650 "/lib/girepository-1.0")))
651 (if (file-exists? girepodir)
654 (for-each (lambda (file)
655 (format #t "wrapping ~a\n" file)
657 `("GI_TYPELIB_PATH" ":" prefix
658 ,(filter identity paths))))
661 (add-after 'install 'glib-or-gtk-compile-schemas
662 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
663 (add-after 'install 'glib-or-gtk-wrap
664 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
669 ("gtksourceview" ,gtksourceview)
671 ("libvirt-glib" ,libvirt-glib)
672 ("libosinfo" ,libosinfo)
674 ("gobject-introspection" ,gobject-introspection)
675 ("python-libvirt" ,python-libvirt)
676 ("python-requests" ,python-requests)
677 ("python-ipaddress" ,python-ipaddress)
678 ("python-pycairo" ,python-pycairo)
679 ("python-pygobject" ,python-pygobject)
680 ("python-libxml2" ,python-libxml2)
681 ("spice-gtk" ,spice-gtk)))
682 ;; virt-manager searches for qemu-img or kvm-img in the PATH.
686 `(("glib" ,glib "bin") ; glib-compile-schemas
687 ("gtk+" ,gtk+ "bin") ; gtk-update-icon-cache
688 ("perl" ,perl) ; pod2man
689 ("intltool" ,intltool)))
690 (home-page "https://virt-manager.org/")
691 (synopsis "Manage virtual machines")
693 "The virt-manager application is a desktop user interface for managing
694 virtual machines through libvirt. It primarily targets KVM VMs, but also
695 manages Xen and LXC (Linux containers). It presents a summary view of running
696 domains, their live performance and resource utilization statistics.")
697 (license license:gpl2+)))
705 (uri (string-append "http://download.openvz.org/criu/criu-"
709 "1yn9ix9lqvqvjrs3a3g6g1wqfniyf9n7giy0mr3jvijmrcm7y0pa"))))
710 (build-system gnu-build-system)
712 `(#:test-target "test"
713 #:tests? #f ; tests require mounting as root
715 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
716 (string-append "LIBDIR=" (assoc-ref %outputs "out")
718 (string-append "ASCIIDOC=" (assoc-ref %build-inputs "asciidoc")
720 (string-append "XMLTO=" (assoc-ref %build-inputs "xmlto")
723 (modify-phases %standard-phases
725 (lambda* (#:key inputs #:allow-other-keys)
726 ;; The includes for libnl are located in a sub-directory.
727 (setenv "C_INCLUDE_PATH"
728 (string-append (assoc-ref inputs "libnl")
730 ;; Also add the kernel headers here so that GCC
731 ;; treats them as "system headers". Otherwise
732 ;; the build fails with -Werror because parasite.c
733 ;; includes both <linux/fs.h> and <sys/mount.h>,
734 ;; which define some of the same constants.
735 (assoc-ref inputs "kernel-headers")
738 (add-after 'configure 'fix-documentation
739 (lambda* (#:key inputs outputs #:allow-other-keys)
740 (substitute* "Documentation/Makefile"
743 "-m custom.xsl --skip-validation -x "
744 (assoc-ref inputs "docbook-xsl") "/xml/xsl/"
745 ,(package-name docbook-xsl) "-"
746 ,(package-version docbook-xsl)
747 "/manpages/docbook.xsl")))
749 (add-after 'unpack 'hardcode-variables
750 (lambda* (#:key inputs #:allow-other-keys)
751 ;; Hardcode arm version detection
752 (substitute* "Makefile"
753 (("ARMV.*:=.*") "ARMV := 7\n"))
754 ;; We are currently using python-2
755 (substitute* "crit/Makefile"
756 (("\\$\\(PYTHON\\)") "python2"))
757 (substitute* "lib/Makefile"
759 (string-append (assoc-ref inputs "python")
762 (add-before 'build 'fix-symlink
763 (lambda* (#:key inputs #:allow-other-keys)
764 ;; The file 'images/google/protobuf/descriptor.proto' points to
765 ;; /usr/include/..., which obviously does not exist.
766 (let* ((file "google/protobuf/descriptor.proto")
767 (target (string-append "images/" file))
768 (source (string-append (assoc-ref inputs "protobuf")
771 (symlink source target)
773 (add-after 'install 'wrap
774 (lambda* (#:key inputs outputs #:allow-other-keys)
775 ;; Make sure 'crit' runs with the correct PYTHONPATH.
776 (let* ((out (assoc-ref outputs "out"))
777 (path (string-append out
779 (string-take (string-take-right
780 (assoc-ref inputs "python") 5) 3)
782 (getenv "PYTHONPATH"))))
783 (wrap-program (string-append out "/bin/crit")
784 `("PYTHONPATH" ":" prefix (,path))))
787 `(("protobuf" ,protobuf)
789 ("python2-protobuf" ,python2-protobuf)
790 ("python2-ipaddr" ,python2-ipaddr)
798 `(("pkg-config" ,pkg-config)
800 ("protobuf-c" ,protobuf-c)
801 ("asciidoc" ,asciidoc)
803 ("docbook-xml" ,docbook-xml)
804 ("docbook-xsl" ,docbook-xsl)))
805 (home-page "https://criu.org")
806 (synopsis "Checkpoint and restore in user space")
807 (description "Using this tool, you can freeze a running application (or
808 part of it) and checkpoint it to a hard drive as a collection of files. You
809 can then use the files to restore and run the application from the point it
810 was frozen at. The distinctive feature of the CRIU project is that it is
811 mainly implemented in user space.")
812 ;; The project is licensed under GPLv2; files in the lib/ directory are
814 (license (list license:gpl2 license:lgpl2.1))))
816 (define-public qmpbackup
823 (url "https://github.com/abbbi/qmpbackup.git")
825 (file-name (git-file-name name version))
828 "0swhp5byz44brhyis1a39p11fyn9q84xz5q6v2fah29r7d71kmmx"))))
829 (build-system python-build-system)
831 `(#:python ,python-2))
832 (home-page "https://github.com/abbbi/qmpbackup")
833 (synopsis "Backup and restore QEMU machines")
834 (description "qmpbackup is designed to create and restore full and
835 incremental backups of running QEMU virtual machines via QMP, the QEMU
837 (license license:gpl3+)))
839 (define-public looking-glass-client
840 (let ((commit "182c4752d57690da7f99d5e788de9b8baea33895"))
842 (name "looking-glass-client")
843 (version (string-append "a12-" (string-take commit 7)))
847 (uri (git-reference (url "https://github.com/gnif/LookingGlass")
849 (file-name (git-file-name name version))
852 "02bq46ndmzq9cihazzn7xq1x7q5nzm7iw4l9lqzihxcxp9famkhw"))
853 (modules '((guix build utils)))
856 ;; Do not create binaries optimized for the CPU of the build machine,
857 ;; for reproducibility and compatibility. TODO: in the next version
858 ;; of looking glass, this is exposed as a CMake configure option.
859 (substitute* "client/CMakeLists.txt"
863 (build-system cmake-build-system)
864 (inputs `(("fontconfig" ,fontconfig)
869 ("sdl2-ttf" ,sdl2-ttf)
870 ("spice-protocol" ,spice-protocol)
871 ("wayland" ,wayland)))
872 (native-inputs `(("libconfig" ,libconfig)
874 ("pkg-config" ,pkg-config)))
876 `(#:tests? #f ;; No tests are available.
877 #:make-flags '("CC=gcc")
878 #:phases (modify-phases %standard-phases
879 (add-before 'configure 'chdir-to-client
880 (lambda* (#:key outputs #:allow-other-keys)
883 (add-after 'chdir-to-client 'add-missing-include
885 ;; Mimic upstream commit b9797529893, required since the
886 ;; update to Mesa 19.2.
887 (substitute* "renderers/egl/shader.h"
888 (("#include <stdbool\\.h>")
889 "#include <stdbool.h>\n#include <stddef.h>"))
892 (lambda* (#:key outputs #:allow-other-keys)
893 (install-file "looking-glass-client"
894 (string-append (assoc-ref outputs "out")
897 (home-page "https://looking-glass.hostfission.com")
898 (synopsis "KVM Frame Relay (KVMFR) implementation")
899 (description "Looking Glass allows the use of a KVM (Kernel-based Virtual
900 Machine) configured for VGA PCI Pass-through without an attached physical
901 monitor, keyboard or mouse. It displays the VM's rendered contents on your main
903 ;; This package requires SSE instructions.
904 (supported-systems '("i686-linux" "x86_64-linux"))
905 (license license:gpl2+))))
907 (define-public lookingglass
908 (deprecated-package "lookingglass" looking-glass-client))
913 (version "1.0.0-rc6")
917 "https://github.com/opencontainers/runc/releases/"
918 "download/v" version "/runc.tar.xz"))
919 (file-name (string-append name "-" version ".tar.xz"))
920 (patches (search-patches "runc-CVE-2019-5736.patch"))
923 "1c7832dq70slkjh8qp2civ1wxhhdd2hrx84pq7db1mmqc9fdr3cc"))))
924 (build-system go-build-system)
926 '(#:import-path "github.com/opencontainers/runc"
928 ;; XXX: 20/139 tests fail due to missing /var, cgroups and apparmor in
929 ;; the build environment.
932 (modify-phases %standard-phases
934 (lambda* (#:key source import-path #:allow-other-keys)
935 ;; Unpack the tarball into 'runc' instead of 'runc-1.0.0-rc5'.
936 (let ((dest (string-append "src/" import-path)))
938 (invoke "tar" "-C" (string-append "src/" import-path)
939 "--strip-components=1"
942 (lambda* (#:key import-path #:allow-other-keys)
943 (chdir (string-append "src/" import-path))
944 ;; XXX: requires 'go-md2man'.
945 ;; (invoke "make" "man")
949 ;; (invoke "make" "localunittest")))
951 (lambda* (#:key outputs #:allow-other-keys)
952 (let ((out (assoc-ref outputs "out")))
953 (invoke "make" "install" "install-bash"
954 (string-append "PREFIX=" out))))))))
956 `(("pkg-config" ,pkg-config)))
958 `(("libseccomp" ,libseccomp)))
959 (synopsis "Open container initiative runtime")
960 (home-page "https://www.opencontainers.org/")
962 "@command{runc} is a command line client for running applications
963 packaged according to the
964 @uref{https://github.com/opencontainers/runtime-spec/blob/master/spec.md, Open
965 Container Initiative (OCI) format} and is a compliant implementation of the
966 Open Container Initiative specification.")
967 (license license:asl2.0)))
976 "https://github.com/openSUSE/umoci/releases/download/v"
977 version "/umoci.tar.xz"))
978 (file-name (string-append "umoci-" version ".tar.xz"))
981 "0x1yyvpllz6fyy9xip6f7b6c94v984n3faf8p50fr9y4ygkgi15a"))))
982 (build-system go-build-system)
984 '(#:import-path "github.com/openSUSE/umoci"
987 (modify-phases %standard-phases
989 (lambda* (#:key source import-path #:allow-other-keys)
990 ;; Unpack the tarball into 'umoci' instead of "runc-${version}".
991 (let ((dest (string-append "src/" import-path)))
993 (invoke "tar" "-C" (string-append "src/" import-path)
994 "--strip-components=1"
997 (lambda* (#:key import-path #:allow-other-keys)
998 (chdir (string-append "src/" import-path))
999 ;; TODO: build manpages with 'go-md2man'.
1000 (invoke "make" "SHELL=bash")))
1002 (lambda* (#:key outputs #:allow-other-keys)
1003 (let* ((out (assoc-ref outputs "out"))
1004 (bindir (string-append out "/bin")))
1005 (install-file "umoci" bindir)
1007 (home-page "https://umo.ci/")
1008 (synopsis "Tool for modifying Open Container images")
1010 "@command{umoci} is a tool that allows for high-level modification of an
1011 Open Container Initiative (OCI) image layout and its tagged images.")
1012 (license license:asl2.0)))
1014 (define-public skopeo
1021 (url "https://github.com/projectatomic/skopeo")
1022 (commit (string-append "v" version))))
1023 (file-name (git-file-name name version))
1026 "1bagirzdzjhicn5dr691092ac3q6lhz3xngjzgqiqkxnvpz7p6cn"))))
1027 (build-system go-build-system)
1029 `(("pkg-config" ,pkg-config)))
1031 `(("btrfs-progs" ,btrfs-progs)
1033 ("libassuan" ,libassuan)
1034 ("libselinux" ,libselinux)
1035 ("libostree" ,libostree)
1040 '(#:import-path "github.com/projectatomic/skopeo"
1041 #:install-source? #f
1042 #:tests? #f ; The tests require Docker
1044 (modify-phases %standard-phases
1046 (lambda* (#:key import-path #:allow-other-keys)
1047 (chdir (string-append "src/" import-path))
1048 ;; TODO: build manpages with 'go-md2man'.
1049 (invoke "make" "binary-local")))
1051 (lambda* (#:key outputs #:allow-other-keys)
1052 (let ((out (assoc-ref outputs "out")))
1053 (invoke "make" "install-binary" "install-completions"
1054 (string-append "PREFIX=" out))))))))
1055 (home-page "https://github.com/projectatomic/skopeo")
1056 (synopsis "Interact with container images and container image registries")
1058 "@command{skopeo} is a command line utility providing various operations
1059 with container images and container image registries. It can:
1062 @item Copy container images between various containers image stores,
1063 converting them as necessary.
1065 @item Convert a Docker schema 2 or schema 1 container image to an OCI image.
1067 @item Inspect a repository on a container registry without needlessly pulling
1070 @item Sign and verify container images.
1072 @item Delete container images from a remote container registry.
1075 (license license:asl2.0)))
1077 (define-public python-vagrant
1079 (name "python-vagrant")
1084 (uri (pypi-uri "python-vagrant" version))
1087 "1ikrh6canhcxg5y7pzmkcnnydikppv7s6sm9prfx90nk0ac8m6mg"))))
1088 (build-system python-build-system)
1090 '(#:tests? #f)) ; tests involve running vagrant.
1091 (home-page "https://github.com/todddeluca/python-vagrant")
1092 (synopsis "Python bindings for Vagrant")
1094 "Python-vagrant is a Python module that provides a thin wrapper around the
1095 @code{vagrant} command line executable, allowing programmatic control of Vagrant
1097 (license license:expat)))
1099 (define-public bubblewrap
1105 (uri (string-append "https://github.com/containers/bubblewrap/"
1106 "releases/download/v" version "/bubblewrap-"
1110 "08r0f4c3fjkb4zjrb4kkax1zfcgcgic702vb62sjjw5xfhppvzp5"))))
1111 (build-system gnu-build-system)
1114 (modify-phases %standard-phases
1115 (add-after 'unpack 'fix-test
1116 (lambda* (#:key outputs #:allow-other-keys)
1117 ;; Tests try to access /var/tmp, which is not possible in our build
1118 ;; environment. Let's give them another directory.
1119 ;; /tmp gets overriden in some tests, so we need another directory.
1120 ;; the only possibility is the output directory.
1121 (let ((tmp-dir (string-append (assoc-ref outputs "out") "/tmp")))
1123 (substitute* "tests/test-run.sh"
1124 (("/var/tmp") tmp-dir)
1125 ;; Tests create a temporary python script, so fix its shebang.
1126 (("/usr/bin/env python") (which "python"))
1127 ;; Some tests try to access /usr, but that doesn't exist.
1128 ;; Give them /gnu instead.
1130 (("--ro-bind /bin /bin") "--ro-bind /gnu /bin")
1131 (("--ro-bind /sbin /sbin") "--ro-bind /gnu /sbin")
1132 (("--ro-bind /lib /lib") "--ro-bind /gnu /lib")
1133 ((" */bin/bash") (which "bash"))
1134 (("/bin/sh") (which "sh"))
1135 (("findmnt") (which "findmnt"))))
1137 ;; Remove the directory we gave to tests to have a clean package.
1138 (add-after 'check 'remove-tmp-dir
1139 (lambda* (#:key outputs #:allow-other-keys)
1140 (delete-file-recursively (string-append (assoc-ref outputs "out") "/tmp"))
1143 `(("libcap" ,libcap)))
1145 `(("python-2" ,python-2)
1146 ("util-linux" ,util-linux)))
1147 (home-page "https://github.com/containers/bubblewrap")
1148 (synopsis "Unprivileged sandboxing tool")
1149 (description "Bubblewrap is aimed at running applications in a sandbox,
1150 restricting their access to parts of the operating system or user data such as
1151 the home directory. Bubblewrap always creates a new mount namespace, and the
1152 user can specify exactly what parts of the file system should be made visible
1153 in the sandbox. These directories are mounted with the @code{nodev} option
1154 by default and can be made read-only.")
1155 (license license:lgpl2.0+)))
1157 (define-public bochs
1164 (uri (string-append "https://sourceforge.net/projects/bochs/files/bochs/"
1165 version "/bochs-" version ".tar.gz"))
1167 (base32 "0ql8q6y1k356li1g9gbvl21448mlxphxxi6kjb2b3pxvzd0pp2b3"))))
1168 (build-system gnu-build-system)
1170 `(#:tests? #f)) ; no tests exist
1172 `(("libxrandr" ,libxrandr)))
1173 (home-page "http://bochs.sourceforge.net/")
1174 (synopsis "Emulator for x86 PC")
1176 "Bochs is an emulator which can emulate Intel x86 CPU, common I/O
1177 devices, and a custom BIOS. It can also be compiled to emulate many different
1178 x86 CPUs, from early 386 to the most recent x86-64 Intel and AMD processors.
1179 Bochs can run most Operating Systems inside the emulation including Linux,
1180 DOS or Microsoft Windows.")
1181 (license license:lgpl2.0+)))
1190 (url "git://xenbits.xenproject.org/xen.git")
1191 (commit (string-append "RELEASE-" version))))
1192 (file-name (git-file-name name version))
1195 "1wv1hyfii14vi9lfjmnv07h2gpm3b7kvh2p55f4yy2b40simksgk"))))
1196 (build-system gnu-build-system)
1199 (list "--enable-rpath"
1200 "--disable-qemu-traditional" ; It tries to do "git clone"
1201 "--disable-rombios" ; would try to "git clone" via etherboot.
1202 ;; TODO: Re-enable stubdom (it's "more secure" to use it).
1203 "--disable-stubdom" ; tries to "git clone" old patched newlib.
1204 (string-append "--with-initddir="
1205 (assoc-ref %outputs "out")
1207 (string-append "--with-system-qemu="
1208 (assoc-ref %build-inputs "qemu")
1209 "/bin/qemu-system-i386")
1210 (string-append "--with-system-seabios="
1211 (assoc-ref %build-inputs "seabios")
1212 "/share/firmware/bios.bin")
1213 (string-append "--with-system-ovmf="
1214 (assoc-ref %build-inputs "ovmf")
1215 "/share/firmware/ovmf_ia32.bin"))
1216 #:make-flags (list "-j" "1"
1217 "XEN_BUILD_DATE=Thu Jan 1 01:00:01 CET 1970"
1218 "XEN_BUILD_TIME=01:00:01"
1221 "SMBIOS_REL_DATE=01/01/1970"
1222 "VGABIOS_REL_DATE=01 Jan 1970"
1223 ; QEMU_TRADITIONAL_LOC
1225 "SYSCONFIG_DIR=/tmp/etc/default"
1226 (string-append "BASH_COMPLETION_DIR="
1227 (assoc-ref %outputs "out")
1228 "/etc/bash_completion.d")
1229 (string-append "BOOT_DIR="
1230 (assoc-ref %outputs "out")
1232 (string-append "DEBUG_DIR="
1233 (assoc-ref %outputs "out")
1235 (string-append "EFI_DIR="
1236 (assoc-ref %outputs "out")
1237 "/lib/efi") ; TODO lib64 ?
1238 "MINIOS_UPSTREAM_URL="
1239 ;(string-append "DISTDIR="
1240 ; (assoc-ref %outputs "out"))
1242 #:test-target "test"
1244 (modify-phases %standard-phases
1245 (add-after 'unpack 'unpack-mini-os
1246 (lambda* (#:key inputs #:allow-other-keys)
1247 (copy-recursively (assoc-ref inputs "mini-os") "extras/mini-os")
1249 (add-after 'unpack-mini-os 'patch
1250 (lambda* (#:key inputs outputs #:allow-other-keys)
1251 (substitute* "tools/firmware/Rules.mk"
1252 (("override XEN_TARGET_ARCH = x86_32")
1253 (string-append "override XEN_TARGET_ARCH = x86_32
1254 override CC = " (assoc-ref inputs "cross-gcc") "/bin/i686-linux-gnu-gcc"))
1256 (string-append "CFLAGS=-I" (assoc-ref inputs "cross-libc")
1258 (substitute* "config/x86_32.mk"
1259 (("CFLAGS += -m32 -march=i686")
1260 (string-append "CFLAGS += -march=i686 -I"
1261 (assoc-ref inputs "cross-libc")
1263 ;; /var is not in /gnu/store , so don't try to create it.
1264 (substitute* '("tools/Makefile"
1265 "tools/xenstore/Makefile"
1266 "tools/xenpaging/Makefile")
1267 (("\\$\\(INSTALL_DIR\\) .*XEN_(DUMP|LOG|RUN|LIB|PAGING)_DIR.*")
1269 (("\\$\\(INSTALL_DIR\\) .*XEN_(RUN|LIB)_STORED.*")
1271 ;; Prevent xen from creating /etc .
1272 (substitute* "tools/examples/Makefile"
1273 ((" install-readmes") "")
1274 ((" install-configs") ""))
1276 (substitute* "tools/pygrub/setup.py"
1278 ; TODO: extra_link_args = ['-Wl,-rpath=/opt/foo'],
1279 (string-append "runtime_library_dirs = ['"
1280 (assoc-ref outputs "out")
1281 "/lib'],\nlibrary_dirs =")))
1283 (add-before 'configure 'patch-xen-script-directory
1284 (lambda* (#:key outputs #:allow-other-keys)
1285 (substitute* '("configure"
1288 (("XEN_SCRIPT_DIR=.*")
1289 (string-append "XEN_SCRIPT_DIR="
1290 (assoc-ref outputs "out")
1291 "/etc/xen/scripts")))
1293 (add-before 'configure 'set-environment-up
1294 (lambda* (#:key make-flags #:allow-other-keys)
1296 (string-contains x "cross-i686-linux"))
1297 (define (filter-environment! filter-predicate
1298 environment-variable-names)
1301 (let* ((env-value (getenv env-name))
1302 (search-path (search-path-as-string->list env-value))
1303 (new-search-path (filter filter-predicate
1305 (new-env-value (list->search-path-as-string
1306 new-search-path ":")))
1307 (setenv env-name new-env-value)))
1308 environment-variable-names))
1309 (setenv "CROSS_C_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
1310 (setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
1311 (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
1312 (filter-environment! cross?
1313 '("CROSS_C_INCLUDE_PATH" "CROSS_CPLUS_INCLUDE_PATH"
1314 "CROSS_LIBRARY_PATH"))
1315 (filter-environment! (lambda (e) (not (cross? e)))
1316 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
1318 ;; Guix tries to be helpful and automatically adds
1319 ;; mini-os-git-checkout/include to the include path,
1320 ;; but actually we don't want it to be there (yet).
1321 (filter-environment! (lambda (e)
1324 "mini-os-git-checkout")))
1325 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
1327 (setenv "EFI_VENDOR" "guix")
1330 (lambda* (#:key make-flags #:allow-other-keys)
1331 (apply invoke "make" "world" make-flags))))))
1333 `(("acpica" ,acpica) ; TODO: patch iasl invocation.
1334 ("bridge-utils" ,bridge-utils) ; TODO: patch invocations.
1336 ("iproute" ,iproute) ; TODO: patch invocations.
1339 ("libyajl" ,libyajl)
1340 ("ncurses" ,ncurses)
1341 ("openssl" ,openssl)
1344 ("qemu" ,qemu-minimal)
1345 ("seabios" ,seabios)
1346 ("util-linux" ,util-linux) ; uuid
1347 ; TODO: ocaml-findlib, ocaml-nox.
1348 ("xz" ,xz) ; for liblzma
1353 ("cmake" ,cmake-minimal)
1356 ("gettext" ,gettext-minimal)
1362 (url "http://xenbits.xen.org/git-http/mini-os.git")
1363 (commit (string-append "xen-RELEASE-" version))))
1366 "1i8pcl19n60i2m9vlg79q3nknpj209c9ic5x10wxaicx45kc107f"))
1367 (file-name "mini-os-git-checkout")))
1370 ("pkg-config" ,pkg-config)
1371 ("python" ,python-2)
1373 ("cross-gcc" ,(cross-gcc "i686-linux-gnu"
1374 #:xbinutils (cross-binutils "i686-linux-gnu")
1375 #:libc (cross-libc "i686-linux-gnu")))
1376 ("cross-libc" ,(cross-libc "i686-linux-gnu")) ; header files
1377 ("cross-libc-static" ,(cross-libc "i686-linux-gnu") "static")))
1378 (home-page "https://xenproject.org/")
1379 (synopsis "Xen Virtual Machine Monitor")
1380 (description "This package provides the Xen Virtual Machine Monitor
1381 which is a hypervisor.")
1382 ;; TODO: Some files are licensed differently. List those.
1383 (license license:gpl2)
1384 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))))