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 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 spice)
79 #:use-module (gnu packages texinfo)
80 #:use-module (gnu packages textutils)
81 #:use-module (gnu packages tls)
82 #:use-module (gnu packages web)
83 #:use-module (gnu packages wget)
84 #:use-module (gnu packages xdisorg)
85 #:use-module (gnu packages xml)
86 #:use-module (gnu packages xorg)
87 #:use-module (guix build-system cmake)
88 #:use-module (guix build-system gnu)
89 #:use-module (guix build-system go)
90 #:use-module (guix build-system meson)
91 #:use-module (guix build-system python)
92 #:use-module (guix download)
93 #:use-module (guix git-download)
94 #:use-module ((guix licenses) #:prefix license:)
95 #:use-module (guix packages)
96 #:use-module (guix utils)
97 #:use-module (srfi srfi-1))
99 (define (qemu-patch commit file-name sha256)
100 "Return an origin for COMMIT."
104 "http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h="
107 (file-name file-name)))
115 (uri (string-append "https://download.qemu.org/qemu-"
119 "1lm1jndfpc5sydwrxyiz5sms414zkcg9jdl0zx318qbjsayxnvzd"))))
120 (build-system gnu-build-system)
122 '(;; Running tests in parallel can occasionally lead to failures, like:
123 ;; boot_sector_test: assertion failed (signature == SIGNATURE): (0x00000000 == 0x0000dead)
125 #:configure-flags (list "--enable-usb-redir" "--enable-opengl"
126 (string-append "--smbd="
127 (assoc-ref %outputs "out")
128 "/libexec/samba-wrapper")
129 "--audio-drv-list=alsa,pa,sdl")
130 ;; Make build and test output verbose to facilitate investigation upon failure.
131 #:make-flags '("V=1")
133 (modify-phases %standard-phases
135 (lambda* (#:key inputs outputs (configure-flags '())
137 ;; The `configure' script doesn't understand some of the
138 ;; GNU options. Thus, add a new phase that's compatible.
139 (let ((out (assoc-ref outputs "out")))
140 (setenv "SHELL" (which "bash"))
142 ;; While we're at it, patch for tests.
143 (substitute* "tests/libqtest.c"
144 (("/bin/sh") (which "sh")))
146 ;; The binaries need to be linked against -lrt.
147 (setenv "LDFLAGS" "-lrt")
150 ,(string-append "--cc=" (which "gcc"))
151 ;; Some architectures insist on using HOST_CC
152 ,(string-append "--host-cc=" (which "gcc"))
153 "--disable-debug-info" ; save build space
154 "--enable-virtfs" ; just to be sure
155 ,(string-append "--prefix=" out)
156 ,(string-append "--sysconfdir=/etc")
157 ,@configure-flags)))))
158 (add-after 'install 'install-info
159 (lambda* (#:key inputs outputs #:allow-other-keys)
160 ;; Install the Info manual, unless Texinfo is missing.
161 (when (assoc-ref inputs "texinfo")
162 (let* ((out (assoc-ref outputs "out"))
163 (dir (string-append out "/share/info")))
164 (invoke "make" "info")
165 (for-each (lambda (info)
166 (install-file info dir))
167 (find-files "." "\\.info"))))
169 ;; Create a wrapper for Samba. This allows QEMU to use Samba without
170 ;; pulling it in as an input. Note that you need to explicitly install
171 ;; Samba in your Guix profile for Samba support.
172 (add-after 'install-info 'create-samba-wrapper
173 (lambda* (#:key inputs outputs #:allow-other-keys)
174 (let* ((out (assoc-ref %outputs "out"))
175 (libexec (string-append out "/libexec")))
176 (call-with-output-file "samba-wrapper"
178 (format port "#!/bin/sh
180 (chmod "samba-wrapper" #o755)
181 (install-file "samba-wrapper" libexec))
183 (add-before 'configure 'prevent-network-configuration
185 ;; Prevent the build from trying to use git to fetch from the net.
186 (substitute* "Makefile"
187 (("@./config.status")
189 (add-before 'check 'disable-unusable-tests
190 (lambda* (#:key inputs outputs #:allow-other-keys)
191 (substitute* "tests/Makefile.include"
192 ;; Comment out the test-qga test, which needs /sys and
193 ;; fails within the build environment.
194 (("check-unit-.* tests/test-qga" all)
195 (string-append "# " all)))
196 (substitute* "tests/Makefile.include"
197 ;; Comment out the test-char test, which needs networking and
198 ;; fails within the build environment.
199 (("check-unit-.* tests/test-char" all)
200 (string-append "# " all)))
202 (inputs ; TODO: Add optional inputs.
203 `(("alsa-lib" ,alsa-lib)
209 ("libcap" ,libcap) ; virtfs support requires libcap & libattr
211 ("libepoxy" ,libepoxy)
212 ("libjpeg" ,libjpeg-turbo)
214 ("libseccomp" ,libseccomp)
215 ("libusb" ,libusb) ;USB pass-through support
218 ;; ("pciutils" ,pciutils)
220 ("pulseaudio" ,pulseaudio)
223 ("usbredir" ,usbredir)
224 ("util-linux" ,util-linux)
226 ("virglrenderer" ,virglrenderer)
228 (native-inputs `(("gettext" ,gettext-minimal)
229 ("glib:bin" ,glib "bin") ; gtester, etc.
233 ("pkg-config" ,pkg-config)
234 ("python-wrapper" ,python-wrapper)
235 ("texinfo" ,texinfo)))
236 (home-page "https://www.qemu.org")
237 (synopsis "Machine emulator and virtualizer")
239 "QEMU is a generic machine emulator and virtualizer.
241 When used as a machine emulator, QEMU can run OSes and programs made for one
242 machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
243 using dynamic translation, it achieves very good performance.
245 When used as a virtualizer, QEMU achieves near native performances by
246 executing the guest code directly on the host CPU. QEMU supports
247 virtualization when executing under the Xen hypervisor or using
248 the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
249 server and embedded PowerPC, and S390 guests.")
251 ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
252 (license license:gpl2)
254 ;; Several tests fail on MIPS; see <http://hydra.gnu.org/build/117914>.
255 (supported-systems (delete "mips64el-linux" %supported-systems))))
257 (define-public qemu-minimal
258 ;; QEMU without GUI support.
259 (package (inherit qemu)
260 (name "qemu-minimal")
261 (synopsis "Machine emulator and virtualizer (without GUI)")
263 (substitute-keyword-arguments (package-arguments qemu)
264 ((#:configure-flags _ '(list))
265 ;; Restrict to the targets supported by Guix.
266 ''("--target-list=i386-softmmu,x86_64-softmmu,mips64el-softmmu,arm-softmmu,aarch64-softmmu"))))
268 ;; Remove dependencies on optional libraries, notably GUI libraries.
269 (native-inputs (fold alist-delete (package-native-inputs qemu)
271 (inputs (fold alist-delete (package-inputs qemu)
272 '("libusb" "mesa" "sdl2" "spice" "virglrenderer" "gtk+"
273 "usbredir" "libdrm" "libepoxy" "pulseaudio" "vde2")))))
275 ;; The GRUB test suite fails with later versions of Qemu, so we
276 ;; keep it at 2.10 for now. See
277 ;; <https://lists.gnu.org/archive/html/bug-grub/2018-02/msg00004.html>.
278 ;; This package is hidden since we do not backport updates to it.
279 (define-public qemu-minimal-2.10
282 (inherit qemu-minimal)
286 (uri (string-append "https://download.qemu.org/qemu-"
290 "17w21spvaxaidi2am5lpsln8yjpyp2zi3s3gc6nsxj5arlgamzgw"))
292 (search-patches "qemu-glibc-2.27.patch"))))
293 ;; qemu-minimal-2.10 needs Python 2. Remove below once no longer necessary.
294 (native-inputs `(("python-2" ,python-2)
295 ,@(fold alist-delete (package-native-inputs qemu)
296 '("python-wrapper"))))
298 (fold alist-delete (package-inputs qemu)
299 ;; Disable seccomp support, because it's not required for the GRUB
300 ;; test suite, and because it fails with libseccomp 2.4.2 and later.
303 (define-public libosinfo
310 (uri (string-append "https://releases.pagure.org/libosinfo/libosinfo-"
314 "1s97sv24bybggjx6hgqba2qdqz3ivfpd4cmkh4zm5y59sim109mv"))))
315 (build-system meson-build-system)
318 (list (string-append "-Dwith-usb-ids-path="
319 (assoc-ref %build-inputs "usb.ids"))
320 (string-append "-Dwith-pci-ids-path="
321 (assoc-ref %build-inputs "pci.ids")))))
323 `(("libsoup" ,libsoup)
326 ("gobject-introspection" ,gobject-introspection)))
328 `(("glib" ,glib "bin") ; glib-mkenums, etc.
331 ("intltool" ,intltool)
332 ("pkg-config" ,pkg-config)
336 (uri "https://github.com/pciutils/pciids/raw/ad02084f0bc143e3c15e31a6152a3dfb1d7a3156/pci.ids")
339 "0kfhpj5rnh24hz2714qhfmxk281vwc2w50sm73ggw5d15af7zfsw"))))
343 (uri "https://svn.code.sf.net/p/linux-usb/repo/trunk/htdocs/usb.ids?r=2681")
344 (file-name "usb.ids")
347 "1m6yhvz5k8aqzxgk7xj3jkk8frl1hbv0h3vgj4wbnvnx79qnvz3r"))))))
348 (home-page "https://libosinfo.org/")
349 (synopsis "Operating system information database")
350 (description "libosinfo is a GObject based library API for managing
351 information about operating systems, hypervisors and the (virtual) hardware
352 devices they can support. It includes a database containing device metadata
353 and provides APIs to match/identify optimal devices for deploying an operating
354 system on a hypervisor. Via GObject Introspection, the API is available in
355 all common programming languages. Vala bindings are also provided.")
356 ;; The library files are released under LGPLv2.1 or later; the source
357 ;; files in the "tools" directory are released under GPLv2+.
358 (license (list license:lgpl2.1+ license:gpl2+))))
367 "https://linuxcontainers.org/downloads/lxc/lxc-"
371 "1igxqgx8q9cp15mcp1y8j564bl85ijw04jcmgb1s5bmfbg1751sd"))))
372 (build-system gnu-build-system)
374 `(("pkg-config" ,pkg-config)))
378 ("libseccomp" ,libseccomp)
379 ("libselinux" ,libselinux)))
382 (list (string-append "--docdir=" (assoc-ref %outputs "out")
383 "/share/doc/" ,name "-" ,version)
385 "--localstatedir=/var")
387 ;; Treat the kernel headers as system headers to silence
388 ;; compiler warnings from those.
389 (list (string-append "C_INCLUDE_PATH="
390 (assoc-ref %build-inputs "kernel-headers")
393 (modify-phases %standard-phases
395 (lambda* (#:key outputs #:allow-other-keys)
396 (let* ((out (assoc-ref outputs "out"))
397 (bashcompdir (string-append out "/etc/bash_completion.d")))
398 (invoke "make" "install"
399 (string-append "bashcompdir=" bashcompdir)
400 ;; Don't install files into /var and /etc.
401 "LXCPATH=/tmp/var/lib/lxc"
402 "localstatedir=/tmp/var"
403 "sysconfdir=/tmp/etc"
404 "sysconfigdir=/tmp/etc/default")))))))
405 (synopsis "Linux container tools")
406 (home-page "https://linuxcontainers.org/")
408 "LXC is a userspace interface for the Linux kernel containment features.
409 Through a powerful API and simple tools, it lets Linux users easily create and
410 manage system or application containers.")
411 (license license:lgpl2.1+)))
413 (define-public libvirt
420 (uri (string-append "https://libvirt.org/sources/libvirt-"
423 (base32 "0m8cqaqflvys5kaqpvb0qr4k365j09jc5xk6x70yvg8qkcl2hcz2"))
425 (search-patches "libvirt-create-machine-cgroup.patch"))))
426 (build-system gnu-build-system)
430 "--with-qemu-user=nobody"
431 "--with-qemu-group=kvm"
433 (string-append "--docdir=" (assoc-ref %outputs "out") "/share/doc/"
436 "--localstatedir=/var")
438 (modify-phases %standard-phases
439 (add-before 'configure 'fix-BOURNE_SHELL-definition
440 ;; BOURNE_SHELL is hard-#defined to ‘/bin/sh’, causing test failures.
442 (substitute* "config.h.in"
443 (("/bin/sh") (which "sh")))
445 (add-before 'configure 'patch-libtirpc-file-names
446 (lambda* (#:key inputs #:allow-other-keys)
447 ;; libvirt uses an m4 macro instead of pkg-config to determine where
448 ;; the RPC headers are located. Tell it to look in the right place.
449 (substitute* "configure"
450 (("/usr/include/tirpc") ;defined in m4/virt-xdr.m4
451 (string-append (assoc-ref inputs "libtirpc")
454 (add-before 'configure 'disable-broken-tests
456 (let ((tests (list "commandtest" ; hangs idly
457 "qemuxml2argvtest" ; fails
458 "qemuhotplugtest" ; fails
459 "virnetsockettest" ; tries to network
460 "virshtest"))) ; fails
461 (substitute* "tests/Makefile.in"
462 (((format #f "(~a)\\$\\(EXEEXT\\)" (string-join tests "|")))
466 ;; Since the sysconfdir and localstatedir should be /etc and /var
467 ;; at runtime, we must prevent writing to them at installation
469 (lambda* (#:key make-flags #:allow-other-keys)
470 (apply invoke "make" "install"
471 "sysconfdir=/tmp/etc"
472 "localstatedir=/tmp/var"
475 `(("libxml2" ,libxml2)
477 ("libpciaccess" ,libpciaccess)
482 ("libtirpc" ,libtirpc) ;for <rpc/rpc.h>
483 ("libuuid" ,util-linux)
484 ("lvm2" ,lvm2) ;for libdevmapper
487 ("cyrus-sasl" ,cyrus-sasl)
490 ("dmidecode" ,dmidecode)
492 ("ebtables" ,ebtables)
494 ("iptables" ,iptables)))
496 `(("xsltproc" ,libxslt)
498 ("pkg-config" ,pkg-config)
500 ("python" ,python-wrapper)))
501 (home-page "https://libvirt.org")
502 (synopsis "Simple API for virtualization")
503 (description "Libvirt is a C toolkit to interact with the virtualization
504 capabilities of recent versions of Linux. The library aims at providing long
505 term stable C API initially for the Xen paravirtualization but should be able
506 to integrate other virtualization mechanisms if needed.")
507 (license license:lgpl2.1+)))
509 (define-public libvirt-glib
511 (name "libvirt-glib")
515 (uri (string-append "ftp://libvirt.org/libvirt/glib/"
516 "libvirt-glib-" version ".tar.gz"))
519 "0six9ckmvlwwyavyjkgc262qkpvfqgi8rjij7cyk00bmqq8c9s4l"))))
520 (build-system gnu-build-system)
522 `(("openssl" ,openssl)
523 ("cyrus-sasl" ,cyrus-sasl)
524 ("lvm2" ,lvm2) ; for libdevmapper
525 ("libyajl" ,libyajl)))
527 `(("pkg-config" ,pkg-config)
528 ("intltool" ,intltool)
532 ;; ‘Required:’ by the installed .pc files.
536 ("gobject-introspection" ,gobject-introspection)))
537 (home-page "https://libvirt.org")
538 (synopsis "GLib wrapper around libvirt")
539 (description "libvirt-glib wraps the libvirt library to provide a
540 high-level object-oriented API better suited for glib-based applications, via
544 @item libvirt-glib - GLib main loop integration & misc helper APIs
545 @item libvirt-gconfig - GObjects for manipulating libvirt XML documents
546 @item libvirt-gobject - GObjects for managing libvirt objects
549 (license license:lgpl2.1+)))
551 (define-public python-libvirt
553 (name "python-libvirt")
558 (uri (string-append "https://libvirt.org/sources/python/libvirt-python-"
561 (base32 "0kyz3lx49d8p75mvbzinxc1zgs8g7adn77y9bm15b8b4ad9zl5s6"))))
562 (build-system python-build-system)
565 (modify-phases %standard-phases
566 (add-after 'unpack 'patch-nosetests-path
567 (lambda* (#:key inputs #:allow-other-keys)
568 (substitute* "setup.py"
569 (("\"/usr/bin/nosetests\"")
570 (string-append "\"" (which "nosetests") "\""))
571 (("self\\.spawn\\(\\[sys\\.executable, nose\\]\\)")
572 (format #f "self.spawn([\"~a\", nose])" (which "bash"))))
575 `(("libvirt" ,libvirt)))
577 `(("python-lxml" ,python-lxml)))
579 `(("pkg-config" ,pkg-config)
580 ("python-nose" ,python-nose)))
581 (home-page "https://libvirt.org")
582 (synopsis "Python bindings to libvirt")
583 (description "This package provides Python bindings to the libvirt
584 virtualization library.")
585 (license license:lgpl2.1+)))
587 (define-public python2-libvirt
588 (package-with-python2 python-libvirt))
590 (define-public virt-manager
592 (name "virt-manager")
596 (uri (string-append "https://virt-manager.org/download/sources"
597 "/virt-manager/virt-manager-"
601 "06ws0agxlip6p6n3n43knsnjyd91gqhh2dadgc33wl9lx1k8vn6g"))))
602 (build-system python-build-system)
604 `(#:use-setuptools? #f ; uses custom distutils 'install' command
605 ;; Some of the tests seem to require network access to install virtual
608 #:imported-modules ((guix build glib-or-gtk-build-system)
609 ,@%python-build-system-modules)
610 #:modules ((ice-9 match)
612 (guix build python-build-system)
613 ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
616 (modify-phases %standard-phases
617 (add-after 'unpack 'fix-setup
618 (lambda* (#:key outputs #:allow-other-keys)
619 (substitute* "virtinst/buildconfig.py"
620 (("/usr") (assoc-ref outputs "out")))
622 (add-after 'unpack 'fix-qemu-img-reference
623 (lambda* (#:key inputs #:allow-other-keys)
624 (substitute* "virtconv/formats.py"
625 (("/usr(/bin/qemu-img)" _ suffix)
626 (string-append (assoc-ref inputs "qemu") suffix)))
628 (add-after 'unpack 'fix-default-uri
629 (lambda* (#:key inputs #:allow-other-keys)
630 ;; Xen is not available for now - so only patch qemu.
631 (substitute* "virtManager/createconn.py"
632 (("/usr(/bin/qemu-system)" _ suffix)
633 (string-append (assoc-ref inputs "qemu") suffix)))
635 (add-before 'wrap 'wrap-with-GI_TYPELIB_PATH
636 (lambda* (#:key inputs outputs #:allow-other-keys)
637 (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
638 (bin-files (find-files bin ".*"))
639 (paths (map (match-lambda
640 ((output . directory)
641 (let* ((girepodir (string-append
643 "/lib/girepository-1.0")))
644 (if (file-exists? girepodir)
647 (for-each (lambda (file)
648 (format #t "wrapping ~a\n" file)
650 `("GI_TYPELIB_PATH" ":" prefix
651 ,(filter identity paths))))
654 (add-after 'install 'glib-or-gtk-compile-schemas
655 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
656 (add-after 'install 'glib-or-gtk-wrap
657 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
662 ("gtksourceview" ,gtksourceview)
664 ("libvirt-glib" ,libvirt-glib)
665 ("libosinfo" ,libosinfo)
667 ("gobject-introspection" ,gobject-introspection)
668 ("python-libvirt" ,python-libvirt)
669 ("python-requests" ,python-requests)
670 ("python-ipaddress" ,python-ipaddress)
671 ("python-pycairo" ,python-pycairo)
672 ("python-pygobject" ,python-pygobject)
673 ("python-libxml2" ,python-libxml2)
674 ("spice-gtk" ,spice-gtk)))
675 ;; virt-manager searches for qemu-img or kvm-img in the PATH.
679 `(("glib" ,glib "bin") ; glib-compile-schemas
680 ("gtk+" ,gtk+ "bin") ; gtk-update-icon-cache
681 ("perl" ,perl) ; pod2man
682 ("intltool" ,intltool)))
683 (home-page "https://virt-manager.org/")
684 (synopsis "Manage virtual machines")
686 "The virt-manager application is a desktop user interface for managing
687 virtual machines through libvirt. It primarily targets KVM VMs, but also
688 manages Xen and LXC (Linux containers). It presents a summary view of running
689 domains, their live performance and resource utilization statistics.")
690 (license license:gpl2+)))
698 (uri (string-append "http://download.openvz.org/criu/criu-"
702 "1yn9ix9lqvqvjrs3a3g6g1wqfniyf9n7giy0mr3jvijmrcm7y0pa"))))
703 (build-system gnu-build-system)
705 `(#:test-target "test"
706 #:tests? #f ; tests require mounting as root
708 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
709 (string-append "LIBDIR=" (assoc-ref %outputs "out")
711 (string-append "ASCIIDOC=" (assoc-ref %build-inputs "asciidoc")
713 (string-append "XMLTO=" (assoc-ref %build-inputs "xmlto")
716 (modify-phases %standard-phases
718 (lambda* (#:key inputs #:allow-other-keys)
719 ;; The includes for libnl are located in a sub-directory.
720 (setenv "C_INCLUDE_PATH"
721 (string-append (assoc-ref inputs "libnl")
723 ;; Also add the kernel headers here so that GCC
724 ;; treats them as "system headers". Otherwise
725 ;; the build fails with -Werror because parasite.c
726 ;; includes both <linux/fs.h> and <sys/mount.h>,
727 ;; which define some of the same constants.
728 (assoc-ref inputs "kernel-headers")
731 (add-after 'configure 'fix-documentation
732 (lambda* (#:key inputs outputs #:allow-other-keys)
733 (substitute* "Documentation/Makefile"
736 "-m custom.xsl --skip-validation -x "
737 (assoc-ref inputs "docbook-xsl") "/xml/xsl/"
738 ,(package-name docbook-xsl) "-"
739 ,(package-version docbook-xsl)
740 "/manpages/docbook.xsl")))
742 (add-after 'unpack 'hardcode-variables
743 (lambda* (#:key inputs #:allow-other-keys)
744 ;; Hardcode arm version detection
745 (substitute* "Makefile"
746 (("ARMV.*:=.*") "ARMV := 7\n"))
747 ;; We are currently using python-2
748 (substitute* "crit/Makefile"
749 (("\\$\\(PYTHON\\)") "python2"))
750 (substitute* "lib/Makefile"
752 (string-append (assoc-ref inputs "python")
755 (add-before 'build 'fix-symlink
756 (lambda* (#:key inputs #:allow-other-keys)
757 ;; The file 'images/google/protobuf/descriptor.proto' points to
758 ;; /usr/include/..., which obviously does not exist.
759 (let* ((file "google/protobuf/descriptor.proto")
760 (target (string-append "images/" file))
761 (source (string-append (assoc-ref inputs "protobuf")
764 (symlink source target)
766 (add-after 'install 'wrap
767 (lambda* (#:key inputs outputs #:allow-other-keys)
768 ;; Make sure 'crit' runs with the correct PYTHONPATH.
769 (let* ((out (assoc-ref outputs "out"))
770 (path (string-append out
772 (string-take (string-take-right
773 (assoc-ref inputs "python") 5) 3)
775 (getenv "PYTHONPATH"))))
776 (wrap-program (string-append out "/bin/crit")
777 `("PYTHONPATH" ":" prefix (,path))))
780 `(("protobuf" ,protobuf)
782 ("python2-protobuf" ,python2-protobuf)
783 ("python2-ipaddr" ,python2-ipaddr)
791 `(("pkg-config" ,pkg-config)
793 ("protobuf-c" ,protobuf-c)
794 ("asciidoc" ,asciidoc)
796 ("docbook-xml" ,docbook-xml)
797 ("docbook-xsl" ,docbook-xsl)))
798 (home-page "https://criu.org")
799 (synopsis "Checkpoint and restore in user space")
800 (description "Using this tool, you can freeze a running application (or
801 part of it) and checkpoint it to a hard drive as a collection of files. You
802 can then use the files to restore and run the application from the point it
803 was frozen at. The distinctive feature of the CRIU project is that it is
804 mainly implemented in user space.")
805 ;; The project is licensed under GPLv2; files in the lib/ directory are
807 (license (list license:gpl2 license:lgpl2.1))))
809 (define-public qmpbackup
816 (url "https://github.com/abbbi/qmpbackup.git")
818 (file-name (git-file-name name version))
821 "0swhp5byz44brhyis1a39p11fyn9q84xz5q6v2fah29r7d71kmmx"))))
822 (build-system python-build-system)
824 `(#:python ,python-2))
825 (home-page "https://github.com/abbbi/qmpbackup")
826 (synopsis "Backup and restore QEMU machines")
827 (description "qmpbackup is designed to create and restore full and
828 incremental backups of running QEMU virtual machines via QMP, the QEMU
830 (license license:gpl3+)))
832 (define-public looking-glass-client
833 (let ((commit "182c4752d57690da7f99d5e788de9b8baea33895"))
835 (name "looking-glass-client")
836 (version (string-append "a12-" (string-take commit 7)))
840 (uri (git-reference (url "https://github.com/gnif/LookingGlass")
842 (file-name (git-file-name name version))
845 "02bq46ndmzq9cihazzn7xq1x7q5nzm7iw4l9lqzihxcxp9famkhw"))
846 (modules '((guix build utils)))
849 ;; Do not create binaries optimized for the CPU of the build machine,
850 ;; for reproducibility and compatibility. TODO: in the next version
851 ;; of looking glass, this is exposed as a CMake configure option.
852 (substitute* "client/CMakeLists.txt"
856 (build-system cmake-build-system)
857 (inputs `(("fontconfig" ,fontconfig)
862 ("sdl2-ttf" ,sdl2-ttf)
863 ("spice-protocol" ,spice-protocol)
864 ("wayland" ,wayland)))
865 (native-inputs `(("libconfig" ,libconfig)
867 ("pkg-config" ,pkg-config)))
869 `(#:tests? #f ;; No tests are available.
870 #:make-flags '("CC=gcc")
871 #:phases (modify-phases %standard-phases
872 (add-before 'configure 'chdir-to-client
873 (lambda* (#:key outputs #:allow-other-keys)
876 (add-after 'chdir-to-client 'add-missing-include
878 ;; Mimic upstream commit b9797529893, required since the
879 ;; update to Mesa 19.2.
880 (substitute* "renderers/egl/shader.h"
881 (("#include <stdbool\\.h>")
882 "#include <stdbool.h>\n#include <stddef.h>"))
885 (lambda* (#:key outputs #:allow-other-keys)
886 (install-file "looking-glass-client"
887 (string-append (assoc-ref outputs "out")
890 (home-page "https://looking-glass.hostfission.com")
891 (synopsis "KVM Frame Relay (KVMFR) implementation")
892 (description "Looking Glass allows the use of a KVM (Kernel-based Virtual
893 Machine) configured for VGA PCI Pass-through without an attached physical
894 monitor, keyboard or mouse. It displays the VM's rendered contents on your main
896 ;; This package requires SSE instructions.
897 (supported-systems '("i686-linux" "x86_64-linux"))
898 (license license:gpl2+))))
900 (define-public lookingglass
901 (deprecated-package "lookingglass" looking-glass-client))
906 (version "1.0.0-rc6")
910 "https://github.com/opencontainers/runc/releases/"
911 "download/v" version "/runc.tar.xz"))
912 (file-name (string-append name "-" version ".tar.xz"))
913 (patches (search-patches "runc-CVE-2019-5736.patch"))
916 "1c7832dq70slkjh8qp2civ1wxhhdd2hrx84pq7db1mmqc9fdr3cc"))))
917 (build-system go-build-system)
919 '(#:import-path "github.com/opencontainers/runc"
921 ;; XXX: 20/139 tests fail due to missing /var, cgroups and apparmor in
922 ;; the build environment.
925 (modify-phases %standard-phases
927 (lambda* (#:key source import-path #:allow-other-keys)
928 ;; Unpack the tarball into 'runc' instead of 'runc-1.0.0-rc5'.
929 (let ((dest (string-append "src/" import-path)))
931 (invoke "tar" "-C" (string-append "src/" import-path)
932 "--strip-components=1"
935 (lambda* (#:key import-path #:allow-other-keys)
936 (chdir (string-append "src/" import-path))
937 ;; XXX: requires 'go-md2man'.
938 ;; (invoke "make" "man")
942 ;; (invoke "make" "localunittest")))
944 (lambda* (#:key outputs #:allow-other-keys)
945 (let ((out (assoc-ref outputs "out")))
946 (invoke "make" "install" "install-bash"
947 (string-append "PREFIX=" out))))))))
949 `(("pkg-config" ,pkg-config)))
951 `(("libseccomp" ,libseccomp)))
952 (synopsis "Open container initiative runtime")
953 (home-page "https://www.opencontainers.org/")
955 "@command{runc} is a command line client for running applications
956 packaged according to the
957 @uref{https://github.com/opencontainers/runtime-spec/blob/master/spec.md, Open
958 Container Initiative (OCI) format} and is a compliant implementation of the
959 Open Container Initiative specification.")
960 (license license:asl2.0)))
969 "https://github.com/openSUSE/umoci/releases/download/v"
970 version "/umoci.tar.xz"))
971 (file-name (string-append "umoci-" version ".tar.xz"))
974 "0x1yyvpllz6fyy9xip6f7b6c94v984n3faf8p50fr9y4ygkgi15a"))))
975 (build-system go-build-system)
977 '(#:import-path "github.com/openSUSE/umoci"
980 (modify-phases %standard-phases
982 (lambda* (#:key source import-path #:allow-other-keys)
983 ;; Unpack the tarball into 'umoci' instead of "runc-${version}".
984 (let ((dest (string-append "src/" import-path)))
986 (invoke "tar" "-C" (string-append "src/" import-path)
987 "--strip-components=1"
990 (lambda* (#:key import-path #:allow-other-keys)
991 (chdir (string-append "src/" import-path))
992 ;; TODO: build manpages with 'go-md2man'.
993 (invoke "make" "SHELL=bash")))
995 (lambda* (#:key outputs #:allow-other-keys)
996 (let* ((out (assoc-ref outputs "out"))
997 (bindir (string-append out "/bin")))
998 (install-file "umoci" bindir)
1000 (home-page "https://umo.ci/")
1001 (synopsis "Tool for modifying Open Container images")
1003 "@command{umoci} is a tool that allows for high-level modification of an
1004 Open Container Initiative (OCI) image layout and its tagged images.")
1005 (license license:asl2.0)))
1007 (define-public skopeo
1014 (url "https://github.com/projectatomic/skopeo")
1015 (commit (string-append "v" version))))
1016 (file-name (git-file-name name version))
1019 "1bagirzdzjhicn5dr691092ac3q6lhz3xngjzgqiqkxnvpz7p6cn"))))
1020 (build-system go-build-system)
1022 `(("pkg-config" ,pkg-config)))
1024 `(("btrfs-progs" ,btrfs-progs)
1026 ("libassuan" ,libassuan)
1027 ("libselinux" ,libselinux)
1028 ("libostree" ,libostree)
1033 '(#:import-path "github.com/projectatomic/skopeo"
1034 #:install-source? #f
1035 #:tests? #f ; The tests require Docker
1037 (modify-phases %standard-phases
1039 (lambda* (#:key import-path #:allow-other-keys)
1040 (chdir (string-append "src/" import-path))
1041 ;; TODO: build manpages with 'go-md2man'.
1042 (invoke "make" "binary-local")))
1044 (lambda* (#:key outputs #:allow-other-keys)
1045 (let ((out (assoc-ref outputs "out")))
1046 (invoke "make" "install-binary" "install-completions"
1047 (string-append "PREFIX=" out))))))))
1048 (home-page "https://github.com/projectatomic/skopeo")
1049 (synopsis "Interact with container images and container image registries")
1051 "@command{skopeo} is a command line utility providing various operations
1052 with container images and container image registries. It can:
1055 @item Copy container images between various containers image stores,
1056 converting them as necessary.
1058 @item Convert a Docker schema 2 or schema 1 container image to an OCI image.
1060 @item Inspect a repository on a container registry without needlessly pulling
1063 @item Sign and verify container images.
1065 @item Delete container images from a remote container registry.
1068 (license license:asl2.0)))
1070 (define-public python-vagrant
1072 (name "python-vagrant")
1077 (uri (pypi-uri "python-vagrant" version))
1080 "1ikrh6canhcxg5y7pzmkcnnydikppv7s6sm9prfx90nk0ac8m6mg"))))
1081 (build-system python-build-system)
1083 '(#:tests? #f)) ; tests involve running vagrant.
1084 (home-page "https://github.com/todddeluca/python-vagrant")
1085 (synopsis "Python bindings for Vagrant")
1087 "Python-vagrant is a Python module that provides a thin wrapper around the
1088 @code{vagrant} command line executable, allowing programmatic control of Vagrant
1090 (license license:expat)))
1092 (define-public bubblewrap
1098 (uri (string-append "https://github.com/containers/bubblewrap/"
1099 "releases/download/v" version "/bubblewrap-"
1103 "08r0f4c3fjkb4zjrb4kkax1zfcgcgic702vb62sjjw5xfhppvzp5"))))
1104 (build-system gnu-build-system)
1107 (modify-phases %standard-phases
1108 (add-after 'unpack 'fix-test
1109 (lambda* (#:key outputs #:allow-other-keys)
1110 ;; Tests try to access /var/tmp, which is not possible in our build
1111 ;; environment. Let's give them another directory.
1112 ;; /tmp gets overriden in some tests, so we need another directory.
1113 ;; the only possibility is the output directory.
1114 (let ((tmp-dir (string-append (assoc-ref outputs "out") "/tmp")))
1116 (substitute* "tests/test-run.sh"
1117 (("/var/tmp") tmp-dir)
1118 ;; Tests create a temporary python script, so fix its shebang.
1119 (("/usr/bin/env python") (which "python"))
1120 ;; Some tests try to access /usr, but that doesn't exist.
1121 ;; Give them /gnu instead.
1123 (("--ro-bind /bin /bin") "--ro-bind /gnu /bin")
1124 (("--ro-bind /sbin /sbin") "--ro-bind /gnu /sbin")
1125 (("--ro-bind /lib /lib") "--ro-bind /gnu /lib")
1126 ((" */bin/bash") (which "bash"))
1127 (("/bin/sh") (which "sh"))
1128 (("findmnt") (which "findmnt"))))
1130 ;; Remove the directory we gave to tests to have a clean package.
1131 (add-after 'check 'remove-tmp-dir
1132 (lambda* (#:key outputs #:allow-other-keys)
1133 (delete-file-recursively (string-append (assoc-ref outputs "out") "/tmp"))
1136 `(("libcap" ,libcap)))
1138 `(("python-2" ,python-2)
1139 ("util-linux" ,util-linux)))
1140 (home-page "https://github.com/containers/bubblewrap")
1141 (synopsis "Unprivileged sandboxing tool")
1142 (description "Bubblewrap is aimed at running applications in a sandbox,
1143 restricting their access to parts of the operating system or user data such as
1144 the home directory. Bubblewrap always creates a new mount namespace, and the
1145 user can specify exactly what parts of the file system should be made visible
1146 in the sandbox. These directories are mounted with the @code{nodev} option
1147 by default and can be made read-only.")
1148 (license license:lgpl2.0+)))
1150 (define-public bochs
1157 (uri (string-append "https://sourceforge.net/projects/bochs/files/bochs/"
1158 version "/bochs-" version ".tar.gz"))
1160 (base32 "1c3mw4b8wrjf8z44fvhycs95j1wd1c0b4khcv63giiia5j5q0gvj"))))
1161 (build-system gnu-build-system)
1163 `(#:tests? #f)) ; No tests exist
1165 `(("libxrandr" ,libxrandr)))
1166 (home-page "http://bochs.sourceforge.net/")
1167 (synopsis "Emulator for x86 PC")
1169 "Bochs is an emulator which can emulate Intel x86 CPU, common I/O
1170 devices, and a custom BIOS. It can also be compiled to emulate many different
1171 x86 CPUs, from early 386 to the most recent x86-64 Intel and AMD processors.
1172 Bochs can run most Operating Systems inside the emulation including Linux,
1173 DOS or Microsoft Windows.")
1174 (license license:lgpl2.0+)))
1183 (url "git://xenbits.xenproject.org/xen.git")
1184 (commit (string-append "RELEASE-" version))))
1185 (file-name (git-file-name name version))
1188 "1wv1hyfii14vi9lfjmnv07h2gpm3b7kvh2p55f4yy2b40simksgk"))))
1189 (build-system gnu-build-system)
1192 (list "--enable-rpath"
1193 "--disable-qemu-traditional" ; It tries to do "git clone"
1194 "--disable-rombios" ; would try to "git clone" via etherboot.
1195 ;; TODO: Re-enable stubdom (it's "more secure" to use it).
1196 "--disable-stubdom" ; tries to "git clone" old patched newlib.
1197 (string-append "--with-initddir="
1198 (assoc-ref %outputs "out")
1200 (string-append "--with-system-qemu="
1201 (assoc-ref %build-inputs "qemu")
1202 "/bin/qemu-system-i386")
1203 (string-append "--with-system-seabios="
1204 (assoc-ref %build-inputs "seabios")
1205 "/share/firmware/bios.bin")
1206 (string-append "--with-system-ovmf="
1207 (assoc-ref %build-inputs "ovmf")
1208 "/share/firmware/ovmf_ia32.bin"))
1209 #:make-flags (list "-j" "1"
1210 "XEN_BUILD_DATE=Thu Jan 1 01:00:01 CET 1970"
1211 "XEN_BUILD_TIME=01:00:01"
1214 "SMBIOS_REL_DATE=01/01/1970"
1215 "VGABIOS_REL_DATE=01 Jan 1970"
1216 ; QEMU_TRADITIONAL_LOC
1218 "SYSCONFIG_DIR=/tmp/etc/default"
1219 (string-append "BASH_COMPLETION_DIR="
1220 (assoc-ref %outputs "out")
1221 "/etc/bash_completion.d")
1222 (string-append "BOOT_DIR="
1223 (assoc-ref %outputs "out")
1225 (string-append "DEBUG_DIR="
1226 (assoc-ref %outputs "out")
1228 (string-append "EFI_DIR="
1229 (assoc-ref %outputs "out")
1230 "/lib/efi") ; TODO lib64 ?
1231 "MINIOS_UPSTREAM_URL="
1232 ;(string-append "DISTDIR="
1233 ; (assoc-ref %outputs "out"))
1235 #:test-target "test"
1237 (modify-phases %standard-phases
1238 (add-after 'unpack 'unpack-mini-os
1239 (lambda* (#:key inputs #:allow-other-keys)
1240 (copy-recursively (assoc-ref inputs "mini-os") "extras/mini-os")
1242 (add-after 'unpack-mini-os 'patch
1243 (lambda* (#:key inputs outputs #:allow-other-keys)
1244 (substitute* "tools/firmware/Rules.mk"
1245 (("override XEN_TARGET_ARCH = x86_32")
1246 (string-append "override XEN_TARGET_ARCH = x86_32
1247 override CC = " (assoc-ref inputs "cross-gcc") "/bin/i686-linux-gnu-gcc"))
1249 (string-append "CFLAGS=-I" (assoc-ref inputs "cross-libc")
1251 (substitute* "config/x86_32.mk"
1252 (("CFLAGS += -m32 -march=i686")
1253 (string-append "CFLAGS += -march=i686 -I"
1254 (assoc-ref inputs "cross-libc")
1256 ;; /var is not in /gnu/store , so don't try to create it.
1257 (substitute* '("tools/Makefile"
1258 "tools/xenstore/Makefile"
1259 "tools/xenpaging/Makefile")
1260 (("\\$\\(INSTALL_DIR\\) .*XEN_(DUMP|LOG|RUN|LIB|PAGING)_DIR.*")
1262 (("\\$\\(INSTALL_DIR\\) .*XEN_(RUN|LIB)_STORED.*")
1264 ;; Prevent xen from creating /etc .
1265 (substitute* "tools/examples/Makefile"
1266 ((" install-readmes") "")
1267 ((" install-configs") ""))
1269 (substitute* "tools/pygrub/setup.py"
1271 ; TODO: extra_link_args = ['-Wl,-rpath=/opt/foo'],
1272 (string-append "runtime_library_dirs = ['"
1273 (assoc-ref outputs "out")
1274 "/lib'],\nlibrary_dirs =")))
1276 (add-before 'configure 'patch-xen-script-directory
1277 (lambda* (#:key outputs #:allow-other-keys)
1278 (substitute* '("configure"
1281 (("XEN_SCRIPT_DIR=.*")
1282 (string-append "XEN_SCRIPT_DIR="
1283 (assoc-ref outputs "out")
1284 "/etc/xen/scripts")))
1286 (add-before 'configure 'set-environment-up
1287 (lambda* (#:key make-flags #:allow-other-keys)
1289 (string-contains x "cross-i686-linux"))
1290 (define (filter-environment! filter-predicate
1291 environment-variable-names)
1294 (let* ((env-value (getenv env-name))
1295 (search-path (search-path-as-string->list env-value))
1296 (new-search-path (filter filter-predicate
1298 (new-env-value (list->search-path-as-string
1299 new-search-path ":")))
1300 (setenv env-name new-env-value)))
1301 environment-variable-names))
1302 (setenv "CROSS_C_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
1303 (setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
1304 (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
1305 (filter-environment! cross?
1306 '("CROSS_C_INCLUDE_PATH" "CROSS_CPLUS_INCLUDE_PATH"
1307 "CROSS_LIBRARY_PATH"))
1308 (filter-environment! (lambda (e) (not (cross? e)))
1309 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
1311 ;; Guix tries to be helpful and automatically adds
1312 ;; mini-os-git-checkout/include to the include path,
1313 ;; but actually we don't want it to be there (yet).
1314 (filter-environment! (lambda (e)
1317 "mini-os-git-checkout")))
1318 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
1320 (setenv "EFI_VENDOR" "guix")
1323 (lambda* (#:key make-flags #:allow-other-keys)
1324 (apply invoke "make" "world" make-flags))))))
1326 `(("acpica" ,acpica) ; TODO: patch iasl invocation.
1327 ("bridge-utils" ,bridge-utils) ; TODO: patch invocations.
1329 ("iproute" ,iproute) ; TODO: patch invocations.
1332 ("libyajl" ,libyajl)
1333 ("ncurses" ,ncurses)
1334 ("openssl" ,openssl)
1337 ("qemu" ,qemu-minimal)
1338 ("seabios" ,seabios)
1339 ("util-linux" ,util-linux) ; uuid
1340 ; TODO: ocaml-findlib, ocaml-nox.
1341 ("xz" ,xz) ; for liblzma
1346 ("cmake" ,cmake-minimal)
1349 ("gettext" ,gettext-minimal)
1355 (url "http://xenbits.xen.org/git-http/mini-os.git")
1356 (commit (string-append "xen-RELEASE-" version))))
1359 "1i8pcl19n60i2m9vlg79q3nknpj209c9ic5x10wxaicx45kc107f"))
1360 (file-name "mini-os-git-checkout")))
1363 ("pkg-config" ,pkg-config)
1364 ("python" ,python-2)
1366 ("cross-gcc" ,(cross-gcc "i686-linux-gnu"
1367 #:xbinutils (cross-binutils "i686-linux-gnu")
1368 #:libc (cross-libc "i686-linux-gnu")))
1369 ("cross-libc" ,(cross-libc "i686-linux-gnu")) ; header files
1370 ("cross-libc-static" ,(cross-libc "i686-linux-gnu") "static")))
1371 (home-page "https://xenproject.org/")
1372 (synopsis "Xen Virtual Machine Monitor")
1373 (description "This package provides the Xen Virtual Machine Monitor
1374 which is a hypervisor.")
1375 ;; TODO: Some files are licensed differently. List those.
1376 (license license:gpl2)
1377 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))))