gnu: ecl: Update to 20.4.24.
[jackhill/guix/guix.git] / gnu / packages / virtualization.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2020 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015, 2016, 2017, 2018 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2016, 2017, 2018. 2019 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2016, 2017 Ricardo Wurmus <rekado@elephly.net>
6 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
7 ;;; Copyright © 2017 Andy Patterson <ajpatter@uwaterloo.ca>
8 ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
9 ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
10 ;;; Copyright © 2018 Danny Milosavljevic <dannym@scratchpost.org>
11 ;;; Copyright © 2018 Sou Bunnbu <iyzsong@member.fsf.org>
12 ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
13 ;;; Copyright © 2019 Guy Fleury Iteriteka <hoonandon@gmail.com>
14 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
15 ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
16 ;;;
17 ;;; This file is part of GNU Guix.
18 ;;;
19 ;;; GNU Guix is free software; you can redistribute it and/or modify it
20 ;;; under the terms of the GNU General Public License as published by
21 ;;; the Free Software Foundation; either version 3 of the License, or (at
22 ;;; your option) any later version.
23 ;;;
24 ;;; GNU Guix is distributed in the hope that it will be useful, but
25 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ;;; GNU General Public License for more details.
28 ;;;
29 ;;; You should have received a copy of the GNU General Public License
30 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31
32 (define-module (gnu packages virtualization)
33 #:use-module (gnu packages)
34 #:use-module (gnu packages admin)
35 #:use-module (gnu packages assembly)
36 #:use-module (gnu packages attr)
37 #:use-module (gnu packages autotools)
38 #:use-module (gnu packages backup)
39 #:use-module (gnu packages bison)
40 #:use-module (gnu packages check)
41 #:use-module (gnu packages cmake)
42 #:use-module (gnu packages compression)
43 #:use-module (gnu packages cross-base)
44 #:use-module (gnu packages curl)
45 #:use-module (gnu packages cyrus-sasl)
46 #:use-module (gnu packages disk)
47 #:use-module (gnu packages dns)
48 #:use-module (gnu packages docbook)
49 #:use-module (gnu packages documentation)
50 #:use-module (gnu packages figlet)
51 #:use-module (gnu packages firmware)
52 #:use-module (gnu packages flex)
53 #:use-module (gnu packages fontutils)
54 #:use-module (gnu packages freedesktop)
55 #:use-module (gnu packages gettext)
56 #:use-module (gnu packages gl)
57 #:use-module (gnu packages glib)
58 #:use-module (gnu packages gnome)
59 #:use-module (gnu packages gnupg)
60 #:use-module (gnu packages golang)
61 #:use-module (gnu packages gtk)
62 #:use-module (gnu packages image)
63 #:use-module (gnu packages libbsd)
64 #:use-module (gnu packages libusb)
65 #:use-module (gnu packages linux)
66 #:use-module (gnu packages ncurses)
67 #:use-module (gnu packages nettle)
68 #:use-module (gnu packages networking)
69 #:use-module (gnu packages onc-rpc)
70 #:use-module (gnu packages package-management)
71 #:use-module (gnu packages perl)
72 #:use-module (gnu packages pkg-config)
73 #:use-module (gnu packages polkit)
74 #:use-module (gnu packages protobuf)
75 #:use-module (gnu packages python)
76 #:use-module (gnu packages python-web)
77 #:use-module (gnu packages python-xyz)
78 #:use-module (gnu packages pulseaudio)
79 #:use-module (gnu packages selinux)
80 #:use-module (gnu packages sdl)
81 #:use-module (gnu packages sphinx)
82 #:use-module (gnu packages spice)
83 #:use-module (gnu packages texinfo)
84 #:use-module (gnu packages textutils)
85 #:use-module (gnu packages tls)
86 #:use-module (gnu packages web)
87 #:use-module (gnu packages wget)
88 #:use-module (gnu packages xdisorg)
89 #:use-module (gnu packages xml)
90 #:use-module (gnu packages xorg)
91 #:use-module (guix build-system cmake)
92 #:use-module (guix build-system gnu)
93 #:use-module (guix build-system go)
94 #:use-module (guix build-system meson)
95 #:use-module (guix build-system python)
96 #:use-module (guix build-system trivial)
97 #:use-module (guix download)
98 #:use-module (guix git-download)
99 #:use-module ((guix licenses) #:prefix license:)
100 #:use-module (guix packages)
101 #:use-module (guix utils)
102 #:use-module (srfi srfi-1))
103
104 (define (qemu-patch commit file-name sha256)
105 "Return an origin for COMMIT."
106 (origin
107 (method url-fetch)
108 (uri (string-append
109 "http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h="
110 commit))
111 (sha256 sha256)
112 (file-name file-name)))
113
114 (define-public qemu
115 (package
116 (name "qemu")
117 (version "4.2.0")
118 (source (origin
119 (method url-fetch)
120 (uri (string-append "https://download.qemu.org/qemu-"
121 version ".tar.xz"))
122 (patches (search-patches "qemu-CVE-2020-1711.patch"
123 "qemu-CVE-2020-7039.patch"
124 "qemu-CVE-2020-7211.patch"
125 "qemu-CVE-2020-8608.patch"
126 "qemu-fix-documentation-build-failure.patch"))
127 (sha256
128 (base32
129 "1w38hzlw7xp05gcq1nhga7hxvndxy6dfcnzi7q2il8ff110isj6k"))))
130 (build-system gnu-build-system)
131 (arguments
132 `(;; Running tests in parallel can occasionally lead to failures, like:
133 ;; boot_sector_test: assertion failed (signature == SIGNATURE): (0x00000000 == 0x0000dead)
134 #:parallel-tests? #f
135
136 ;; FIXME: Disable tests on i686 to work around
137 ;; <https://bugs.gnu.org/40527>.
138 #:tests? ,(or (%current-target-system)
139 (not (string=? "i686-linux" (%current-system))))
140
141 #:configure-flags (list "--enable-usb-redir" "--enable-opengl"
142 "--enable-docs"
143 (string-append "--smbd="
144 (assoc-ref %outputs "out")
145 "/libexec/samba-wrapper")
146 "--audio-drv-list=alsa,pa,sdl")
147 ;; Make build and test output verbose to facilitate investigation upon failure.
148 #:make-flags '("V=1")
149 #:phases
150 (modify-phases %standard-phases
151 (replace 'configure
152 (lambda* (#:key inputs outputs (configure-flags '())
153 #:allow-other-keys)
154 ;; The `configure' script doesn't understand some of the
155 ;; GNU options. Thus, add a new phase that's compatible.
156 (let ((out (assoc-ref outputs "out")))
157 (setenv "SHELL" (which "bash"))
158
159 ;; While we're at it, patch for tests.
160 (substitute* "tests/libqtest.c"
161 (("/bin/sh") (which "sh")))
162
163 ;; The binaries need to be linked against -lrt.
164 (setenv "LDFLAGS" "-lrt")
165 (apply invoke
166 `("./configure"
167 ,(string-append "--cc=" (which "gcc"))
168 ;; Some architectures insist on using HOST_CC
169 ,(string-append "--host-cc=" (which "gcc"))
170 "--disable-debug-info" ; save build space
171 "--enable-virtfs" ; just to be sure
172 ,(string-append "--prefix=" out)
173 ,(string-append "--sysconfdir=/etc")
174 ,@configure-flags)))))
175 (add-after 'install 'install-info
176 (lambda* (#:key inputs outputs #:allow-other-keys)
177 ;; Install the Info manual, unless Texinfo is missing.
178 (when (assoc-ref inputs "texinfo")
179 (let* ((out (assoc-ref outputs "out"))
180 (dir (string-append out "/share/info")))
181 (invoke "make" "info")
182 (for-each (lambda (info)
183 (install-file info dir))
184 (find-files "." "\\.info"))))
185 #t))
186 ;; Create a wrapper for Samba. This allows QEMU to use Samba without
187 ;; pulling it in as an input. Note that you need to explicitly install
188 ;; Samba in your Guix profile for Samba support.
189 (add-after 'install-info 'create-samba-wrapper
190 (lambda* (#:key inputs outputs #:allow-other-keys)
191 (let* ((out (assoc-ref %outputs "out"))
192 (libexec (string-append out "/libexec")))
193 (call-with-output-file "samba-wrapper"
194 (lambda (port)
195 (format port "#!/bin/sh
196 exec smbd $@")))
197 (chmod "samba-wrapper" #o755)
198 (install-file "samba-wrapper" libexec))
199 #t))
200 (add-before 'configure 'prevent-network-configuration
201 (lambda _
202 ;; Prevent the build from trying to use git to fetch from the net.
203 (substitute* "Makefile"
204 (("@./config.status")
205 "")) #t))
206 (add-before 'check 'disable-unusable-tests
207 (lambda* (#:key inputs outputs #:allow-other-keys)
208 (substitute* "tests/Makefile.include"
209 ;; Comment out the test-qga test, which needs /sys and
210 ;; fails within the build environment.
211 (("check-unit-.* tests/test-qga" all)
212 (string-append "# " all)))
213 (substitute* "tests/Makefile.include"
214 ;; Comment out the test-char test, which needs networking and
215 ;; fails within the build environment.
216 (("check-unit-.* tests/test-char" all)
217 (string-append "# " all)))
218 #t)))))
219 (inputs ; TODO: Add optional inputs.
220 `(("alsa-lib" ,alsa-lib)
221 ("attr" ,attr)
222 ("glib" ,glib)
223 ("gtk+" ,gtk+)
224 ("libaio" ,libaio)
225 ("libattr" ,attr)
226 ("libcap" ,libcap) ; virtfs support requires libcap & libattr
227 ("libdrm" ,libdrm)
228 ("libepoxy" ,libepoxy)
229 ("libjpeg" ,libjpeg-turbo)
230 ("libpng" ,libpng)
231 ("libseccomp" ,libseccomp)
232 ("libusb" ,libusb) ;USB pass-through support
233 ("mesa" ,mesa)
234 ("ncurses" ,ncurses)
235 ;; ("pciutils" ,pciutils)
236 ("pixman" ,pixman)
237 ("pulseaudio" ,pulseaudio)
238 ("sdl2" ,sdl2)
239 ("spice" ,spice)
240 ("usbredir" ,usbredir)
241 ("util-linux" ,util-linux)
242 ("vde2" ,vde2)
243 ("virglrenderer" ,virglrenderer)
244 ("zlib" ,zlib)))
245 (native-inputs `(("gettext" ,gettext-minimal)
246 ("glib:bin" ,glib "bin") ; gtester, etc.
247 ("perl" ,perl)
248 ("flex" ,flex)
249 ("bison" ,bison)
250 ("pkg-config" ,pkg-config)
251 ("python-wrapper" ,python-wrapper)
252 ("python-sphinx" ,python-sphinx)
253 ("texinfo" ,texinfo)))
254 (home-page "https://www.qemu.org")
255 (synopsis "Machine emulator and virtualizer")
256 (description
257 "QEMU is a generic machine emulator and virtualizer.
258
259 When used as a machine emulator, QEMU can run OSes and programs made for one
260 machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
261 using dynamic translation, it achieves very good performance.
262
263 When used as a virtualizer, QEMU achieves near native performances by
264 executing the guest code directly on the host CPU. QEMU supports
265 virtualization when executing under the Xen hypervisor or using
266 the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
267 server and embedded PowerPC, and S390 guests.")
268
269 ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
270 (license license:gpl2)
271
272 ;; Several tests fail on MIPS; see <http://hydra.gnu.org/build/117914>.
273 (supported-systems (delete "mips64el-linux" %supported-systems))))
274
275 (define-public qemu-minimal
276 ;; QEMU without GUI support.
277 (package (inherit qemu)
278 (name "qemu-minimal")
279 (synopsis "Machine emulator and virtualizer (without GUI)")
280 (arguments
281 (substitute-keyword-arguments (package-arguments qemu)
282 ((#:configure-flags _ '(list))
283 ;; Restrict to the targets supported by Guix.
284 ''("--target-list=i386-softmmu,x86_64-softmmu,mips64el-softmmu,arm-softmmu,aarch64-softmmu"))))
285
286 ;; Remove dependencies on optional libraries, notably GUI libraries.
287 (native-inputs (fold alist-delete (package-native-inputs qemu)
288 '("gettext")))
289 (inputs (fold alist-delete (package-inputs qemu)
290 '("libusb" "mesa" "sdl2" "spice" "virglrenderer" "gtk+"
291 "usbredir" "libdrm" "libepoxy" "pulseaudio" "vde2")))))
292
293 (define-public libosinfo
294 (package
295 (name "libosinfo")
296 (version "1.7.1")
297 (source
298 (origin
299 (method url-fetch)
300 (uri (string-append "https://releases.pagure.org/libosinfo/libosinfo-"
301 version ".tar.xz"))
302 (sha256
303 (base32
304 "1s97sv24bybggjx6hgqba2qdqz3ivfpd4cmkh4zm5y59sim109mv"))))
305 (build-system meson-build-system)
306 (arguments
307 `(#:configure-flags
308 (list (string-append "-Dwith-usb-ids-path="
309 (assoc-ref %build-inputs "usb.ids"))
310 (string-append "-Dwith-pci-ids-path="
311 (assoc-ref %build-inputs "pci.ids")))
312 #:phases
313 (modify-phases %standard-phases
314 (add-after 'unpack 'patch-osinfo-path
315 (lambda* (#:key inputs #:allow-other-keys)
316 (substitute* "osinfo/osinfo_loader.c"
317 (("path = DATA_DIR.*")
318 (string-append "path = \"" (assoc-ref inputs "osinfo-db")
319 "/share/osinfo\";")))
320 #t)))))
321 (inputs
322 `(("libsoup" ,libsoup)
323 ("libxml2" ,libxml2)
324 ("libxslt" ,libxslt)
325 ("osinfo-db" ,osinfo-db)))
326 (native-inputs
327 `(("glib" ,glib "bin") ; glib-mkenums, etc.
328 ("gobject-introspection" ,gobject-introspection)
329 ("gtk-doc" ,gtk-doc)
330 ("vala" ,vala)
331 ("intltool" ,intltool)
332 ("pkg-config" ,pkg-config)
333 ("pci.ids"
334 ,(origin
335 (method url-fetch)
336 (uri "https://github.com/pciutils/pciids/raw/ad02084f0bc143e3c15e31a6152a3dfb1d7a3156/pci.ids")
337 (sha256
338 (base32
339 "0kfhpj5rnh24hz2714qhfmxk281vwc2w50sm73ggw5d15af7zfsw"))))
340 ("usb.ids"
341 ,(origin
342 (method url-fetch)
343 (uri "https://svn.code.sf.net/p/linux-usb/repo/trunk/htdocs/usb.ids?r=2681")
344 (file-name "usb.ids")
345 (sha256
346 (base32
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+))))
359
360 (define-public lxc
361 (package
362 (name "lxc")
363 (version "3.1.0")
364 (source (origin
365 (method url-fetch)
366 (uri (string-append
367 "https://linuxcontainers.org/downloads/lxc/lxc-"
368 version ".tar.gz"))
369 (sha256
370 (base32
371 "1igxqgx8q9cp15mcp1y8j564bl85ijw04jcmgb1s5bmfbg1751sd"))))
372 (build-system gnu-build-system)
373 (native-inputs
374 `(("pkg-config" ,pkg-config)))
375 (inputs
376 `(("gnutls" ,gnutls)
377 ("libcap" ,libcap)
378 ("libseccomp" ,libseccomp)
379 ("libselinux" ,libselinux)))
380 (arguments
381 `(#:configure-flags
382 (list (string-append "--docdir=" (assoc-ref %outputs "out")
383 "/share/doc/" ,name "-" ,version)
384 "--sysconfdir=/etc"
385 "--localstatedir=/var")
386 #:make-flags
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")
391 "/include"))
392 #:phases
393 (modify-phases %standard-phases
394 (replace 'install
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/")
407 (description
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+)))
412
413 (define-public libvirt
414 (package
415 (name "libvirt")
416 (version "5.8.0")
417 (source
418 (origin
419 (method url-fetch)
420 (uri (string-append "https://libvirt.org/sources/libvirt-"
421 version ".tar.xz"))
422 (sha256
423 (base32 "0m8cqaqflvys5kaqpvb0qr4k365j09jc5xk6x70yvg8qkcl2hcz2"))
424 (patches
425 (search-patches "libvirt-create-machine-cgroup.patch"))))
426 (build-system gnu-build-system)
427 (arguments
428 `(#:configure-flags
429 (list "--with-qemu"
430 "--with-qemu-user=nobody"
431 "--with-qemu-group=kvm"
432 "--with-polkit"
433 (string-append "--docdir=" (assoc-ref %outputs "out") "/share/doc/"
434 ,name "-" ,version)
435 "--sysconfdir=/etc"
436 "--localstatedir=/var")
437 #:phases
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.
441 (lambda _
442 (substitute* "config.h.in"
443 (("/bin/sh") (which "sh")))
444 #t))
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")
452 "/include/tirpc")))
453 #t))
454 (add-before 'configure 'disable-broken-tests
455 (lambda _
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 "|")))
463 ""))
464 #t)))
465 (replace 'install
466 ;; Since the sysconfdir and localstatedir should be /etc and /var
467 ;; at runtime, we must prevent writing to them at installation
468 ;; time.
469 (lambda* (#:key make-flags #:allow-other-keys)
470 (apply invoke "make" "install"
471 "sysconfdir=/tmp/etc"
472 "localstatedir=/tmp/var"
473 make-flags))))))
474 (inputs
475 `(("libxml2" ,libxml2)
476 ("eudev" ,eudev)
477 ("libpciaccess" ,libpciaccess)
478 ("gnutls" ,gnutls)
479 ("dbus" ,dbus)
480 ("libpcap" ,libpcap)
481 ("libnl" ,libnl)
482 ("libtirpc" ,libtirpc) ;for <rpc/rpc.h>
483 ("libuuid" ,util-linux)
484 ("lvm2" ,lvm2) ;for libdevmapper
485 ("curl" ,curl)
486 ("openssl" ,openssl)
487 ("cyrus-sasl" ,cyrus-sasl)
488 ("libyajl" ,libyajl)
489 ("audit" ,audit)
490 ("dmidecode" ,dmidecode)
491 ("dnsmasq" ,dnsmasq)
492 ("ebtables" ,ebtables)
493 ("iproute" ,iproute)
494 ("iptables" ,iptables)))
495 (native-inputs
496 `(("xsltproc" ,libxslt)
497 ("perl" ,perl)
498 ("pkg-config" ,pkg-config)
499 ("polkit" ,polkit)
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+)))
508
509 (define-public libvirt-glib
510 (package
511 (name "libvirt-glib")
512 (version "3.0.0")
513 (source (origin
514 (method url-fetch)
515 (uri (string-append "ftp://libvirt.org/libvirt/glib/"
516 "libvirt-glib-" version ".tar.gz"))
517 (sha256
518 (base32
519 "1zpbv4ninc57c9rw4zmmkvvqn7154iv1qfr20kyxn8xplalqrzvz"))))
520 (build-system gnu-build-system)
521 (inputs
522 `(("openssl" ,openssl)
523 ("cyrus-sasl" ,cyrus-sasl)
524 ("lvm2" ,lvm2) ; for libdevmapper
525 ("libyajl" ,libyajl)))
526 (native-inputs
527 `(("pkg-config" ,pkg-config)
528 ("intltool" ,intltool)
529 ("glib" ,glib "bin")
530 ("vala" ,vala)))
531 (propagated-inputs
532 ;; ‘Required:’ by the installed .pc files.
533 `(("glib" ,glib)
534 ("libvirt" ,libvirt)
535 ("libxml2" ,libxml2)
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
541 three libraries:
542
543 @enumerate
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
547 @end enumerate
548 ")
549 (license license:lgpl2.1+)))
550
551 (define-public python-libvirt
552 (package
553 (name "python-libvirt")
554 (version "5.8.0")
555 (source
556 (origin
557 (method url-fetch)
558 (uri (string-append "https://libvirt.org/sources/python/libvirt-python-"
559 version ".tar.gz"))
560 (sha256
561 (base32 "0kyz3lx49d8p75mvbzinxc1zgs8g7adn77y9bm15b8b4ad9zl5s6"))))
562 (build-system python-build-system)
563 (arguments
564 `(#:phases
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"))))
573 #t)))))
574 (inputs
575 `(("libvirt" ,libvirt)))
576 (propagated-inputs
577 `(("python-lxml" ,python-lxml)))
578 (native-inputs
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+)))
586
587 (define-public python2-libvirt
588 (package-with-python2 python-libvirt))
589
590 (define-public virt-manager
591 (package
592 (name "virt-manager")
593 (version "2.2.1")
594 (source (origin
595 (method url-fetch)
596 (uri (string-append "https://virt-manager.org/download/sources"
597 "/virt-manager/virt-manager-"
598 version ".tar.gz"))
599 (sha256
600 (base32
601 "06ws0agxlip6p6n3n43knsnjyd91gqhh2dadgc33wl9lx1k8vn6g"))))
602 (build-system python-build-system)
603 (arguments
604 `(#:use-setuptools? #f ; uses custom distutils 'install' command
605 ;; Some of the tests seem to require network access to install virtual
606 ;; machines.
607 #:tests? #f
608 #:imported-modules ((guix build glib-or-gtk-build-system)
609 ,@%python-build-system-modules)
610 #:modules ((ice-9 match)
611 (srfi srfi-26)
612 (guix build python-build-system)
613 ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
614 (guix build utils))
615 #:phases
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")))
621 #t))
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)))
627 #t))
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)))
634 #t))
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
642 directory
643 "/lib/girepository-1.0")))
644 (if (file-exists? girepodir)
645 girepodir #f))))
646 inputs)))
647 (for-each (lambda (file)
648 (format #t "wrapping ~a\n" file)
649 (wrap-program file
650 `("GI_TYPELIB_PATH" ":" prefix
651 ,(filter identity paths))))
652 bin-files))
653 #t))
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)))))
658 (inputs
659 `(("dconf" ,dconf)
660 ("gtk+" ,gtk+)
661 ("gtk-vnc" ,gtk-vnc)
662 ("gtksourceview" ,gtksourceview)
663 ("libvirt" ,libvirt)
664 ("libvirt-glib" ,libvirt-glib)
665 ("libosinfo" ,libosinfo)
666 ("vte" ,vte)
667 ("python-libvirt" ,python-libvirt)
668 ("python-requests" ,python-requests)
669 ("python-ipaddress" ,python-ipaddress)
670 ("python-pycairo" ,python-pycairo)
671 ("python-pygobject" ,python-pygobject)
672 ("python-libxml2" ,python-libxml2)
673 ("spice-gtk" ,spice-gtk)))
674 ;; virt-manager searches for qemu-img or kvm-img in the PATH.
675 (propagated-inputs
676 `(("qemu" ,qemu)))
677 (native-inputs
678 `(("glib" ,glib "bin") ; glib-compile-schemas
679 ("gobject-introspection" ,gobject-introspection)
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")
685 (description
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+)))
691
692 (define-public criu
693 (package
694 (name "criu")
695 (version "3.13")
696 (source (origin
697 (method url-fetch)
698 (uri (string-append "http://download.openvz.org/criu/criu-"
699 version ".tar.bz2"))
700 (sha256
701 (base32
702 "1yn9ix9lqvqvjrs3a3g6g1wqfniyf9n7giy0mr3jvijmrcm7y0pa"))))
703 (build-system gnu-build-system)
704 (arguments
705 `(#:test-target "test"
706 #:tests? #f ; tests require mounting as root
707 #:make-flags
708 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
709 (string-append "LIBDIR=" (assoc-ref %outputs "out")
710 "/lib")
711 (string-append "ASCIIDOC=" (assoc-ref %build-inputs "asciidoc")
712 "/bin/asciidoc")
713 (string-append "XMLTO=" (assoc-ref %build-inputs "xmlto")
714 "/bin/xmlto"))
715 #:phases
716 (modify-phases %standard-phases
717 (replace 'configure
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")
722 "/include/libnl3:"
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")
729 "/include"))
730 #t))
731 (add-after 'configure 'fix-documentation
732 (lambda* (#:key inputs outputs #:allow-other-keys)
733 (substitute* "Documentation/Makefile"
734 (("-m custom.xsl")
735 (string-append
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")))
741 #t))
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"
751 (("\\$\\(PYTHON\\)")
752 (string-append (assoc-ref inputs "python")
753 "/bin/python")))
754 #t))
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")
762 "/include/" file)))
763 (delete-file target)
764 (symlink source target)
765 #t)))
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
771 "/lib/python"
772 (string-take (string-take-right
773 (assoc-ref inputs "python") 5) 3)
774 "/site-packages:"
775 (getenv "PYTHONPATH"))))
776 (wrap-program (string-append out "/bin/crit")
777 `("PYTHONPATH" ":" prefix (,path))))
778 #t)))))
779 (inputs
780 `(("protobuf" ,protobuf)
781 ("python" ,python-2)
782 ("python2-protobuf" ,python2-protobuf)
783 ("python2-ipaddr" ,python2-ipaddr)
784 ("iproute" ,iproute)
785 ("libaio" ,libaio)
786 ("libcap" ,libcap)
787 ("libnet" ,libnet)
788 ("libnl" ,libnl)
789 ("libbsd" ,libbsd)))
790 (native-inputs
791 `(("pkg-config" ,pkg-config)
792 ("perl" ,perl)
793 ("protobuf-c" ,protobuf-c)
794 ("asciidoc" ,asciidoc)
795 ("xmlto" ,xmlto)
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
806 ;; LGPLv2.1.
807 (license (list license:gpl2 license:lgpl2.1))))
808
809 (define-public qmpbackup
810 (package
811 (name "qmpbackup")
812 (version "0.2")
813 (source (origin
814 (method git-fetch)
815 (uri (git-reference
816 (url "https://github.com/abbbi/qmpbackup.git")
817 (commit version)))
818 (file-name (git-file-name name version))
819 (sha256
820 (base32
821 "0swhp5byz44brhyis1a39p11fyn9q84xz5q6v2fah29r7d71kmmx"))))
822 (build-system python-build-system)
823 (arguments
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
829 Machine Protocol.")
830 (license license:gpl3+)))
831
832 (define-public looking-glass-client
833 (let ((commit "182c4752d57690da7f99d5e788de9b8baea33895"))
834 (package
835 (name "looking-glass-client")
836 (version (string-append "a12-" (string-take commit 7)))
837 (source
838 (origin
839 (method git-fetch)
840 (uri (git-reference (url "https://github.com/gnif/LookingGlass")
841 (commit commit)))
842 (file-name (git-file-name name version))
843 (sha256
844 (base32
845 "02bq46ndmzq9cihazzn7xq1x7q5nzm7iw4l9lqzihxcxp9famkhw"))
846 (modules '((guix build utils)))
847 (snippet
848 '(begin
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"
853 (("-march=native")
854 ""))
855 #t))))
856 (build-system cmake-build-system)
857 (inputs `(("fontconfig" ,fontconfig)
858 ("glu" ,glu)
859 ("mesa" ,mesa)
860 ("openssl" ,openssl)
861 ("sdl2" ,sdl2)
862 ("sdl2-ttf" ,sdl2-ttf)
863 ("spice-protocol" ,spice-protocol)
864 ("wayland" ,wayland)))
865 (native-inputs `(("libconfig" ,libconfig)
866 ("nettle" ,nettle)
867 ("pkg-config" ,pkg-config)))
868 (arguments
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)
874 (chdir "client")
875 #t))
876 (add-after 'chdir-to-client 'add-missing-include
877 (lambda _
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>"))
883 #t))
884 (replace 'install
885 (lambda* (#:key outputs #:allow-other-keys)
886 (install-file "looking-glass-client"
887 (string-append (assoc-ref outputs "out")
888 "/bin"))
889 #t)))))
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
895 monitor/GPU.")
896 ;; This package requires SSE instructions.
897 (supported-systems '("i686-linux" "x86_64-linux"))
898 (license license:gpl2+))))
899
900 (define-public runc
901 (package
902 (name "runc")
903 (version "1.0.0-rc6")
904 (source (origin
905 (method url-fetch)
906 (uri (string-append
907 "https://github.com/opencontainers/runc/releases/"
908 "download/v" version "/runc.tar.xz"))
909 (file-name (string-append name "-" version ".tar.xz"))
910 (patches (search-patches "runc-CVE-2019-5736.patch"))
911 (sha256
912 (base32
913 "1c7832dq70slkjh8qp2civ1wxhhdd2hrx84pq7db1mmqc9fdr3cc"))))
914 (build-system go-build-system)
915 (arguments
916 '(#:import-path "github.com/opencontainers/runc"
917 #:install-source? #f
918 ;; XXX: 20/139 tests fail due to missing /var, cgroups and apparmor in
919 ;; the build environment.
920 #:tests? #f
921 #:phases
922 (modify-phases %standard-phases
923 (replace 'unpack
924 (lambda* (#:key source import-path #:allow-other-keys)
925 ;; Unpack the tarball into 'runc' instead of 'runc-1.0.0-rc5'.
926 (let ((dest (string-append "src/" import-path)))
927 (mkdir-p dest)
928 (invoke "tar" "-C" (string-append "src/" import-path)
929 "--strip-components=1"
930 "-xvf" source))))
931 (replace 'build
932 (lambda* (#:key import-path #:allow-other-keys)
933 (chdir (string-append "src/" import-path))
934 ;; XXX: requires 'go-md2man'.
935 ;; (invoke "make" "man")
936 (invoke "make")))
937 ;; (replace 'check
938 ;; (lambda _
939 ;; (invoke "make" "localunittest")))
940 (replace 'install
941 (lambda* (#:key outputs #:allow-other-keys)
942 (let ((out (assoc-ref outputs "out")))
943 (invoke "make" "install" "install-bash"
944 (string-append "PREFIX=" out))))))))
945 (native-inputs
946 `(("pkg-config" ,pkg-config)))
947 (inputs
948 `(("libseccomp" ,libseccomp)))
949 (synopsis "Open container initiative runtime")
950 (home-page "https://www.opencontainers.org/")
951 (description
952 "@command{runc} is a command line client for running applications
953 packaged according to the
954 @uref{https://github.com/opencontainers/runtime-spec/blob/master/spec.md, Open
955 Container Initiative (OCI) format} and is a compliant implementation of the
956 Open Container Initiative specification.")
957 (license license:asl2.0)))
958
959 (define-public umoci
960 (package
961 (name "umoci")
962 (version "0.4.5")
963 (source (origin
964 (method url-fetch)
965 (uri (string-append
966 "https://github.com/openSUSE/umoci/releases/download/v"
967 version "/umoci.tar.xz"))
968 (file-name (string-append "umoci-" version ".tar.xz"))
969 (sha256
970 (base32
971 "0x1yyvpllz6fyy9xip6f7b6c94v984n3faf8p50fr9y4ygkgi15a"))))
972 (build-system go-build-system)
973 (arguments
974 '(#:import-path "github.com/openSUSE/umoci"
975 #:install-source? #f
976 #:phases
977 (modify-phases %standard-phases
978 (replace 'unpack
979 (lambda* (#:key source import-path #:allow-other-keys)
980 ;; Unpack the tarball into 'umoci' instead of "runc-${version}".
981 (let ((dest (string-append "src/" import-path)))
982 (mkdir-p dest)
983 (invoke "tar" "-C" (string-append "src/" import-path)
984 "--strip-components=1"
985 "-xvf" source))))
986 (replace 'build
987 (lambda* (#:key import-path #:allow-other-keys)
988 (chdir (string-append "src/" import-path))
989 ;; TODO: build manpages with 'go-md2man'.
990 (invoke "make" "SHELL=bash")))
991 (replace 'install
992 (lambda* (#:key outputs #:allow-other-keys)
993 (let* ((out (assoc-ref outputs "out"))
994 (bindir (string-append out "/bin")))
995 (install-file "umoci" bindir)
996 #t))))))
997 (home-page "https://umo.ci/")
998 (synopsis "Tool for modifying Open Container images")
999 (description
1000 "@command{umoci} is a tool that allows for high-level modification of an
1001 Open Container Initiative (OCI) image layout and its tagged images.")
1002 (license license:asl2.0)))
1003
1004 (define-public skopeo
1005 (package
1006 (name "skopeo")
1007 (version "0.1.40")
1008 (source (origin
1009 (method git-fetch)
1010 (uri (git-reference
1011 (url "https://github.com/projectatomic/skopeo")
1012 (commit (string-append "v" version))))
1013 (file-name (git-file-name name version))
1014 (sha256
1015 (base32
1016 "1bagirzdzjhicn5dr691092ac3q6lhz3xngjzgqiqkxnvpz7p6cn"))))
1017 (build-system go-build-system)
1018 (native-inputs
1019 `(("pkg-config" ,pkg-config)))
1020 (inputs
1021 `(("btrfs-progs" ,btrfs-progs)
1022 ("eudev" ,eudev)
1023 ("libassuan" ,libassuan)
1024 ("libselinux" ,libselinux)
1025 ("libostree" ,libostree)
1026 ("lvm2" ,lvm2)
1027 ("glib" ,glib)
1028 ("gpgme" ,gpgme)))
1029 (arguments
1030 '(#:import-path "github.com/projectatomic/skopeo"
1031 #:install-source? #f
1032 #:tests? #f ; The tests require Docker
1033 #:phases
1034 (modify-phases %standard-phases
1035 (replace 'build
1036 (lambda* (#:key import-path #:allow-other-keys)
1037 (chdir (string-append "src/" import-path))
1038 ;; TODO: build manpages with 'go-md2man'.
1039 (invoke "make" "binary-local")))
1040 (replace 'install
1041 (lambda* (#:key outputs #:allow-other-keys)
1042 (let ((out (assoc-ref outputs "out")))
1043 (invoke "make" "install-binary" "install-completions"
1044 (string-append "PREFIX=" out))))))))
1045 (home-page "https://github.com/projectatomic/skopeo")
1046 (synopsis "Interact with container images and container image registries")
1047 (description
1048 "@command{skopeo} is a command line utility providing various operations
1049 with container images and container image registries. It can:
1050 @enumerate
1051
1052 @item Copy container images between various containers image stores,
1053 converting them as necessary.
1054
1055 @item Convert a Docker schema 2 or schema 1 container image to an OCI image.
1056
1057 @item Inspect a repository on a container registry without needlessly pulling
1058 the image.
1059
1060 @item Sign and verify container images.
1061
1062 @item Delete container images from a remote container registry.
1063
1064 @end enumerate")
1065 (license license:asl2.0)))
1066
1067 (define-public python-vagrant
1068 (package
1069 (name "python-vagrant")
1070 (version "0.5.15")
1071 (source
1072 (origin
1073 (method url-fetch)
1074 (uri (pypi-uri "python-vagrant" version))
1075 (sha256
1076 (base32
1077 "1ikrh6canhcxg5y7pzmkcnnydikppv7s6sm9prfx90nk0ac8m6mg"))))
1078 (build-system python-build-system)
1079 (arguments
1080 '(#:tests? #f)) ; tests involve running vagrant.
1081 (home-page "https://github.com/todddeluca/python-vagrant")
1082 (synopsis "Python bindings for Vagrant")
1083 (description
1084 "Python-vagrant is a Python module that provides a thin wrapper around the
1085 @code{vagrant} command line executable, allowing programmatic control of Vagrant
1086 virtual machines.")
1087 (license license:expat)))
1088
1089 (define-public bubblewrap
1090 (package
1091 (name "bubblewrap")
1092 (version "0.4.1")
1093 (source (origin
1094 (method url-fetch)
1095 (uri (string-append "https://github.com/containers/bubblewrap/"
1096 "releases/download/v" version "/bubblewrap-"
1097 version ".tar.xz"))
1098 (sha256
1099 (base32
1100 "00ycgi6q2yngh06bnz50wkvar6r2jnjf3j158grhi9k13jdrpimr"))))
1101 (build-system gnu-build-system)
1102 (arguments
1103 `(#:phases
1104 (modify-phases %standard-phases
1105 (add-after 'unpack 'fix-test
1106 (lambda* (#:key outputs #:allow-other-keys)
1107 ;; Tests try to access /var/tmp, which is not possible in our build
1108 ;; environment. Let's give them another directory.
1109 ;; /tmp gets overriden in some tests, so we need another directory.
1110 ;; the only possibility is the output directory.
1111 (let ((tmp-dir (string-append (assoc-ref outputs "out") "/tmp")))
1112 (mkdir-p tmp-dir)
1113 (substitute* "tests/test-run.sh"
1114 (("/var/tmp") tmp-dir)
1115 ;; Tests create a temporary python script, so fix its shebang.
1116 (("/usr/bin/env python") (which "python"))
1117 ;; Some tests try to access /usr, but that doesn't exist.
1118 ;; Give them /gnu instead.
1119 (("/usr") "/gnu")
1120 (("--ro-bind /bin /bin") "--ro-bind /gnu /bin")
1121 (("--ro-bind /sbin /sbin") "--ro-bind /gnu /sbin")
1122 (("--ro-bind /lib /lib") "--ro-bind /gnu /lib")
1123 ((" */bin/bash") (which "bash"))
1124 (("/bin/sh") (which "sh"))
1125 (("findmnt") (which "findmnt"))))
1126 #t))
1127 ;; Remove the directory we gave to tests to have a clean package.
1128 (add-after 'check 'remove-tmp-dir
1129 (lambda* (#:key outputs #:allow-other-keys)
1130 (delete-file-recursively (string-append (assoc-ref outputs "out") "/tmp"))
1131 #t)))))
1132 (inputs
1133 `(("libcap" ,libcap)))
1134 (native-inputs
1135 `(("python-2" ,python-2)
1136 ("util-linux" ,util-linux)))
1137 (home-page "https://github.com/containers/bubblewrap")
1138 (synopsis "Unprivileged sandboxing tool")
1139 (description "Bubblewrap is aimed at running applications in a sandbox,
1140 restricting their access to parts of the operating system or user data such as
1141 the home directory. Bubblewrap always creates a new mount namespace, and the
1142 user can specify exactly what parts of the file system should be made visible
1143 in the sandbox. These directories are mounted with the @code{nodev} option
1144 by default and can be made read-only.")
1145 (license license:lgpl2.0+)))
1146
1147 (define-public bochs
1148 (package
1149 (name "bochs")
1150 (version "2.6.11")
1151 (source
1152 (origin
1153 (method url-fetch)
1154 (uri (string-append "https://sourceforge.net/projects/bochs/files/bochs/"
1155 version "/bochs-" version ".tar.gz"))
1156 (sha256
1157 (base32 "0ql8q6y1k356li1g9gbvl21448mlxphxxi6kjb2b3pxvzd0pp2b3"))))
1158 (build-system gnu-build-system)
1159 (arguments
1160 `(#:tests? #f)) ; no tests exist
1161 (inputs
1162 `(("libxrandr" ,libxrandr)))
1163 (home-page "http://bochs.sourceforge.net/")
1164 (synopsis "Emulator for x86 PC")
1165 (description
1166 "Bochs is an emulator which can emulate Intel x86 CPU, common I/O
1167 devices, and a custom BIOS. It can also be compiled to emulate many different
1168 x86 CPUs, from early 386 to the most recent x86-64 Intel and AMD processors.
1169 Bochs can run most Operating Systems inside the emulation including Linux,
1170 DOS or Microsoft Windows.")
1171 (license license:lgpl2.0+)))
1172
1173 (define-public xen
1174 (package
1175 (name "xen")
1176 (version "4.13.0")
1177 (source (origin
1178 (method git-fetch)
1179 (uri (git-reference
1180 (url "git://xenbits.xenproject.org/xen.git")
1181 (commit (string-append "RELEASE-" version))))
1182 (file-name (git-file-name name version))
1183 (sha256
1184 (base32
1185 "0py50n995gv909i0d1lfdcj9wcp5g1d5z6m2291jqqlfyany138g"))))
1186 (build-system gnu-build-system)
1187 (arguments
1188 `(#:configure-flags
1189 (list "--enable-rpath"
1190 "--disable-qemu-traditional" ; It tries to do "git clone"
1191 "--disable-rombios" ; would try to "git clone" via etherboot.
1192 ;; TODO: Re-enable stubdom (it's "more secure" to use it).
1193 "--disable-stubdom" ; tries to "git clone" old patched newlib.
1194 (string-append "--with-initddir="
1195 (assoc-ref %outputs "out")
1196 "/etc/init.d")
1197 (string-append "--with-system-qemu="
1198 (assoc-ref %build-inputs "qemu")
1199 "/bin/qemu-system-i386")
1200 (string-append "--with-system-seabios="
1201 (assoc-ref %build-inputs "seabios")
1202 "/share/firmware/bios.bin")
1203 (string-append "--with-system-ovmf="
1204 (assoc-ref %build-inputs "ovmf")
1205 "/share/firmware/ovmf_ia32.bin"))
1206 #:make-flags (list "-j" "1"
1207 "XEN_BUILD_DATE=Thu Jan 1 01:00:01 CET 1970"
1208 "XEN_BUILD_TIME=01:00:01"
1209 "XEN_BUILD_HOST="
1210 "ETHERBOOT_NICS="
1211 "SMBIOS_REL_DATE=01/01/1970"
1212 "VGABIOS_REL_DATE=01 Jan 1970"
1213 ; QEMU_TRADITIONAL_LOC
1214 ; QEMU_UPSTREAM_LOC
1215 "SYSCONFIG_DIR=/tmp/etc/default"
1216 (string-append "BASH_COMPLETION_DIR="
1217 (assoc-ref %outputs "out")
1218 "/etc/bash_completion.d")
1219 (string-append "BOOT_DIR="
1220 (assoc-ref %outputs "out")
1221 "/boot")
1222 (string-append "DEBUG_DIR="
1223 (assoc-ref %outputs "out")
1224 "/lib/debug")
1225 (string-append "EFI_DIR="
1226 (assoc-ref %outputs "out")
1227 "/lib/efi") ; TODO lib64 ?
1228 "MINIOS_UPSTREAM_URL="
1229 ;(string-append "DISTDIR="
1230 ; (assoc-ref %outputs "out"))
1231 )
1232 #:test-target "test"
1233 #:phases
1234 (modify-phases %standard-phases
1235 (add-after 'unpack 'unpack-mini-os
1236 (lambda* (#:key inputs #:allow-other-keys)
1237 (copy-recursively (assoc-ref inputs "mini-os") "extras/mini-os")
1238 #t))
1239 (add-after 'unpack-mini-os 'patch
1240 (lambda* (#:key inputs outputs #:allow-other-keys)
1241 (substitute* "tools/firmware/Rules.mk"
1242 (("override XEN_TARGET_ARCH = x86_32")
1243 (string-append "override XEN_TARGET_ARCH = x86_32
1244 override CC = " (assoc-ref inputs "cross-gcc") "/bin/i686-linux-gnu-gcc"))
1245 (("^CFLAGS =$")
1246 (string-append "CFLAGS=-I" (assoc-ref inputs "cross-libc")
1247 "/include\n")))
1248 (substitute* "config/x86_32.mk"
1249 (("CFLAGS += -m32 -march=i686")
1250 (string-append "CFLAGS += -march=i686 -I"
1251 (assoc-ref inputs "cross-libc")
1252 "/include")))
1253 ;; /var is not in /gnu/store , so don't try to create it.
1254 (substitute* '("tools/Makefile"
1255 "tools/xenstore/Makefile"
1256 "tools/xenpaging/Makefile")
1257 (("\\$\\(INSTALL_DIR\\) .*XEN_(DUMP|LOG|RUN|LIB|PAGING)_DIR.*")
1258 "\n")
1259 (("\\$\\(INSTALL_DIR\\) .*XEN_(RUN|LIB)_STORED.*")
1260 "\n"))
1261 ;; Prevent xen from creating /etc .
1262 (substitute* "tools/examples/Makefile"
1263 ((" install-readmes") "")
1264 ((" install-configs") ""))
1265 ;; Set rpath.
1266 (substitute* "tools/pygrub/setup.py"
1267 (("library_dirs =")
1268 ; TODO: extra_link_args = ['-Wl,-rpath=/opt/foo'],
1269 (string-append "runtime_library_dirs = ['"
1270 (assoc-ref outputs "out")
1271 "/lib'],\nlibrary_dirs =")))
1272 #t))
1273 (add-before 'configure 'patch-xen-script-directory
1274 (lambda* (#:key outputs #:allow-other-keys)
1275 (substitute* '("configure"
1276 "tools/configure"
1277 "docs/configure")
1278 (("XEN_SCRIPT_DIR=.*")
1279 (string-append "XEN_SCRIPT_DIR="
1280 (assoc-ref outputs "out")
1281 "/etc/xen/scripts")))
1282 #t))
1283 (add-before 'configure 'set-environment-up
1284 (lambda* (#:key make-flags #:allow-other-keys)
1285 (define (cross? x)
1286 (string-contains x "cross-i686-linux"))
1287 (define (filter-environment! filter-predicate
1288 environment-variable-names)
1289 (for-each
1290 (lambda (env-name)
1291 (let* ((env-value (getenv env-name))
1292 (search-path (search-path-as-string->list env-value))
1293 (new-search-path (filter filter-predicate
1294 search-path))
1295 (new-env-value (list->search-path-as-string
1296 new-search-path ":")))
1297 (setenv env-name new-env-value)))
1298 environment-variable-names))
1299 (setenv "CROSS_CPATH" (getenv "CPATH"))
1300 (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
1301 (filter-environment! cross?
1302 '("CROSS_CPATH"
1303 "CROSS_LIBRARY_PATH"))
1304 (filter-environment! (lambda (e) (not (cross? e)))
1305 '("CPATH"
1306 "LIBRARY_PATH"))
1307 ;; Guix tries to be helpful and automatically adds
1308 ;; mini-os-git-checkout/include to the include path,
1309 ;; but actually we don't want it to be there (yet).
1310 (filter-environment! (lambda (e)
1311 (not
1312 (string-contains e
1313 "mini-os-git-checkout")))
1314 '("CPATH"
1315 "LIBRARY_PATH"))
1316 (setenv "EFI_VENDOR" "guix")
1317 #t))
1318 (replace 'build
1319 (lambda* (#:key make-flags #:allow-other-keys)
1320 (apply invoke "make" "world" make-flags))))))
1321 (inputs
1322 `(("acpica" ,acpica) ; TODO: patch iasl invocation.
1323 ("bridge-utils" ,bridge-utils) ; TODO: patch invocations.
1324 ("glib" ,glib)
1325 ("iproute" ,iproute) ; TODO: patch invocations.
1326 ("libaio" ,libaio)
1327 ("libx11" ,libx11)
1328 ("libyajl" ,libyajl)
1329 ("ncurses" ,ncurses)
1330 ("openssl" ,openssl)
1331 ("ovmf" ,ovmf)
1332 ("pixman" ,pixman)
1333 ("qemu" ,qemu-minimal)
1334 ("seabios" ,seabios)
1335 ("util-linux" ,util-linux) ; uuid
1336 ; TODO: ocaml-findlib, ocaml-nox.
1337 ("xz" ,xz) ; for liblzma
1338 ("zlib" ,zlib)))
1339 (native-inputs
1340 `(("dev86" ,dev86)
1341 ("bison" ,bison)
1342 ("cmake" ,cmake-minimal)
1343 ("figlet" ,figlet)
1344 ("flex" ,flex)
1345 ("gettext" ,gettext-minimal)
1346 ("libnl" ,libnl)
1347 ("mini-os"
1348 ,(origin
1349 (method git-fetch)
1350 (uri (git-reference
1351 (url "http://xenbits.xen.org/git-http/mini-os.git")
1352 (commit (string-append "xen-RELEASE-" version))))
1353 (sha256
1354 (base32
1355 "1i8pcl19n60i2m9vlg79q3nknpj209c9ic5x10wxaicx45kc107f"))
1356 (file-name "mini-os-git-checkout")))
1357 ("perl" ,perl)
1358 ; TODO: markdown
1359 ("pkg-config" ,pkg-config)
1360 ("python" ,python-2)
1361 ("wget" ,wget)
1362 ("cross-gcc" ,(cross-gcc "i686-linux-gnu"
1363 #:xbinutils (cross-binutils "i686-linux-gnu")
1364 #:libc (cross-libc "i686-linux-gnu")))
1365 ("cross-libc" ,(cross-libc "i686-linux-gnu")) ; header files
1366 ("cross-libc-static" ,(cross-libc "i686-linux-gnu") "static")))
1367 (home-page "https://xenproject.org/")
1368 (synopsis "Xen Virtual Machine Monitor")
1369 (description "This package provides the Xen Virtual Machine Monitor
1370 which is a hypervisor.")
1371 ;; TODO: Some files are licensed differently. List those.
1372 (license license:gpl2)
1373 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))))
1374
1375 (define-public osinfo-db-tools
1376 (package
1377 (name "osinfo-db-tools")
1378 (version "1.7.0")
1379 (source (origin
1380 (method url-fetch)
1381 (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-tools-"
1382 version ".tar.xz"))
1383
1384 (sha256
1385 (base32
1386 "08x8mrafphyll0d35xdc143rip3ahrz6bmzhc85nwhq7yk2vxpab"))))
1387 (build-system meson-build-system)
1388 (inputs
1389 `(("libsoup" ,libsoup)
1390 ("libxml2" ,libxml2)
1391 ("libxslt" ,libxslt)
1392 ("json-glib" ,json-glib)
1393 ("libarchive" ,libarchive)))
1394 (native-inputs
1395 `(("perl" ,perl)
1396 ("gobject-introspection" ,gobject-introspection)
1397 ("gettext" ,gettext-minimal)
1398 ("pkg-config" ,pkg-config)
1399 ;; Tests
1400 ("python" ,python)
1401 ("pytest" ,python-pytest)
1402 ("requests" ,python-requests)))
1403 (home-page "https://gitlab.com/libosinfo/osinfo-db-tools")
1404 (synopsis "Tools for managing the osinfo database")
1405 (description "This package contains a set of tools to assist
1406 administrators and developers in managing the database.")
1407 (license license:lgpl2.0+)))
1408
1409 (define-public osinfo-db
1410 (package
1411 (name "osinfo-db")
1412 (version "20200203")
1413 (source (origin
1414 (method url-fetch)
1415 (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-"
1416 version ".tar.xz"))
1417 (sha256
1418 (base32
1419 "1zjq1dhlci00j17dij7s3l30hybzmaykpk5b6bd5xbllp745njn5"))))
1420 (build-system trivial-build-system)
1421 (arguments
1422 `(#:modules ((guix build utils))
1423 #:builder
1424 (begin
1425 (use-modules (guix build utils))
1426 (let* ((out (assoc-ref %outputs "out"))
1427 (osinfo-dir (string-append out "/share/osinfo"))
1428 (source (assoc-ref %build-inputs "source"))
1429 (osinfo-db-import
1430 (string-append (assoc-ref %build-inputs "osinfo-db-tools")
1431 "/bin/osinfo-db-import")))
1432 (mkdir-p osinfo-dir)
1433 (invoke osinfo-db-import "--dir" osinfo-dir source)
1434 #t))))
1435 (native-inputs
1436 `(("intltool" ,intltool)
1437 ("osinfo-db-tools" ,osinfo-db-tools)))
1438 (home-page "https://gitlab.com/libosinfo/osinfo-db")
1439 (synopsis "Database of information about operating systems")
1440 (description "Osinfo-db provides the database files for use with the
1441 libosinfo library. It provides information about guest operating systems for
1442 use with virtualization provisioning tools")
1443 (license license:lgpl2.0+)))