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 libusb)
61 #:use-module (gnu packages linux)
62 #:use-module (gnu packages ncurses)
63 #:use-module (gnu packages nettle)
64 #:use-module (gnu packages networking)
65 #:use-module (gnu packages package-management)
66 #:use-module (gnu packages perl)
67 #:use-module (gnu packages pkg-config)
68 #:use-module (gnu packages polkit)
69 #:use-module (gnu packages protobuf)
70 #:use-module (gnu packages python)
71 #:use-module (gnu packages python-web)
72 #:use-module (gnu packages python-xyz)
73 #:use-module (gnu packages pulseaudio)
74 #:use-module (gnu packages selinux)
75 #:use-module (gnu packages sdl)
76 #:use-module (gnu packages spice)
77 #:use-module (gnu packages texinfo)
78 #:use-module (gnu packages textutils)
79 #:use-module (gnu packages tls)
80 #:use-module (gnu packages web)
81 #:use-module (gnu packages wget)
82 #:use-module (gnu packages xdisorg)
83 #:use-module (gnu packages xml)
84 #:use-module (gnu packages xorg)
85 #:use-module (guix build-system cmake)
86 #:use-module (guix build-system gnu)
87 #:use-module (guix build-system go)
88 #:use-module (guix build-system python)
89 #:use-module (guix download)
90 #:use-module (guix git-download)
91 #:use-module ((guix licenses) #:prefix license:)
92 #:use-module (guix packages)
93 #:use-module (guix utils)
94 #:use-module (srfi srfi-1))
96 (define (qemu-patch commit file-name sha256)
97 "Return an origin for COMMIT."
101 "http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h="
104 (file-name file-name)))
112 (uri (string-append "https://download.qemu.org/qemu-"
114 (patches (search-patches "qemu-CVE-2018-16872.patch"
115 "qemu-CVE-2019-6778.patch"))
118 "1z5bd5nfyjvhfi1s95labc82y4hjdjjkdabw931362ls0zghh1ba"))))
119 (build-system gnu-build-system)
121 '(;; Running tests in parallel can occasionally lead to failures, like:
122 ;; boot_sector_test: assertion failed (signature == SIGNATURE): (0x00000000 == 0x0000dead)
124 #:configure-flags (list "--enable-usb-redir" "--enable-opengl"
125 (string-append "--smbd="
126 (assoc-ref %outputs "out")
127 "/libexec/samba-wrapper")
128 "--audio-drv-list=alsa,pa,sdl")
129 ;; Make build and test output verbose to facilitate investigation upon failure.
130 #:make-flags '("V=1")
132 (modify-phases %standard-phases
134 (lambda* (#:key inputs outputs (configure-flags '())
136 ;; The `configure' script doesn't understand some of the
137 ;; GNU options. Thus, add a new phase that's compatible.
138 (let ((out (assoc-ref outputs "out")))
139 (setenv "SHELL" (which "bash"))
141 ;; While we're at it, patch for tests.
142 (substitute* "tests/libqtest.c"
143 (("/bin/sh") (which "sh")))
145 ;; The binaries need to be linked against -lrt.
146 (setenv "LDFLAGS" "-lrt")
149 ,(string-append "--cc=" (which "gcc"))
150 ;; Some architectures insist on using HOST_CC
151 ,(string-append "--host-cc=" (which "gcc"))
152 "--disable-debug-info" ; save build space
153 "--enable-virtfs" ; just to be sure
154 ,(string-append "--prefix=" out)
155 ,(string-append "--sysconfdir=/etc")
156 ,@configure-flags)))))
157 (add-after 'install 'install-info
158 (lambda* (#:key inputs outputs #:allow-other-keys)
159 ;; Install the Info manual, unless Texinfo is missing.
160 (when (assoc-ref inputs "texinfo")
161 (let* ((out (assoc-ref outputs "out"))
162 (dir (string-append out "/share/info")))
163 (invoke "make" "info")
164 (for-each (lambda (info)
165 (install-file info dir))
166 (find-files "." "\\.info"))))
168 ;; Create a wrapper for Samba. This allows QEMU to use Samba without
169 ;; pulling it in as an input. Note that you need to explicitly install
170 ;; Samba in your Guix profile for Samba support.
171 (add-after 'install-info 'create-samba-wrapper
172 (lambda* (#:key inputs outputs #:allow-other-keys)
173 (let* ((out (assoc-ref %outputs "out"))
174 (libexec (string-append out "/libexec")))
175 (call-with-output-file "samba-wrapper"
177 (format port "#!/bin/sh
179 (chmod "samba-wrapper" #o755)
180 (install-file "samba-wrapper" libexec))
182 (add-before 'check 'disable-test-qga
184 (substitute* "tests/Makefile.include"
185 ;; Comment out the test-qga test, which needs /sys and
186 ;; fails within the build environment.
187 (("check-unit-.* tests/test-qga" all)
188 (string-append "# " all)))
190 (inputs ; TODO: Add optional inputs.
191 `(("alsa-lib" ,alsa-lib)
197 ("libcap" ,libcap) ; virtfs support requires libcap & libattr
199 ("libepoxy" ,libepoxy)
200 ("libjpeg" ,libjpeg-turbo)
202 ("libseccomp" ,libseccomp)
203 ("libusb" ,libusb) ;USB pass-through support
206 ;; ("pciutils" ,pciutils)
208 ("pulseaudio" ,pulseaudio)
211 ("usbredir" ,usbredir)
212 ("util-linux" ,util-linux)
214 ("virglrenderer" ,virglrenderer)
216 (native-inputs `(("gettext" ,gettext-minimal)
217 ("glib:bin" ,glib "bin") ; gtester, etc.
221 ("pkg-config" ,pkg-config)
222 ("python-wrapper" ,python-wrapper)
223 ("texinfo" ,texinfo)))
224 (home-page "https://www.qemu.org")
225 (synopsis "Machine emulator and virtualizer")
227 "QEMU is a generic machine emulator and virtualizer.
229 When used as a machine emulator, QEMU can run OSes and programs made for one
230 machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
231 using dynamic translation, it achieves very good performance.
233 When used as a virtualizer, QEMU achieves near native performances by
234 executing the guest code directly on the host CPU. QEMU supports
235 virtualization when executing under the Xen hypervisor or using
236 the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
237 server and embedded PowerPC, and S390 guests.")
239 ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
240 (license license:gpl2)
242 ;; Several tests fail on MIPS; see <http://hydra.gnu.org/build/117914>.
243 (supported-systems (delete "mips64el-linux" %supported-systems))))
245 (define-public qemu-minimal
246 ;; QEMU without GUI support.
247 (package (inherit qemu)
248 (name "qemu-minimal")
249 (synopsis "Machine emulator and virtualizer (without GUI)")
251 (substitute-keyword-arguments (package-arguments qemu)
252 ((#:configure-flags _ '(list))
253 ;; Restrict to the targets supported by Guix.
254 ''("--target-list=i386-softmmu,x86_64-softmmu,mips64el-softmmu,arm-softmmu,aarch64-softmmu"))))
256 ;; Remove dependencies on optional libraries, notably GUI libraries.
257 (native-inputs (fold alist-delete (package-native-inputs qemu)
259 (inputs (fold alist-delete (package-inputs qemu)
260 '("libusb" "mesa" "sdl2" "spice" "virglrenderer" "gtk+"
261 "usbredir" "libdrm" "libepoxy" "pulseaudio")))))
263 ;; The GRUB test suite fails with later versions of Qemu, so we
264 ;; keep it at 2.10 for now. See
265 ;; <https://lists.gnu.org/archive/html/bug-grub/2018-02/msg00004.html>.
266 ;; This package is hidden since we do not backport updates to it.
267 (define-public qemu-minimal-2.10
270 (inherit qemu-minimal)
274 (uri (string-append "https://download.qemu.org/qemu-"
278 "17w21spvaxaidi2am5lpsln8yjpyp2zi3s3gc6nsxj5arlgamzgw"))
280 (search-patches "qemu-glibc-2.27.patch"))))
281 ;; qemu-minimal-2.10 needs Python 2. Remove below once no longer necessary.
282 (native-inputs `(("python-2" ,python-2)
283 ,@(fold alist-delete (package-native-inputs qemu)
284 '("python-wrapper")))))))
286 (define-public libosinfo
293 (uri (string-append "https://releases.pagure.org/libosinfo/libosinfo-"
297 "12b0xj9fz9q91d1pz9xm6aqap5k1ip0m9m3qvqmwjy1lk1kjasdz"))))
298 (build-system gnu-build-system)
301 (list (string-append "--with-usb-ids-path="
302 (assoc-ref %build-inputs "usb.ids"))
303 (string-append "--with-pci-ids-path="
304 (assoc-ref %build-inputs "pci.ids")))))
306 `(("libsoup" ,libsoup)
309 ("gobject-introspection" ,gobject-introspection)))
311 `(("glib" ,glib "bin") ; glib-mkenums, etc.
314 ("intltool" ,intltool)
315 ("pkg-config" ,pkg-config)
319 (uri "https://github.com/pciutils/pciids/raw/ad02084f0bc143e3c15e31a6152a3dfb1d7a3156/pci.ids")
322 "0kfhpj5rnh24hz2714qhfmxk281vwc2w50sm73ggw5d15af7zfsw"))))
326 (uri "https://svn.code.sf.net/p/linux-usb/repo/trunk/htdocs/usb.ids?r=2681")
327 (file-name "usb.ids")
330 "1m6yhvz5k8aqzxgk7xj3jkk8frl1hbv0h3vgj4wbnvnx79qnvz3r"))))))
331 (home-page "https://libosinfo.org/")
332 (synopsis "Operating system information database")
333 (description "libosinfo is a GObject based library API for managing
334 information about operating systems, hypervisors and the (virtual) hardware
335 devices they can support. It includes a database containing device metadata
336 and provides APIs to match/identify optimal devices for deploying an operating
337 system on a hypervisor. Via GObject Introspection, the API is available in
338 all common programming languages. Vala bindings are also provided.")
339 ;; The library files are released under LGPLv2.1 or later; the source
340 ;; files in the "tools" directory are released under GPLv2+.
341 (license (list license:lgpl2.1+ license:gpl2+))))
350 "https://linuxcontainers.org/downloads/lxc/lxc-"
354 "1igxqgx8q9cp15mcp1y8j564bl85ijw04jcmgb1s5bmfbg1751sd"))))
355 (build-system gnu-build-system)
357 `(("pkg-config" ,pkg-config)))
361 ("libseccomp" ,libseccomp)
362 ("libselinux" ,libselinux)))
365 (list (string-append "--docdir=" (assoc-ref %outputs "out")
366 "/share/doc/" ,name "-" ,version)
368 "--localstatedir=/var")
370 (modify-phases %standard-phases
372 (lambda* (#:key outputs #:allow-other-keys)
373 (let* ((out (assoc-ref outputs "out"))
374 (bashcompdir (string-append out "/etc/bash_completion.d")))
375 (invoke "make" "install"
376 (string-append "bashcompdir=" bashcompdir)
377 ;; Don't install files into /var and /etc.
378 "LXCPATH=/tmp/var/lib/lxc"
379 "localstatedir=/tmp/var"
380 "sysconfdir=/tmp/etc"
381 "sysconfigdir=/tmp/etc/default")))))))
382 (synopsis "Linux container tools")
383 (home-page "https://linuxcontainers.org/")
385 "LXC is a userspace interface for the Linux kernel containment features.
386 Through a powerful API and simple tools, it lets Linux users easily create and
387 manage system or application containers.")
388 (license license:lgpl2.1+)))
390 (define-public libvirt
397 (uri (string-append "https://libvirt.org/sources/libvirt-"
400 (base32 "1d5rmcx5fgb024hw8chbiv886n3jal5wp2yajjk5l4qh9s9gkx35"))))
401 (build-system gnu-build-system)
404 (list "--with-polkit"
405 (string-append "--docdir=" (assoc-ref %outputs "out") "/share/doc/"
408 "--localstatedir=/var")
410 (modify-phases %standard-phases
411 (add-before 'configure 'fix-BOURNE_SHELL-definition
412 ;; BOURNE_SHELL is hard-#defined to ‘/bin/sh’, causing test failures.
414 (substitute* "config.h.in"
415 (("/bin/sh") (which "sh")))
417 (add-before 'configure 'disable-broken-tests
419 (let ((tests (list "commandtest" ; hangs idly
420 "virnetsockettest" ; tries to network
421 "virshtest"))) ; fails
422 (substitute* "tests/Makefile.in"
423 (((format #f "(~a)\\$\\(EXEEXT\\)" (string-join tests "|")))
427 ;; Since the sysconfdir and localstatedir should be /etc and /var
428 ;; at runtime, we must prevent writing to them at installation
430 (lambda* (#:key make-flags #:allow-other-keys)
431 (apply invoke "make" "install"
432 "sysconfdir=/tmp/etc"
433 "localstatedir=/tmp/var"
435 (add-after 'install 'wrap-libvirtd
436 (lambda* (#:key inputs outputs #:allow-other-keys)
437 (let ((out (assoc-ref outputs "out")))
438 (wrap-program (string-append out "/sbin/libvirtd")
439 `("PATH" = (,(string-append (assoc-ref inputs "iproute")
441 ,(string-append (assoc-ref inputs "qemu")
445 `(("libxml2" ,libxml2)
447 ("libpciaccess" ,libpciaccess)
453 ("libuuid" ,util-linux)
454 ("lvm2" ,lvm2) ; for libdevmapper
457 ("cyrus-sasl" ,cyrus-sasl)
460 ("dmidecode" ,dmidecode)
462 ("ebtables" ,ebtables)
464 ("iptables" ,iptables)))
466 `(("xsltproc" ,libxslt)
468 ("pkg-config" ,pkg-config)
471 (home-page "https://libvirt.org")
472 (synopsis "Simple API for virtualization")
473 (description "Libvirt is a C toolkit to interact with the virtualization
474 capabilities of recent versions of Linux. The library aims at providing long
475 term stable C API initially for the Xen paravirtualization but should be able
476 to integrate other virtualization mechanisms if needed.")
477 (license license:lgpl2.1+)))
479 (define-public libvirt-glib
481 (name "libvirt-glib")
485 (uri (string-append "ftp://libvirt.org/libvirt/glib/"
486 "libvirt-glib-" version ".tar.gz"))
489 "0six9ckmvlwwyavyjkgc262qkpvfqgi8rjij7cyk00bmqq8c9s4l"))))
490 (build-system gnu-build-system)
492 `(("openssl" ,openssl)
493 ("cyrus-sasl" ,cyrus-sasl)
494 ("lvm2" ,lvm2) ; for libdevmapper
495 ("libyajl" ,libyajl)))
497 `(("pkg-config" ,pkg-config)
498 ("intltool" ,intltool)
502 ;; ‘Required:’ by the installed .pc files.
506 ("gobject-introspection" ,gobject-introspection)))
507 (home-page "https://libvirt.org")
508 (synopsis "GLib wrapper around libvirt")
509 (description "libvirt-glib wraps the libvirt library to provide a
510 high-level object-oriented API better suited for glib-based applications, via
514 @item libvirt-glib - GLib main loop integration & misc helper APIs
515 @item libvirt-gconfig - GObjects for manipulating libvirt XML documents
516 @item libvirt-gobject - GObjects for managing libvirt objects
519 (license license:lgpl2.1+)))
521 (define-public python-libvirt
523 (name "python-libvirt")
528 ;; The latest version hosted on PyPI at 5.6.0 release time was 5.5.0.
529 (uri (string-append "https://libvirt.org/sources/python/libvirt-python-"
532 (base32 "11i440aibykxw22fzyavmrvn67s8rmnijw5bag0yx9r8jpnkzwad"))))
533 (build-system python-build-system)
536 (modify-phases %standard-phases
537 (add-after 'unpack 'patch-nosetests-path
538 (lambda* (#:key inputs #:allow-other-keys)
539 (substitute* "setup.py"
540 (("\"/usr/bin/nosetests\"")
541 (string-append "\"" (which "nosetests") "\""))
542 (("self\\.spawn\\(\\[sys\\.executable, nose\\]\\)")
543 (format #f "self.spawn([\"~a\", nose])" (which "bash"))))
546 `(("libvirt" ,libvirt)))
548 `(("python-lxml" ,python-lxml)))
550 `(("pkg-config" ,pkg-config)
551 ("python-nose" ,python-nose)))
552 (home-page "https://libvirt.org")
553 (synopsis "Python bindings to libvirt")
554 (description "This package provides Python bindings to the libvirt
555 virtualization library.")
556 (license license:lgpl2.1+)))
558 (define-public python2-libvirt
559 (package-with-python2 python-libvirt))
561 (define-public virt-manager
563 (name "virt-manager")
567 (uri (string-append "https://virt-manager.org/download/sources"
568 "/virt-manager/virt-manager-"
572 "1m038kyngmxlgz91c7z8g73lb2wy0ajyah871a3g3wb5cnd0dsil"))))
573 (build-system python-build-system)
575 `(#:use-setuptools? #f ; uses custom distutils 'install' command
576 ;; Some of the tests seem to require network access to install virtual
579 #:imported-modules ((guix build glib-or-gtk-build-system)
580 ,@%python-build-system-modules)
581 #:modules ((ice-9 match)
583 (guix build python-build-system)
584 ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
587 (modify-phases %standard-phases
588 (add-after 'unpack 'fix-setup
589 (lambda* (#:key outputs #:allow-other-keys)
590 (substitute* "virtcli/cliconfig.py"
591 (("/usr") (assoc-ref outputs "out")))
593 (add-after 'unpack 'fix-default-uri
594 (lambda* (#:key inputs #:allow-other-keys)
595 ;; Xen is not available for now - so only patch qemu.
596 (substitute* "virtManager/connect.py"
597 (("/usr(/bin/qemu-system)" _ suffix)
598 (string-append (assoc-ref inputs "qemu") suffix)))
600 (add-before 'wrap 'wrap-with-GI_TYPELIB_PATH
601 (lambda* (#:key inputs outputs #:allow-other-keys)
602 (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
603 (bin-files (find-files bin ".*"))
604 (paths (map (match-lambda
605 ((output . directory)
606 (let* ((girepodir (string-append
608 "/lib/girepository-1.0")))
609 (if (file-exists? girepodir)
612 (for-each (lambda (file)
613 (format #t "wrapping ~a\n" file)
615 `("GI_TYPELIB_PATH" ":" prefix
616 ,(filter identity paths))))
619 (add-after 'install 'glib-or-gtk-compile-schemas
620 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
621 (add-after 'install 'glib-or-gtk-wrap
622 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
628 ("libvirt-glib" ,libvirt-glib)
629 ("libosinfo" ,libosinfo)
631 ("gobject-introspection" ,gobject-introspection)
632 ("python-libvirt" ,python-libvirt)
633 ("python-requests" ,python-requests)
634 ("python-ipaddress" ,python-ipaddress)
635 ("python-pycairo" ,python-pycairo)
636 ("python-pygobject" ,python-pygobject)
637 ("python-libxml2" ,python-libxml2)
638 ("spice-gtk" ,spice-gtk)))
639 ;; virt-manager searches for qemu-img or kvm-img in the PATH.
643 `(("glib" ,glib "bin") ; glib-compile-schemas
644 ("gtk+" ,gtk+ "bin") ; gtk-update-icon-cache
645 ("perl" ,perl) ; pod2man
646 ("intltool" ,intltool)))
647 (home-page "https://virt-manager.org/")
648 (synopsis "Manage virtual machines")
650 "The virt-manager application is a desktop user interface for managing
651 virtual machines through libvirt. It primarily targets KVM VMs, but also
652 manages Xen and LXC (Linux containers). It presents a summary view of running
653 domains, their live performance and resource utilization statistics.")
654 (license license:gpl2+)))
662 (uri (string-append "http://download.openvz.org/criu/criu-"
666 "03nimyn3wy5mlw30gq7bvlzvvprqjv8f25240yj5arzlld8mhsw8"))))
667 (build-system gnu-build-system)
669 `(#:test-target "test"
670 #:tests? #f ; tests require mounting as root
672 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
673 (string-append "LIBDIR=" (assoc-ref %outputs "out")
676 (modify-phases %standard-phases
678 (lambda* (#:key inputs #:allow-other-keys)
679 ;; The includes for libnl are located in a sub-directory.
680 (setenv "C_INCLUDE_PATH"
681 (string-append (assoc-ref inputs "libnl")
683 (getenv "C_INCLUDE_PATH")))
684 ;; Prevent xmlto from failing the install phase.
685 (substitute* "Documentation/Makefile"
687 (string-append "XMLTO:="
688 (assoc-ref inputs "xmlto")
690 " --skip-validation "
692 (assoc-ref inputs "docbook-xsl")
693 "/xml/xsl/docbook-xsl-"
694 ,(package-version docbook-xsl)
695 "/manpages/docbook.xsl"))
697 (string-append (assoc-ref inputs "xmlto")
700 (add-after 'unpack 'hardcode-variables
701 (lambda* (#:key inputs #:allow-other-keys)
702 ;; Hardcode arm version detection
703 (substitute* "Makefile"
704 (("ARMV.*:=.*") "ARMV := 7\n"))
705 ;; We are currently using python-2
706 (substitute* "crit/Makefile"
707 (("\\$\\(PYTHON\\)") "python2"))
708 (substitute* "lib/Makefile"
710 (string-append (assoc-ref inputs "python")
713 (add-before 'build 'fix-symlink
714 (lambda* (#:key inputs #:allow-other-keys)
715 ;; The file 'images/google/protobuf/descriptor.proto' points to
716 ;; /usr/include/..., which obviously does not exist.
717 (let* ((file "google/protobuf/descriptor.proto")
718 (target (string-append "images/" file))
719 (source (string-append (assoc-ref inputs "protobuf")
722 (symlink source target)
724 (add-after 'install 'wrap
725 (lambda* (#:key inputs outputs #:allow-other-keys)
726 ;; Make sure 'crit' runs with the correct PYTHONPATH.
727 (let* ((out (assoc-ref outputs "out"))
728 (path (string-append out
730 (string-take (string-take-right
731 (assoc-ref inputs "python") 5) 3)
733 (getenv "PYTHONPATH"))))
734 (wrap-program (string-append out "/bin/crit")
735 `("PYTHONPATH" ":" prefix (,path))))
738 `(("protobuf" ,protobuf)
740 ("python2-protobuf" ,python2-protobuf)
741 ("python2-ipaddr" ,python2-ipaddr)
748 `(("pkg-config" ,pkg-config)
750 ("protobuf-c" ,protobuf-c)
751 ("asciidoc" ,asciidoc)
753 ("docbook-xml" ,docbook-xml)
754 ("docbook-xsl" ,docbook-xsl)))
755 (home-page "https://criu.org")
756 (synopsis "Checkpoint and restore in user space")
757 (description "Using this tool, you can freeze a running application (or
758 part of it) and checkpoint it to a hard drive as a collection of files. You
759 can then use the files to restore and run the application from the point it
760 was frozen at. The distinctive feature of the CRIU project is that it is
761 mainly implemented in user space.")
762 ;; The project is licensed under GPLv2; files in the lib/ directory are
764 (license (list license:gpl2 license:lgpl2.1))))
766 (define-public qmpbackup
772 (uri (string-append "https://github.com/abbbi/qmpbackup/archive/"
776 "10k9mnb1yrg4gw1rvz4kw4dxc4aajl8gnjrpm3axqkg63qmxj3qn"))
777 (file-name (string-append name "-" version ".tar.gz"))))
778 (build-system python-build-system)
780 `(#:python ,python-2))
781 (home-page "https://github.com/abbbi/qmpbackup")
782 (synopsis "Backup and restore QEMU machines")
783 (description "qmpbackup is designed to create and restore full and
784 incremental backups of running QEMU virtual machines via QMP, the QEMU
786 (license license:gpl3+)))
788 (define-public looking-glass-client
789 (let ((commit "182c4752d57690da7f99d5e788de9b8baea33895"))
791 (name "looking-glass-client")
792 (version (string-append "a12-" (string-take commit 7)))
796 (uri (git-reference (url "https://github.com/gnif/LookingGlass")
798 (file-name (git-file-name name version))
801 "02bq46ndmzq9cihazzn7xq1x7q5nzm7iw4l9lqzihxcxp9famkhw"))))
802 (build-system cmake-build-system)
803 (inputs `(("fontconfig" ,fontconfig)
808 ("sdl2-ttf" ,sdl2-ttf)
809 ("spice-protocol" ,spice-protocol)
810 ("wayland" ,wayland)))
811 (native-inputs `(("libconfig" ,libconfig)
813 ("pkg-config" ,pkg-config)))
815 `(#:tests? #f ;; No tests are available.
816 #:make-flags '("CC=gcc")
817 #:phases (modify-phases %standard-phases
818 (add-before 'configure 'chdir-to-client
819 (lambda* (#:key outputs #:allow-other-keys)
823 (lambda* (#:key outputs #:allow-other-keys)
824 (install-file "looking-glass-client"
825 (string-append (assoc-ref outputs "out")
829 (home-page "https://looking-glass.hostfission.com")
830 (synopsis "KVM Frame Relay (KVMFR) implementation")
831 (description "Looking Glass allows the use of a KVM (Kernel-based Virtual
832 Machine) configured for VGA PCI Pass-through without an attached physical
833 monitor, keyboard or mouse. It displays the VM's rendered contents on your main
835 ;; This package requires SSE instructions.
836 (supported-systems '("i686-linux" "x86_64-linux"))
837 (license license:gpl2+))))
839 (define-public lookingglass
840 (deprecated-package "lookingglass" looking-glass-client))
845 (version "1.0.0-rc6")
849 "https://github.com/opencontainers/runc/releases/"
850 "download/v" version "/runc.tar.xz"))
851 (file-name (string-append name "-" version ".tar.xz"))
852 (patches (search-patches "runc-CVE-2019-5736.patch"))
855 "1c7832dq70slkjh8qp2civ1wxhhdd2hrx84pq7db1mmqc9fdr3cc"))))
856 (build-system go-build-system)
858 '(#:import-path "github.com/opencontainers/runc"
860 ;; XXX: 20/139 tests fail due to missing /var, cgroups and apparmor in
861 ;; the build environment.
864 (modify-phases %standard-phases
866 (lambda* (#:key source import-path #:allow-other-keys)
867 ;; Unpack the tarball into 'runc' instead of 'runc-1.0.0-rc5'.
868 (let ((dest (string-append "src/" import-path)))
870 (invoke "tar" "-C" (string-append "src/" import-path)
871 "--strip-components=1"
874 (lambda* (#:key import-path #:allow-other-keys)
875 (chdir (string-append "src/" import-path))
876 ;; XXX: requires 'go-md2man'.
877 ;; (invoke "make" "man")
881 ;; (invoke "make" "localunittest")))
883 (lambda* (#:key outputs #:allow-other-keys)
884 (let ((out (assoc-ref outputs "out")))
885 (invoke "make" "install" "install-bash"
886 (string-append "PREFIX=" out))))))))
888 `(("pkg-config" ,pkg-config)))
890 `(("libseccomp" ,libseccomp)))
891 (synopsis "Open container initiative runtime")
892 (home-page "https://www.opencontainers.org/")
894 "@command{runc} is a command line client for running applications
895 packaged according to the
896 @uref{https://github.com/opencontainers/runtime-spec/blob/master/spec.md, Open
897 Container Initiative (OCI) format} and is a compliant implementation of the
898 Open Container Initiative specification.")
899 (license license:asl2.0)))
908 "https://github.com/openSUSE/umoci/releases/download/v"
909 version "/umoci.tar.xz"))
910 (file-name (string-append "umoci-" version ".tar.xz"))
913 "1wchmha5k2f370jfijmx9fqp0cp99zfa9ajmfbq3j24qc8p5k8lk"))))
914 (build-system go-build-system)
916 '(#:import-path "github.com/openSUSE/umoci"
919 (modify-phases %standard-phases
921 (lambda* (#:key source import-path #:allow-other-keys)
922 ;; Unpack the tarball into 'umoci' instead of "runc-${version}".
923 (let ((dest (string-append "src/" import-path)))
925 (invoke "tar" "-C" (string-append "src/" import-path)
926 "--strip-components=1"
929 (lambda* (#:key import-path #:allow-other-keys)
930 (chdir (string-append "src/" import-path))
931 ;; TODO: build manpages with 'go-md2man'.
932 (invoke "make" "SHELL=bash")))
934 (lambda* (#:key outputs #:allow-other-keys)
935 (let* ((out (assoc-ref outputs "out"))
936 (bindir (string-append out "/bin")))
937 (install-file "umoci" bindir)
939 (home-page "https://umo.ci/")
940 (synopsis "Tool for modifying Open Container images")
942 "@command{umoci} is a tool that allows for high-level modification of an
943 Open Container Initiative (OCI) image layout and its tagged images.")
944 (license license:asl2.0)))
946 (define-public skopeo
953 (url "https://github.com/projectatomic/skopeo")
954 (commit (string-append "v" version))))
955 (file-name (git-file-name name version))
958 "068nwrr3nr27alravcq1sxyhdd5jjr24213vdgn1dqva3885gbi0"))))
959 (build-system go-build-system)
961 `(("pkg-config" ,pkg-config)))
963 `(("btrfs-progs" ,btrfs-progs)
965 ("libassuan" ,libassuan)
966 ("libselinux" ,libselinux)
967 ("libostree" ,libostree)
972 '(#:import-path "github.com/projectatomic/skopeo"
974 #:tests? #f ; The tests require Docker
976 (modify-phases %standard-phases
978 (lambda* (#:key import-path #:allow-other-keys)
979 (chdir (string-append "src/" import-path))
980 ;; TODO: build manpages with 'go-md2man'.
981 (invoke "make" "binary-local")))
983 (lambda* (#:key outputs #:allow-other-keys)
984 (let ((out (assoc-ref outputs "out")))
985 (invoke "make" "install-binary" "install-completions"
986 (string-append "PREFIX=" out))))))))
987 (home-page "https://github.com/projectatomic/skopeo")
988 (synopsis "Interact with container images and container image registries")
990 "@command{skopeo} is a command line utility providing various operations
991 with container images and container image registries. It can:
994 @item Copy container images between various containers image stores,
995 converting them as necessary.
997 @item Convert a Docker schema 2 or schema 1 container image to an OCI image.
999 @item Inspect a repository on a container registry without needlessly pulling
1002 @item Sign and verify container images.
1004 @item Delete container images from a remote container registry.
1007 (license license:asl2.0)))
1009 (define-public python-vagrant
1011 (name "python-vagrant")
1016 (uri (pypi-uri "python-vagrant" version))
1019 "1ikrh6canhcxg5y7pzmkcnnydikppv7s6sm9prfx90nk0ac8m6mg"))))
1020 (build-system python-build-system)
1022 '(#:tests? #f)) ; tests involve running vagrant.
1023 (home-page "https://github.com/todddeluca/python-vagrant")
1024 (synopsis "Python bindings for Vagrant")
1026 "Python-vagrant is a Python module that provides a thin wrapper around the
1027 @code{vagrant} command line executable, allowing programmatic control of Vagrant
1029 (license license:expat)))
1031 (define-public bubblewrap
1037 (uri (string-append "https://github.com/projectatomic/bubblewrap/"
1038 "releases/download/v" version "/bubblewrap-"
1042 "1y2bdlxnlr84xcbf31lzirc292c5ak9bd2wvcvh4ppsliih6pjny"))))
1043 (build-system gnu-build-system)
1046 (modify-phases %standard-phases
1047 (add-after 'unpack 'fix-test
1048 (lambda* (#:key outputs #:allow-other-keys)
1049 ;; Tests try to access /var/tmp, which is not possible in our build
1050 ;; environment. Let's give them another directory.
1051 ;; /tmp gets overriden in some tests, so we need another directory.
1052 ;; the only possibility is the output directory.
1053 (let ((tmp-dir (string-append (assoc-ref outputs "out") "/tmp")))
1055 (substitute* "tests/test-run.sh"
1056 (("/var/tmp") tmp-dir)
1057 ;; Tests create a temporary python script, so fix its shebang.
1058 (("/usr/bin/env python") (which "python"))
1059 ;; Some tests try to access /usr, but that doesn't exist.
1060 ;; Give them /gnu instead.
1062 ((" */bin/bash") (which "bash"))
1063 (("/bin/sh") (which "sh"))
1064 (("findmnt") (which "findmnt"))))
1066 ;; Remove the directory we gave to tests to have a clean package.
1067 (add-after 'check 'remove-tmp-dir
1068 (lambda* (#:key outputs #:allow-other-keys)
1069 (delete-file-recursively (string-append (assoc-ref outputs "out") "/tmp"))
1072 `(("libcap" ,libcap)))
1074 `(("python-2" ,python-2)
1075 ("util-linux" ,util-linux)))
1076 (home-page "https://github.com/projectatomic/bubblewrap")
1077 (synopsis "Unprivileged sandboxing tool")
1078 (description "Bubblewrap is aimed at running applications in a sandbox,
1079 restricting their access to parts of the operating system or user data such as
1080 the home directory. Bubblewrap always creates a new mount namespace, and the
1081 user can specify exactly what parts of the file system should be made visible
1082 in the sandbox. These directories are mounted with the @code{nodev} option
1083 by default and can be made read-only.")
1084 (license license:lgpl2.0+)))
1086 (define-public bochs
1093 (uri (string-append "https://sourceforge.net/projects/bochs/files/bochs/"
1094 version "/bochs-" version ".tar.gz"))
1097 "1379cq4cnfprhw8mgh60i0q9j8fz8d7n3d5fnn2g9fdiv5znfnzf"))))
1098 (build-system gnu-build-system)
1100 `(#:tests? #f)) ; No tests exist
1102 `(("libxrandr" ,libxrandr)))
1103 (home-page "http://bochs.sourceforge.net/")
1104 (synopsis "Emulator for x86 PC")
1106 "Bochs is an emulator which can emulate Intel x86 CPU, common I/O
1107 devices, and a custom BIOS. It can also be compiled to emulate many different
1108 x86 CPUs, from early 386 to the most recent x86-64 Intel and AMD processors.
1109 Bochs can run most Operating Systems inside the emulation including Linux,
1110 DOS or Microsoft Windows.")
1111 (license license:lgpl2.0+)))
1120 (url "git://xenbits.xenproject.org/xen.git")
1121 (commit (string-append "RELEASE-" version))))
1122 (file-name (git-file-name name version))
1125 "1wv1hyfii14vi9lfjmnv07h2gpm3b7kvh2p55f4yy2b40simksgk"))))
1126 (build-system gnu-build-system)
1129 (list "--enable-rpath"
1130 "--disable-qemu-traditional" ; It tries to do "git clone"
1131 "--disable-rombios" ; would try to "git clone" via etherboot.
1132 ;; TODO: Re-enable stubdom (it's "more secure" to use it).
1133 "--disable-stubdom" ; tries to "git clone" old patched newlib.
1134 (string-append "--with-initddir="
1135 (assoc-ref %outputs "out")
1137 (string-append "--with-system-qemu="
1138 (assoc-ref %build-inputs "qemu")
1139 "/bin/qemu-system-i386")
1140 (string-append "--with-system-seabios="
1141 (assoc-ref %build-inputs "seabios")
1142 "/share/firmware/bios.bin")
1143 (string-append "--with-system-ovmf="
1144 (assoc-ref %build-inputs "ovmf")
1145 "/share/firmware/ovmf_ia32.bin"))
1146 #:make-flags (list "-j" "1"
1147 "XEN_BUILD_DATE=Thu Jan 1 01:00:01 CET 1970"
1148 "XEN_BUILD_TIME=01:00:01"
1151 "SMBIOS_REL_DATE=01/01/1970"
1152 "VGABIOS_REL_DATE=01 Jan 1970"
1153 ; QEMU_TRADITIONAL_LOC
1155 "SYSCONFIG_DIR=/tmp/etc/default"
1156 (string-append "BASH_COMPLETION_DIR="
1157 (assoc-ref %outputs "out")
1158 "/etc/bash_completion.d")
1159 (string-append "BOOT_DIR="
1160 (assoc-ref %outputs "out")
1162 (string-append "DEBUG_DIR="
1163 (assoc-ref %outputs "out")
1165 (string-append "EFI_DIR="
1166 (assoc-ref %outputs "out")
1167 "/lib/efi") ; TODO lib64 ?
1168 "MINIOS_UPSTREAM_URL="
1169 ;(string-append "DISTDIR="
1170 ; (assoc-ref %outputs "out"))
1172 #:test-target "test"
1174 (modify-phases %standard-phases
1175 (add-after 'unpack 'unpack-mini-os
1176 (lambda* (#:key inputs #:allow-other-keys)
1177 (copy-recursively (assoc-ref inputs "mini-os") "extras/mini-os")
1179 (add-after 'unpack-mini-os 'patch
1180 (lambda* (#:key inputs outputs #:allow-other-keys)
1181 (substitute* "tools/firmware/Rules.mk"
1182 (("override XEN_TARGET_ARCH = x86_32")
1183 (string-append "override XEN_TARGET_ARCH = x86_32
1184 override CC = " (assoc-ref inputs "cross-gcc") "/bin/i686-linux-gnu-gcc"))
1186 (string-append "CFLAGS=-I" (assoc-ref inputs "cross-libc")
1188 (substitute* "config/x86_32.mk"
1189 (("CFLAGS += -m32 -march=i686")
1190 (string-append "CFLAGS += -march=i686 -I"
1191 (assoc-ref inputs "cross-libc")
1193 ;; /var is not in /gnu/store , so don't try to create it.
1194 (substitute* '("tools/Makefile"
1195 "tools/xenstore/Makefile"
1196 "tools/xenpaging/Makefile")
1197 (("\\$\\(INSTALL_DIR\\) .*XEN_(DUMP|LOG|RUN|LIB|PAGING)_DIR.*")
1199 (("\\$\\(INSTALL_DIR\\) .*XEN_(RUN|LIB)_STORED.*")
1201 ;; Prevent xen from creating /etc .
1202 (substitute* "tools/examples/Makefile"
1203 ((" install-readmes") "")
1204 ((" install-configs") ""))
1206 (substitute* "tools/pygrub/setup.py"
1208 ; TODO: extra_link_args = ['-Wl,-rpath=/opt/foo'],
1209 (string-append "runtime_library_dirs = ['"
1210 (assoc-ref outputs "out")
1211 "/lib'],\nlibrary_dirs =")))
1213 (add-before 'configure 'patch-xen-script-directory
1214 (lambda* (#:key outputs #:allow-other-keys)
1215 (substitute* '("configure"
1218 (("XEN_SCRIPT_DIR=.*")
1219 (string-append "XEN_SCRIPT_DIR="
1220 (assoc-ref outputs "out")
1221 "/etc/xen/scripts")))
1223 (add-before 'configure 'set-environment-up
1224 (lambda* (#:key make-flags #:allow-other-keys)
1226 (string-contains x "cross-i686-linux"))
1227 (define (filter-environment! filter-predicate
1228 environment-variable-names)
1231 (let* ((env-value (getenv env-name))
1232 (search-path (search-path-as-string->list env-value))
1233 (new-search-path (filter filter-predicate
1235 (new-env-value (list->search-path-as-string
1236 new-search-path ":")))
1237 (setenv env-name new-env-value)))
1238 environment-variable-names))
1239 (setenv "CROSS_C_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
1240 (setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
1241 (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
1242 (filter-environment! cross?
1243 '("CROSS_C_INCLUDE_PATH" "CROSS_CPLUS_INCLUDE_PATH"
1244 "CROSS_LIBRARY_PATH"))
1245 (filter-environment! (lambda (e) (not (cross? e)))
1246 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
1248 ;; Guix tries to be helpful and automatically adds
1249 ;; mini-os-git-checkout/include to the include path,
1250 ;; but actually we don't want it to be there (yet).
1251 (filter-environment! (lambda (e)
1254 "mini-os-git-checkout")))
1255 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
1257 (setenv "EFI_VENDOR" "guix")
1260 (lambda* (#:key make-flags #:allow-other-keys)
1261 (apply invoke "make" "world" make-flags))))))
1263 `(("acpica" ,acpica) ; TODO: patch iasl invocation.
1264 ("bridge-utils" ,bridge-utils) ; TODO: patch invocations.
1266 ("iproute" ,iproute) ; TODO: patch invocations.
1269 ("libyajl" ,libyajl)
1270 ("ncurses" ,ncurses)
1271 ("openssl" ,openssl)
1274 ("qemu" ,qemu-minimal)
1275 ("seabios" ,seabios)
1276 ("util-linux" ,util-linux) ; uuid
1277 ; TODO: ocaml-findlib, ocaml-nox.
1278 ("xz" ,xz) ; for liblzma
1286 ("gettext" ,gettext-minimal)
1292 (url "http://xenbits.xen.org/git-http/mini-os.git")
1293 (commit (string-append "xen-RELEASE-" version))))
1296 "1i8pcl19n60i2m9vlg79q3nknpj209c9ic5x10wxaicx45kc107f"))
1297 (file-name "mini-os-git-checkout")))
1300 ("pkg-config" ,pkg-config)
1301 ("python" ,python-2)
1303 ("cross-gcc" ,(cross-gcc "i686-linux-gnu"
1304 #:xbinutils (cross-binutils "i686-linux-gnu")
1305 #:libc (cross-libc "i686-linux-gnu")))
1306 ("cross-libc" ,(cross-libc "i686-linux-gnu")) ; header files
1307 ("cross-libc-static" ,(cross-libc "i686-linux-gnu") "static")))
1308 (home-page "https://xenproject.org/")
1309 (synopsis "Xen Virtual Machine Monitor")
1310 (description "This package provides the Xen Virtual Machine Monitor
1311 which is a hypervisor.")
1312 ;; TODO: Some files are licensed differently. List those.
1313 (license license:gpl2)
1314 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))))