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 "0srrs2m6irqd4f867g8ls6jp2dq3ql0l9d0fh80d55sivvn2bd7p"))))
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 (modify-phases %standard-phases
307 ;; This odd test fails for unknown reasons.
308 (add-after 'unpack 'disable-broken-test
310 (substitute* "test/Makefile.in"
311 (("test-isodetect\\$\\(EXEEXT\\)") ""))
314 `(("libsoup" ,libsoup)
317 ("gobject-introspection" ,gobject-introspection)))
320 ("glib" ,glib "bin") ; glib-mkenums, etc.
323 ("intltool" ,intltool)
324 ("pkg-config" ,pkg-config)
328 (uri "https://github.com/pciutils/pciids/raw/ad02084f0bc143e3c15e31a6152a3dfb1d7a3156/pci.ids")
331 "0kfhpj5rnh24hz2714qhfmxk281vwc2w50sm73ggw5d15af7zfsw"))))
335 (uri "https://svn.code.sf.net/p/linux-usb/repo/trunk/htdocs/usb.ids?r=2681")
336 (file-name "usb.ids")
339 "1m6yhvz5k8aqzxgk7xj3jkk8frl1hbv0h3vgj4wbnvnx79qnvz3r"))))))
340 (home-page "https://libosinfo.org/")
341 (synopsis "Operating system information database")
342 (description "libosinfo is a GObject based library API for managing
343 information about operating systems, hypervisors and the (virtual) hardware
344 devices they can support. It includes a database containing device metadata
345 and provides APIs to match/identify optimal devices for deploying an operating
346 system on a hypervisor. Via GObject Introspection, the API is available in
347 all common programming languages. Vala bindings are also provided.")
348 ;; The library files are released under LGPLv2.1 or later; the source
349 ;; files in the "tools" directory are released under GPLv2+.
350 (license (list license:lgpl2.1+ license:gpl2+))))
359 "https://linuxcontainers.org/downloads/lxc/lxc-"
363 "1igxqgx8q9cp15mcp1y8j564bl85ijw04jcmgb1s5bmfbg1751sd"))))
364 (build-system gnu-build-system)
366 `(("pkg-config" ,pkg-config)))
370 ("libseccomp" ,libseccomp)
371 ("libselinux" ,libselinux)))
374 (list (string-append "--docdir=" (assoc-ref %outputs "out")
375 "/share/doc/" ,name "-" ,version)
377 "--localstatedir=/var")
379 (modify-phases %standard-phases
381 (lambda* (#:key outputs #:allow-other-keys)
382 (let* ((out (assoc-ref outputs "out"))
383 (bashcompdir (string-append out "/etc/bash_completion.d")))
384 (invoke "make" "install"
385 (string-append "bashcompdir=" bashcompdir)
386 ;; Don't install files into /var and /etc.
387 "LXCPATH=/tmp/var/lib/lxc"
388 "localstatedir=/tmp/var"
389 "sysconfdir=/tmp/etc"
390 "sysconfigdir=/tmp/etc/default")))))))
391 (synopsis "Linux container tools")
392 (home-page "https://linuxcontainers.org/")
394 "LXC is a userspace interface for the Linux kernel containment features.
395 Through a powerful API and simple tools, it lets Linux users easily create and
396 manage system or application containers.")
397 (license license:lgpl2.1+)))
399 (define-public libvirt
405 (uri (string-append "https://libvirt.org/sources/libvirt-"
409 "0v17zzyyb25nn9l18v5244myg7590dp6ppwgi8xysipifc0q77bz"))))
410 (build-system gnu-build-system)
413 ;; FAIL: virfirewalltest
415 ;; FAIL: virnetsockettest
416 ;; FAIL: networkxml2firewalltest
417 ;; FAIL: nwfilterebiptablestest
418 ;; FAIL: nwfilterxml2firewalltest
419 ;; Time-out while running commandtest.
422 (list "--with-polkit"
424 "--localstatedir=/var")
426 (modify-phases %standard-phases
427 (add-after 'unpack 'fix-tests
429 (substitute* '("tests/commandtest.c"
430 "gnulib/tests/test-posix_spawn1.c"
431 "gnulib/tests/test-posix_spawn2.c")
432 (("/bin/sh") (which "sh")))
435 ;; Since the sysconfdir and localstatedir should be /etc and /var
436 ;; at runtime, we must prevent writing to them at installation
439 (invoke "make" "install"
440 "sysconfdir=/tmp/etc"
441 "localstatedir=/tmp/var")))
442 (add-after 'install 'wrap-libvirtd
443 (lambda* (#:key inputs outputs #:allow-other-keys)
444 (let ((out (assoc-ref outputs "out")))
445 (wrap-program (string-append out "/sbin/libvirtd")
446 `("PATH" = (,(string-append (assoc-ref inputs "iproute")
448 ,(string-append (assoc-ref inputs "qemu")
452 `(("libxml2" ,libxml2)
454 ("libpciaccess" ,libpciaccess)
460 ("libuuid" ,util-linux)
461 ("lvm2" ,lvm2) ; for libdevmapper
464 ("cyrus-sasl" ,cyrus-sasl)
467 ("dmidecode" ,dmidecode)
469 ("ebtables" ,ebtables)
471 ("iptables" ,iptables)))
473 `(("xsltproc" ,libxslt)
475 ("pkg-config" ,pkg-config)
478 (home-page "https://libvirt.org")
479 (synopsis "Simple API for virtualization")
480 (description "Libvirt is a C toolkit to interact with the virtualization
481 capabilities of recent versions of Linux. The library aims at providing long
482 term stable C API initially for the Xen paravirtualization but should be able
483 to integrate other virtualization mechanisms if needed.")
484 (license license:lgpl2.1+)))
486 (define-public libvirt-glib
488 (name "libvirt-glib")
492 (uri (string-append "ftp://libvirt.org/libvirt/glib/"
493 "libvirt-glib-" version ".tar.gz"))
496 "0iwa5sdbii52pjpdm5j37f67sdmf0kpcky4liwhy1nf43k85i4fa"))))
497 (build-system gnu-build-system)
500 (modify-phases %standard-phases
501 (add-after 'unpack 'fix-tests
503 (substitute* "tests/test-events.c"
504 (("/bin/true") (which "true")))
507 `(("libxml2" ,libxml2)
509 ("gobject-introspection" ,gobject-introspection)
512 ("cyrus-sasl" ,cyrus-sasl)
513 ("lvm2" ,lvm2) ; for libdevmapper
514 ("libyajl" ,libyajl)))
516 `(("pkg-config" ,pkg-config)
517 ("intltool" ,intltool)
520 (home-page "https://libvirt.org")
521 (synopsis "GLib wrapper around libvirt")
522 (description "libvirt-glib wraps the libvirt library to provide a
523 high-level object-oriented API better suited for glib-based applications, via
527 @item libvirt-glib - GLib main loop integration & misc helper APIs
528 @item libvirt-gconfig - GObjects for manipulating libvirt XML documents
529 @item libvirt-gobject - GObjects for managing libvirt objects
532 (license license:lgpl2.1+)))
534 (define-public python-libvirt
536 (name "python-libvirt")
540 (uri (pypi-uri "libvirt-python" version))
543 "11fipj9naihgc9afc8bz5hi05xa1shp4qcy170sa18p3sl4zljb9"))))
544 (build-system python-build-system)
547 (modify-phases %standard-phases
548 (add-after 'unpack 'patch-nosetests-path
549 (lambda* (#:key inputs #:allow-other-keys)
550 (substitute* "setup.py"
551 (("\"/usr/bin/nosetests\"")
552 (string-append "\"" (which "nosetests") "\""))
553 (("self\\.spawn\\(\\[sys\\.executable, nose\\]\\)")
554 (format #f "self.spawn([\"~a\", nose])" (which "bash"))))
557 `(("libvirt" ,libvirt)))
559 `(("python-lxml" ,python-lxml)))
561 `(("pkg-config" ,pkg-config)
562 ("python-nose" ,python-nose)))
563 (home-page "https://libvirt.org")
564 (synopsis "Python bindings to libvirt")
565 (description "This package provides Python bindings to the libvirt
566 virtualization library.")
567 (license license:lgpl2.1+)))
569 (define-public python2-libvirt
570 (package-with-python2 python-libvirt))
572 (define-public virt-manager
574 (name "virt-manager")
578 (uri (string-append "https://virt-manager.org/download/sources"
579 "/virt-manager/virt-manager-"
583 "1m038kyngmxlgz91c7z8g73lb2wy0ajyah871a3g3wb5cnd0dsil"))))
584 (build-system python-build-system)
586 `(#:use-setuptools? #f ; uses custom distutils 'install' command
587 ;; Some of the tests seem to require network access to install virtual
590 #:imported-modules ((guix build glib-or-gtk-build-system)
591 ,@%python-build-system-modules)
592 #:modules ((ice-9 match)
594 (guix build python-build-system)
595 ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
598 (modify-phases %standard-phases
599 (add-after 'unpack 'fix-setup
600 (lambda* (#:key outputs #:allow-other-keys)
601 (substitute* "virtcli/cliconfig.py"
602 (("/usr") (assoc-ref outputs "out")))
604 (add-after 'unpack 'fix-default-uri
605 (lambda* (#:key inputs #:allow-other-keys)
606 ;; Xen is not available for now - so only patch qemu.
607 (substitute* "virtManager/connect.py"
608 (("/usr(/bin/qemu-system)" _ suffix)
609 (string-append (assoc-ref inputs "qemu") suffix)))
611 (add-before 'wrap 'wrap-with-GI_TYPELIB_PATH
612 (lambda* (#:key inputs outputs #:allow-other-keys)
613 (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
614 (bin-files (find-files bin ".*"))
615 (paths (map (match-lambda
616 ((output . directory)
617 (let* ((girepodir (string-append
619 "/lib/girepository-1.0")))
620 (if (file-exists? girepodir)
623 (for-each (lambda (file)
624 (format #t "wrapping ~a\n" file)
626 `("GI_TYPELIB_PATH" ":" prefix
627 ,(filter identity paths))))
630 (add-after 'install 'glib-or-gtk-compile-schemas
631 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
632 (add-after 'install 'glib-or-gtk-wrap
633 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
639 ("libvirt-glib" ,libvirt-glib)
640 ("libosinfo" ,libosinfo)
642 ("gobject-introspection" ,gobject-introspection)
643 ("python-libvirt" ,python-libvirt)
644 ("python-requests" ,python-requests)
645 ("python-ipaddress" ,python-ipaddress)
646 ("python-pycairo" ,python-pycairo)
647 ("python-pygobject" ,python-pygobject)
648 ("python-libxml2" ,python-libxml2)
649 ("spice-gtk" ,spice-gtk)))
650 ;; virt-manager searches for qemu-img or kvm-img in the PATH.
654 `(("glib" ,glib "bin") ; glib-compile-schemas
655 ("gtk+" ,gtk+ "bin") ; gtk-update-icon-cache
656 ("perl" ,perl) ; pod2man
657 ("intltool" ,intltool)))
658 (home-page "https://virt-manager.org/")
659 (synopsis "Manage virtual machines")
661 "The virt-manager application is a desktop user interface for managing
662 virtual machines through libvirt. It primarily targets KVM VMs, but also
663 manages Xen and LXC (Linux containers). It presents a summary view of running
664 domains, their live performance and resource utilization statistics.")
665 (license license:gpl2+)))
673 (uri (string-append "http://download.openvz.org/criu/criu-"
677 "03nimyn3wy5mlw30gq7bvlzvvprqjv8f25240yj5arzlld8mhsw8"))))
678 (build-system gnu-build-system)
680 `(#:test-target "test"
681 #:tests? #f ; tests require mounting as root
683 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
684 (string-append "LIBDIR=" (assoc-ref %outputs "out")
687 (modify-phases %standard-phases
689 (lambda* (#:key inputs #:allow-other-keys)
690 ;; The includes for libnl are located in a sub-directory.
691 (setenv "C_INCLUDE_PATH"
692 (string-append (assoc-ref inputs "libnl")
694 (getenv "C_INCLUDE_PATH")))
695 ;; Prevent xmlto from failing the install phase.
696 (substitute* "Documentation/Makefile"
698 (string-append "XMLTO:="
699 (assoc-ref inputs "xmlto")
701 " --skip-validation "
703 (assoc-ref inputs "docbook-xsl")
704 "/xml/xsl/docbook-xsl-"
705 ,(package-version docbook-xsl)
706 "/manpages/docbook.xsl"))
708 (string-append (assoc-ref inputs "xmlto")
711 (add-after 'unpack 'hardcode-variables
712 (lambda* (#:key inputs #:allow-other-keys)
713 ;; Hardcode arm version detection
714 (substitute* "Makefile"
715 (("ARMV.*:=.*") "ARMV := 7\n"))
716 ;; We are currently using python-2
717 (substitute* "crit/Makefile"
718 (("\\$\\(PYTHON\\)") "python2"))
719 (substitute* "lib/Makefile"
721 (string-append (assoc-ref inputs "python")
724 (add-before 'build 'fix-symlink
725 (lambda* (#:key inputs #:allow-other-keys)
726 ;; The file 'images/google/protobuf/descriptor.proto' points to
727 ;; /usr/include/..., which obviously does not exist.
728 (let* ((file "google/protobuf/descriptor.proto")
729 (target (string-append "images/" file))
730 (source (string-append (assoc-ref inputs "protobuf")
733 (symlink source target)
735 (add-after 'install 'wrap
736 (lambda* (#:key inputs outputs #:allow-other-keys)
737 ;; Make sure 'crit' runs with the correct PYTHONPATH.
738 (let* ((out (assoc-ref outputs "out"))
739 (path (string-append out
741 (string-take (string-take-right
742 (assoc-ref inputs "python") 5) 3)
744 (getenv "PYTHONPATH"))))
745 (wrap-program (string-append out "/bin/crit")
746 `("PYTHONPATH" ":" prefix (,path))))
749 `(("protobuf" ,protobuf)
751 ("python2-protobuf" ,python2-protobuf)
752 ("python2-ipaddr" ,python2-ipaddr)
759 `(("pkg-config" ,pkg-config)
761 ("protobuf-c" ,protobuf-c)
762 ("asciidoc" ,asciidoc)
764 ("docbook-xml" ,docbook-xml)
765 ("docbook-xsl" ,docbook-xsl)))
766 (home-page "https://criu.org")
767 (synopsis "Checkpoint and restore in user space")
768 (description "Using this tool, you can freeze a running application (or
769 part of it) and checkpoint it to a hard drive as a collection of files. You
770 can then use the files to restore and run the application from the point it
771 was frozen at. The distinctive feature of the CRIU project is that it is
772 mainly implemented in user space.")
773 ;; The project is licensed under GPLv2; files in the lib/ directory are
775 (license (list license:gpl2 license:lgpl2.1))))
777 (define-public qmpbackup
783 (uri (string-append "https://github.com/abbbi/qmpbackup/archive/"
787 "10k9mnb1yrg4gw1rvz4kw4dxc4aajl8gnjrpm3axqkg63qmxj3qn"))
788 (file-name (string-append name "-" version ".tar.gz"))))
789 (build-system python-build-system)
791 `(#:python ,python-2))
792 (home-page "https://github.com/abbbi/qmpbackup")
793 (synopsis "Backup and restore QEMU machines")
794 (description "qmpbackup is designed to create and restore full and
795 incremental backups of running QEMU virtual machines via QMP, the QEMU
797 (license license:gpl3+)))
799 (define-public looking-glass-client
800 (let ((commit "182c4752d57690da7f99d5e788de9b8baea33895"))
802 (name "looking-glass-client")
803 (version (string-append "a12-" (string-take commit 7)))
807 (uri (git-reference (url "https://github.com/gnif/LookingGlass")
809 (file-name (git-file-name name version))
812 "02bq46ndmzq9cihazzn7xq1x7q5nzm7iw4l9lqzihxcxp9famkhw"))))
813 (build-system cmake-build-system)
814 (inputs `(("fontconfig" ,fontconfig)
819 ("sdl2-ttf" ,sdl2-ttf)
820 ("spice-protocol" ,spice-protocol)
821 ("wayland" ,wayland)))
822 (native-inputs `(("libconfig" ,libconfig)
824 ("pkg-config" ,pkg-config)))
826 `(#:tests? #f ;; No tests are available.
827 #:make-flags '("CC=gcc")
828 #:phases (modify-phases %standard-phases
829 (add-before 'configure 'chdir-to-client
830 (lambda* (#:key outputs #:allow-other-keys)
834 (lambda* (#:key outputs #:allow-other-keys)
835 (install-file "looking-glass-client"
836 (string-append (assoc-ref outputs "out")
840 (home-page "https://looking-glass.hostfission.com")
841 (synopsis "KVM Frame Relay (KVMFR) implementation")
842 (description "Looking Glass allows the use of a KVM (Kernel-based Virtual
843 Machine) configured for VGA PCI Pass-through without an attached physical
844 monitor, keyboard or mouse. It displays the VM's rendered contents on your main
846 ;; This package requires SSE instructions.
847 (supported-systems '("i686-linux" "x86_64-linux"))
848 (license license:gpl2+))))
850 (define-public lookingglass
851 (deprecated-package "lookingglass" looking-glass-client))
856 (version "1.0.0-rc6")
860 "https://github.com/opencontainers/runc/releases/"
861 "download/v" version "/runc.tar.xz"))
862 (file-name (string-append name "-" version ".tar.xz"))
863 (patches (search-patches "runc-CVE-2019-5736.patch"))
866 "1c7832dq70slkjh8qp2civ1wxhhdd2hrx84pq7db1mmqc9fdr3cc"))))
867 (build-system go-build-system)
869 '(#:import-path "github.com/opencontainers/runc"
871 ;; XXX: 20/139 tests fail due to missing /var, cgroups and apparmor in
872 ;; the build environment.
875 (modify-phases %standard-phases
877 (lambda* (#:key source import-path #:allow-other-keys)
878 ;; Unpack the tarball into 'runc' instead of 'runc-1.0.0-rc5'.
879 (let ((dest (string-append "src/" import-path)))
881 (invoke "tar" "-C" (string-append "src/" import-path)
882 "--strip-components=1"
885 (lambda* (#:key import-path #:allow-other-keys)
886 (chdir (string-append "src/" import-path))
887 ;; XXX: requires 'go-md2man'.
888 ;; (invoke "make" "man")
892 ;; (invoke "make" "localunittest")))
894 (lambda* (#:key outputs #:allow-other-keys)
895 (let ((out (assoc-ref outputs "out")))
896 (invoke "make" "install" "install-bash"
897 (string-append "PREFIX=" out))))))))
899 `(("pkg-config" ,pkg-config)))
901 `(("libseccomp" ,libseccomp)))
902 (synopsis "Open container initiative runtime")
903 (home-page "https://www.opencontainers.org/")
905 "@command{runc} is a command line client for running applications
906 packaged according to the
907 @uref{https://github.com/opencontainers/runtime-spec/blob/master/spec.md, Open
908 Container Initiative (OCI) format} and is a compliant implementation of the
909 Open Container Initiative specification.")
910 (license license:asl2.0)))
919 "https://github.com/openSUSE/umoci/releases/download/v"
920 version "/umoci.tar.xz"))
921 (file-name (string-append "umoci-" version ".tar.xz"))
924 "1wchmha5k2f370jfijmx9fqp0cp99zfa9ajmfbq3j24qc8p5k8lk"))))
925 (build-system go-build-system)
927 '(#:import-path "github.com/openSUSE/umoci"
930 (modify-phases %standard-phases
932 (lambda* (#:key source import-path #:allow-other-keys)
933 ;; Unpack the tarball into 'umoci' instead of "runc-${version}".
934 (let ((dest (string-append "src/" import-path)))
936 (invoke "tar" "-C" (string-append "src/" import-path)
937 "--strip-components=1"
940 (lambda* (#:key import-path #:allow-other-keys)
941 (chdir (string-append "src/" import-path))
942 ;; TODO: build manpages with 'go-md2man'.
943 (invoke "make" "SHELL=bash")))
945 (lambda* (#:key outputs #:allow-other-keys)
946 (let* ((out (assoc-ref outputs "out"))
947 (bindir (string-append out "/bin")))
948 (install-file "umoci" bindir)
950 (home-page "https://umo.ci/")
951 (synopsis "Tool for modifying Open Container images")
953 "@command{umoci} is a tool that allows for high-level modification of an
954 Open Container Initiative (OCI) image layout and its tagged images.")
955 (license license:asl2.0)))
957 (define-public skopeo
964 (url "https://github.com/projectatomic/skopeo")
965 (commit (string-append "v" version))))
966 (file-name (git-file-name name version))
969 "068nwrr3nr27alravcq1sxyhdd5jjr24213vdgn1dqva3885gbi0"))))
970 (build-system go-build-system)
972 `(("pkg-config" ,pkg-config)))
974 `(("btrfs-progs" ,btrfs-progs)
976 ("libassuan" ,libassuan)
977 ("libselinux" ,libselinux)
978 ("libostree" ,libostree)
983 '(#:import-path "github.com/projectatomic/skopeo"
985 #:tests? #f ; The tests require Docker
987 (modify-phases %standard-phases
989 (lambda* (#:key import-path #:allow-other-keys)
990 (chdir (string-append "src/" import-path))
991 ;; TODO: build manpages with 'go-md2man'.
992 (invoke "make" "binary-local")))
994 (lambda* (#:key outputs #:allow-other-keys)
995 (let ((out (assoc-ref outputs "out")))
996 (invoke "make" "install-binary" "install-completions"
997 (string-append "PREFIX=" out))))))))
998 (home-page "https://github.com/projectatomic/skopeo")
999 (synopsis "Interact with container images and container image registries")
1001 "@command{skopeo} is a command line utility providing various operations
1002 with container images and container image registries. It can:
1005 @item Copy container images between various containers image stores,
1006 converting them as necessary.
1008 @item Convert a Docker schema 2 or schema 1 container image to an OCI image.
1010 @item Inspect a repository on a container registry without needlessly pulling
1013 @item Sign and verify container images.
1015 @item Delete container images from a remote container registry.
1018 (license license:asl2.0)))
1020 (define-public python-vagrant
1022 (name "python-vagrant")
1027 (uri (pypi-uri "python-vagrant" version))
1030 "1ikrh6canhcxg5y7pzmkcnnydikppv7s6sm9prfx90nk0ac8m6mg"))))
1031 (build-system python-build-system)
1033 '(#:tests? #f)) ; tests involve running vagrant.
1034 (home-page "https://github.com/todddeluca/python-vagrant")
1035 (synopsis "Python bindings for Vagrant")
1037 "Python-vagrant is a Python module that provides a thin wrapper around the
1038 @code{vagrant} command line executable, allowing programmatic control of Vagrant
1040 (license license:expat)))
1042 (define-public bubblewrap
1048 (uri (string-append "https://github.com/projectatomic/bubblewrap/"
1049 "releases/download/v" version "/bubblewrap-"
1053 "1y2bdlxnlr84xcbf31lzirc292c5ak9bd2wvcvh4ppsliih6pjny"))))
1054 (build-system gnu-build-system)
1057 (modify-phases %standard-phases
1058 (add-after 'unpack 'fix-test
1059 (lambda* (#:key outputs #:allow-other-keys)
1060 ;; Tests try to access /var/tmp, which is not possible in our build
1061 ;; environment. Let's give them another directory.
1062 ;; /tmp gets overriden in some tests, so we need another directory.
1063 ;; the only possibility is the output directory.
1064 (let ((tmp-dir (string-append (assoc-ref outputs "out") "/tmp")))
1066 (substitute* "tests/test-run.sh"
1067 (("/var/tmp") tmp-dir)
1068 ;; Tests create a temporary python script, so fix its shebang.
1069 (("/usr/bin/env python") (which "python"))
1070 ;; Some tests try to access /usr, but that doesn't exist.
1071 ;; Give them /gnu instead.
1073 ((" */bin/bash") (which "bash"))
1074 (("/bin/sh") (which "sh"))
1075 (("findmnt") (which "findmnt"))))
1077 ;; Remove the directory we gave to tests to have a clean package.
1078 (add-after 'check 'remove-tmp-dir
1079 (lambda* (#:key outputs #:allow-other-keys)
1080 (delete-file-recursively (string-append (assoc-ref outputs "out") "/tmp"))
1083 `(("libcap" ,libcap)))
1085 `(("python-2" ,python-2)
1086 ("util-linux" ,util-linux)))
1087 (home-page "https://github.com/projectatomic/bubblewrap")
1088 (synopsis "Unprivileged sandboxing tool")
1089 (description "Bubblewrap is aimed at running applications in a sandbox,
1090 restricting their access to parts of the operating system or user data such as
1091 the home directory. Bubblewrap always creates a new mount namespace, and the
1092 user can specify exactly what parts of the file system should be made visible
1093 in the sandbox. These directories are mounted with the @code{nodev} option
1094 by default and can be made read-only.")
1095 (license license:lgpl2.0+)))
1097 (define-public bochs
1104 (uri (string-append "https://sourceforge.net/projects/bochs/files/bochs/"
1105 version "/bochs-" version ".tar.gz"))
1108 "1379cq4cnfprhw8mgh60i0q9j8fz8d7n3d5fnn2g9fdiv5znfnzf"))))
1109 (build-system gnu-build-system)
1111 `(#:tests? #f)) ; No tests exist
1113 `(("libxrandr" ,libxrandr)))
1114 (home-page "http://bochs.sourceforge.net/")
1115 (synopsis "Emulator for x86 PC")
1117 "Bochs is an emulator which can emulate Intel x86 CPU, common I/O
1118 devices, and a custom BIOS. It can also be compiled to emulate many different
1119 x86 CPUs, from early 386 to the most recent x86-64 Intel and AMD processors.
1120 Bochs can run most Operating Systems inside the emulation including Linux,
1121 DOS or Microsoft Windows.")
1122 (license license:lgpl2.0+)))
1131 (url "git://xenbits.xenproject.org/xen.git")
1132 (commit (string-append "RELEASE-" version))))
1133 (file-name (git-file-name name version))
1136 "1wv1hyfii14vi9lfjmnv07h2gpm3b7kvh2p55f4yy2b40simksgk"))))
1137 (build-system gnu-build-system)
1140 (list "--enable-rpath"
1141 "--disable-qemu-traditional" ; It tries to do "git clone"
1142 "--disable-rombios" ; would try to "git clone" via etherboot.
1143 ;; TODO: Re-enable stubdom (it's "more secure" to use it).
1144 "--disable-stubdom" ; tries to "git clone" old patched newlib.
1145 (string-append "--with-initddir="
1146 (assoc-ref %outputs "out")
1148 (string-append "--with-system-qemu="
1149 (assoc-ref %build-inputs "qemu")
1150 "/bin/qemu-system-i386")
1151 (string-append "--with-system-seabios="
1152 (assoc-ref %build-inputs "seabios")
1153 "/share/firmware/bios.bin")
1154 (string-append "--with-system-ovmf="
1155 (assoc-ref %build-inputs "ovmf")
1156 "/share/firmware/ovmf_ia32.bin"))
1157 #:make-flags (list "-j" "1"
1158 "XEN_BUILD_DATE=Thu Jan 1 01:00:01 CET 1970"
1159 "XEN_BUILD_TIME=01:00:01"
1162 "SMBIOS_REL_DATE=01/01/1970"
1163 "VGABIOS_REL_DATE=01 Jan 1970"
1164 ; QEMU_TRADITIONAL_LOC
1166 "SYSCONFIG_DIR=/tmp/etc/default"
1167 (string-append "BASH_COMPLETION_DIR="
1168 (assoc-ref %outputs "out")
1169 "/etc/bash_completion.d")
1170 (string-append "BOOT_DIR="
1171 (assoc-ref %outputs "out")
1173 (string-append "DEBUG_DIR="
1174 (assoc-ref %outputs "out")
1176 (string-append "EFI_DIR="
1177 (assoc-ref %outputs "out")
1178 "/lib/efi") ; TODO lib64 ?
1179 "MINIOS_UPSTREAM_URL="
1180 ;(string-append "DISTDIR="
1181 ; (assoc-ref %outputs "out"))
1183 #:test-target "test"
1185 (modify-phases %standard-phases
1186 (add-after 'unpack 'unpack-mini-os
1187 (lambda* (#:key inputs #:allow-other-keys)
1188 (copy-recursively (assoc-ref inputs "mini-os") "extras/mini-os")
1190 (add-after 'unpack-mini-os 'patch
1191 (lambda* (#:key inputs outputs #:allow-other-keys)
1192 (substitute* "tools/firmware/Rules.mk"
1193 (("override XEN_TARGET_ARCH = x86_32")
1194 (string-append "override XEN_TARGET_ARCH = x86_32
1195 override CC = " (assoc-ref inputs "cross-gcc") "/bin/i686-linux-gnu-gcc"))
1197 (string-append "CFLAGS=-I" (assoc-ref inputs "cross-libc")
1199 (substitute* "config/x86_32.mk"
1200 (("CFLAGS += -m32 -march=i686")
1201 (string-append "CFLAGS += -march=i686 -I"
1202 (assoc-ref inputs "cross-libc")
1204 ;; /var is not in /gnu/store , so don't try to create it.
1205 (substitute* '("tools/Makefile"
1206 "tools/xenstore/Makefile"
1207 "tools/xenpaging/Makefile")
1208 (("\\$\\(INSTALL_DIR\\) .*XEN_(DUMP|LOG|RUN|LIB|PAGING)_DIR.*")
1210 (("\\$\\(INSTALL_DIR\\) .*XEN_(RUN|LIB)_STORED.*")
1212 ;; Prevent xen from creating /etc .
1213 (substitute* "tools/examples/Makefile"
1214 ((" install-readmes") "")
1215 ((" install-configs") ""))
1217 (substitute* "tools/pygrub/setup.py"
1219 ; TODO: extra_link_args = ['-Wl,-rpath=/opt/foo'],
1220 (string-append "runtime_library_dirs = ['"
1221 (assoc-ref outputs "out")
1222 "/lib'],\nlibrary_dirs =")))
1224 (add-before 'configure 'patch-xen-script-directory
1225 (lambda* (#:key outputs #:allow-other-keys)
1226 (substitute* '("configure"
1229 (("XEN_SCRIPT_DIR=.*")
1230 (string-append "XEN_SCRIPT_DIR="
1231 (assoc-ref outputs "out")
1232 "/etc/xen/scripts")))
1234 (add-before 'configure 'set-environment-up
1235 (lambda* (#:key make-flags #:allow-other-keys)
1237 (string-contains x "cross-i686-linux"))
1238 (define (filter-environment! filter-predicate
1239 environment-variable-names)
1242 (let* ((env-value (getenv env-name))
1243 (search-path (search-path-as-string->list env-value))
1244 (new-search-path (filter filter-predicate
1246 (new-env-value (list->search-path-as-string
1247 new-search-path ":")))
1248 (setenv env-name new-env-value)))
1249 environment-variable-names))
1250 (setenv "CROSS_C_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
1251 (setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
1252 (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
1253 (filter-environment! cross?
1254 '("CROSS_C_INCLUDE_PATH" "CROSS_CPLUS_INCLUDE_PATH"
1255 "CROSS_LIBRARY_PATH"))
1256 (filter-environment! (lambda (e) (not (cross? e)))
1257 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
1259 ;; Guix tries to be helpful and automatically adds
1260 ;; mini-os-git-checkout/include to the include path,
1261 ;; but actually we don't want it to be there (yet).
1262 (filter-environment! (lambda (e)
1265 "mini-os-git-checkout")))
1266 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
1268 (setenv "EFI_VENDOR" "guix")
1271 (lambda* (#:key make-flags #:allow-other-keys)
1272 (apply invoke "make" "world" make-flags))))))
1274 `(("acpica" ,acpica) ; TODO: patch iasl invocation.
1275 ("bridge-utils" ,bridge-utils) ; TODO: patch invocations.
1277 ("iproute" ,iproute) ; TODO: patch invocations.
1280 ("libyajl" ,libyajl)
1281 ("ncurses" ,ncurses)
1282 ("openssl" ,openssl)
1285 ("qemu" ,qemu-minimal)
1286 ("seabios" ,seabios)
1287 ("util-linux" ,util-linux) ; uuid
1288 ; TODO: ocaml-findlib, ocaml-nox.
1289 ("xz" ,xz) ; for liblzma
1297 ("gettext" ,gettext-minimal)
1303 (url "http://xenbits.xen.org/git-http/mini-os.git")
1304 (commit (string-append "xen-RELEASE-" version))))
1307 "1i8pcl19n60i2m9vlg79q3nknpj209c9ic5x10wxaicx45kc107f"))
1308 (file-name "mini-os-git-checkout")))
1311 ("pkg-config" ,pkg-config)
1312 ("python" ,python-2)
1314 ("cross-gcc" ,(cross-gcc "i686-linux-gnu"
1315 #:xbinutils (cross-binutils "i686-linux-gnu")
1316 #:libc (cross-libc "i686-linux-gnu")))
1317 ("cross-libc" ,(cross-libc "i686-linux-gnu")) ; header files
1318 ("cross-libc-static" ,(cross-libc "i686-linux-gnu") "static")))
1319 (home-page "https://xenproject.org/")
1320 (synopsis "Xen Virtual Machine Monitor")
1321 (description "This package provides the Xen Virtual Machine Monitor
1322 which is a hypervisor.")
1323 ;; TODO: Some files are licensed differently. List those.
1324 (license license:gpl2)
1325 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))))