gnu: libdrm: Switch to meson-build-system.
[jackhill/guix/guix.git] / gnu / packages / virtualization.scm
CommitLineData
b15fcf9e 1;;; GNU Guix --- Functional package management for GNU
589e3f4e 2;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
ecfe88b7 3;;; Copyright © 2015, 2016, 2017, 2018 Mark H Weaver <mhw@netris.org>
49fe965d 4;;; Copyright © 2016, 2017, 2018. 2019 Efraim Flashner <efraim@flashner.co.il>
fe420383 5;;; Copyright © 2016, 2017 Ricardo Wurmus <rekado@elephly.net>
f152208b 6;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
b376ec57 7;;; Copyright © 2017 Andy Patterson <ajpatter@uwaterloo.ca>
64b632f8 8;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
969bbf8b 9;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
0def9120 10;;; Copyright © 2018 Danny Milosavljevic <dannym@scratchpost.org>
de7f03ce 11;;; Copyright © 2018 Sou Bunnbu <iyzsong@member.fsf.org>
f6e55da0 12;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
17043677 13;;; Copyright © 2019 Guy Fleury Iteriteka <hoonandon@gmail.com>
b15fcf9e
LC
14;;;
15;;; This file is part of GNU Guix.
16;;;
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.
21;;;
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.
26;;;
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/>.
29
59132b80 30(define-module (gnu packages virtualization)
161ed547 31 #:use-module (gnu packages)
309693e0 32 #:use-module (gnu packages admin)
35e8900d 33 #:use-module (gnu packages assembly)
efcada41 34 #:use-module (gnu packages attr)
309693e0 35 #:use-module (gnu packages autotools)
ecfe88b7 36 #:use-module (gnu packages bison)
a0f6c3b3 37 #:use-module (gnu packages check)
35e8900d 38 #:use-module (gnu packages cmake)
b15fcf9e 39 #:use-module (gnu packages compression)
35e8900d 40 #:use-module (gnu packages cross-base)
309693e0
RW
41 #:use-module (gnu packages curl)
42 #:use-module (gnu packages cyrus-sasl)
43 #:use-module (gnu packages disk)
8fc7bd23 44 #:use-module (gnu packages dns)
fe420383
RW
45 #:use-module (gnu packages docbook)
46 #:use-module (gnu packages documentation)
35e8900d
DM
47 #:use-module (gnu packages figlet)
48 #:use-module (gnu packages firmware)
ecfe88b7 49 #:use-module (gnu packages flex)
fb9472a3 50 #:use-module (gnu packages fontutils)
16a47f23 51 #:use-module (gnu packages freedesktop)
90a8ef8c 52 #:use-module (gnu packages gettext)
efcada41
DC
53 #:use-module (gnu packages gl)
54 #:use-module (gnu packages glib)
a0f6c3b3 55 #:use-module (gnu packages gnome)
7714a069 56 #:use-module (gnu packages gnupg)
de7f03ce 57 #:use-module (gnu packages golang)
a0f6c3b3 58 #:use-module (gnu packages gtk)
e55354b8 59 #:use-module (gnu packages image)
fb9d7865 60 #:use-module (gnu packages libusb)
efcada41
DC
61 #:use-module (gnu packages linux)
62 #:use-module (gnu packages ncurses)
71d4ba52 63 #:use-module (gnu packages nettle)
fe420383 64 #:use-module (gnu packages networking)
7714a069 65 #:use-module (gnu packages package-management)
06da1a6b 66 #:use-module (gnu packages perl)
efcada41 67 #:use-module (gnu packages pkg-config)
309693e0 68 #:use-module (gnu packages polkit)
fe420383 69 #:use-module (gnu packages protobuf)
efcada41 70 #:use-module (gnu packages python)
589e3f4e 71 #:use-module (gnu packages python-web)
44d10b1f 72 #:use-module (gnu packages python-xyz)
28e3569f 73 #:use-module (gnu packages pulseaudio)
5d4a8f9b 74 #:use-module (gnu packages selinux)
efcada41 75 #:use-module (gnu packages sdl)
38b9ce44 76 #:use-module (gnu packages spice)
efcada41 77 #:use-module (gnu packages texinfo)
71d4ba52 78 #:use-module (gnu packages textutils)
309693e0
RW
79 #:use-module (gnu packages tls)
80 #:use-module (gnu packages web)
35e8900d 81 #:use-module (gnu packages wget)
efcada41 82 #:use-module (gnu packages xdisorg)
309693e0 83 #:use-module (gnu packages xml)
8981465b 84 #:use-module (gnu packages xorg)
6da90719 85 #:use-module (guix build-system cmake)
efcada41 86 #:use-module (guix build-system gnu)
de7f03ce 87 #:use-module (guix build-system go)
7cd2032f 88 #:use-module (guix build-system python)
efcada41 89 #:use-module (guix download)
7714a069 90 #:use-module (guix git-download)
b23b9667 91 #:use-module ((guix licenses) #:prefix license:)
efcada41
DC
92 #:use-module (guix packages)
93 #:use-module (guix utils)
06da1a6b 94 #:use-module (srfi srfi-1))
b15fcf9e 95
e38a71ee
LC
96(define (qemu-patch commit file-name sha256)
97 "Return an origin for COMMIT."
98 (origin
99 (method url-fetch)
100 (uri (string-append
101 "http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h="
102 commit))
103 (sha256 sha256)
104 (file-name file-name)))
105
06da1a6b 106(define-public qemu
b15fcf9e 107 (package
06da1a6b 108 (name "qemu")
6b34499d 109 (version "3.1.0")
b15fcf9e
LC
110 (source (origin
111 (method url-fetch)
2de7d137 112 (uri (string-append "https://download.qemu.org/qemu-"
fbd6fb1a 113 version ".tar.xz"))
11d19ca2
LF
114 (patches (search-patches "qemu-CVE-2018-16872.patch"
115 "qemu-CVE-2019-6778.patch"))
b15fcf9e
LC
116 (sha256
117 (base32
6b34499d 118 "1z5bd5nfyjvhfi1s95labc82y4hjdjjkdabw931362ls0zghh1ba"))))
b15fcf9e
LC
119 (build-system gnu-build-system)
120 (arguments
219b4556
LC
121 '(;; Running tests in parallel can occasionally lead to failures, like:
122 ;; boot_sector_test: assertion failed (signature == SIGNATURE): (0x00000000 == 0x0000dead)
123 #:parallel-tests? #f
0e5d0f66
RH
124 #:configure-flags (list "--enable-usb-redir" "--enable-opengl"
125 (string-append "--smbd="
126 (assoc-ref %outputs "out")
28e3569f
OP
127 "/libexec/samba-wrapper")
128 "--audio-drv-list=alsa,pa,sdl")
05051e8b
LC
129 #:phases
130 (modify-phases %standard-phases
131 (replace 'configure
132 (lambda* (#:key inputs outputs (configure-flags '())
20c263b0 133 #:allow-other-keys)
05051e8b
LC
134 ;; The `configure' script doesn't understand some of the
135 ;; GNU options. Thus, add a new phase that's compatible.
136 (let ((out (assoc-ref outputs "out")))
137 (setenv "SHELL" (which "bash"))
b15fcf9e 138
05051e8b
LC
139 ;; While we're at it, patch for tests.
140 (substitute* "tests/libqtest.c"
141 (("/bin/sh") (which "sh")))
50731c51 142
05051e8b
LC
143 ;; The binaries need to be linked against -lrt.
144 (setenv "LDFLAGS" "-lrt")
642d2db5
TGR
145 (apply invoke
146 `("./configure"
147 ,(string-append "--cc=" (which "gcc"))
148 ;; Some architectures insist on using HOST_CC
149 ,(string-append "--host-cc=" (which "gcc"))
150 "--disable-debug-info" ; save build space
151 "--enable-virtfs" ; just to be sure
152 ,(string-append "--prefix=" out)
153 ,(string-append "--sysconfdir=/etc")
154 ,@configure-flags)))))
05051e8b
LC
155 (add-after 'install 'install-info
156 (lambda* (#:key inputs outputs #:allow-other-keys)
157 ;; Install the Info manual, unless Texinfo is missing.
642d2db5
TGR
158 (when (assoc-ref inputs "texinfo")
159 (let* ((out (assoc-ref outputs "out"))
160 (dir (string-append out "/share/info")))
161 (invoke "make" "info")
162 (for-each (lambda (info)
163 (install-file info dir))
164 (find-files "." "\\.info"))))
165 #t))
0e5d0f66
RH
166 ;; Create a wrapper for Samba. This allows QEMU to use Samba without
167 ;; pulling it in as an input. Note that you need to explicitly install
168 ;; Samba in your Guix profile for Samba support.
169 (add-after 'install-info 'create-samba-wrapper
170 (lambda* (#:key inputs outputs #:allow-other-keys)
171 (let* ((out (assoc-ref %outputs "out"))
172 (libexec (string-append out "/libexec")))
173 (call-with-output-file "samba-wrapper"
174 (lambda (port)
175 (format port "#!/bin/sh
176exec smbd $@")))
177 (chmod "samba-wrapper" #o755)
178 (install-file "samba-wrapper" libexec))
179 #t))
de3bbf65
LC
180 (add-before 'check 'make-gtester-verbose
181 (lambda _
182 ;; Make GTester verbose to facilitate investigation upon failure.
d229ba95 183 (setenv "V" "1") #t))
05051e8b
LC
184 (add-before 'check 'disable-test-qga
185 (lambda _
43bec6d0 186 (substitute* "tests/Makefile.include"
05051e8b
LC
187 ;; Comment out the test-qga test, which needs /sys and
188 ;; fails within the build environment.
189 (("check-unit-.* tests/test-qga" all)
190 (string-append "# " all)))
191 #t)))))
b15fcf9e 192 (inputs ; TODO: Add optional inputs.
2f042822
DC
193 `(("alsa-lib" ,alsa-lib)
194 ("attr" ,attr)
b15fcf9e 195 ("glib" ,glib)
90a8ef8c 196 ("gtk+" ,gtk+)
fa65e84a 197 ("libaio" ,libaio)
2f042822
DC
198 ("libattr" ,attr)
199 ("libcap" ,libcap) ; virtfs support requires libcap & libattr
9a187b39
AP
200 ("libdrm" ,libdrm)
201 ("libepoxy" ,libepoxy)
513885b5 202 ("libjpeg" ,libjpeg-turbo)
2f042822 203 ("libpng" ,libpng)
34a28c13 204 ("libseccomp" ,libseccomp)
2f042822
DC
205 ("libusb" ,libusb) ;USB pass-through support
206 ("mesa" ,mesa)
207 ("ncurses" ,ncurses)
208 ;; ("pciutils" ,pciutils)
2b2fdd45 209 ("pixman" ,pixman)
28e3569f 210 ("pulseaudio" ,pulseaudio)
27b52c1f 211 ("sdl2" ,sdl2)
38b9ce44 212 ("spice" ,spice)
b376ec57 213 ("usbredir" ,usbredir)
b15fcf9e 214 ("util-linux" ,util-linux)
2f042822 215 ;; ("vde2" ,vde2)
38b9ce44 216 ("virglrenderer" ,virglrenderer)
2f042822 217 ("zlib" ,zlib)))
90a8ef8c
RH
218 (native-inputs `(("gettext" ,gettext-minimal)
219 ("glib:bin" ,glib "bin") ; gtester, etc.
2f042822 220 ("perl" ,perl)
ecfe88b7
MW
221 ("flex" ,flex)
222 ("bison" ,bison)
2f042822 223 ("pkg-config" ,pkg-config)
27b52c1f 224 ("python-wrapper" ,python-wrapper)
2f042822 225 ("texinfo" ,texinfo)))
ce9fbae1 226 (home-page "https://www.qemu.org")
06da1a6b 227 (synopsis "Machine emulator and virtualizer")
72b9eebf 228 (description
50731c51 229 "QEMU is a generic machine emulator and virtualizer.
72b9eebf
LC
230
231When used as a machine emulator, QEMU can run OSes and programs made for one
50731c51
LC
232machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
233using dynamic translation, it achieves very good performance.
72b9eebf
LC
234
235When used as a virtualizer, QEMU achieves near native performances by
236executing the guest code directly on the host CPU. QEMU supports
237virtualization when executing under the Xen hypervisor or using
238the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
50731c51
LC
239server and embedded PowerPC, and S390 guests.")
240
241 ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
b23b9667 242 (license license:gpl2)
f47638a3
LC
243
244 ;; Several tests fail on MIPS; see <http://hydra.gnu.org/build/117914>.
245 (supported-systems (delete "mips64el-linux" %supported-systems))))
50731c51 246
06da1a6b
LC
247(define-public qemu-minimal
248 ;; QEMU without GUI support.
249 (package (inherit qemu)
250 (name "qemu-minimal")
251 (synopsis "Machine emulator and virtualizer (without GUI)")
252 (arguments
b376ec57
AP
253 (substitute-keyword-arguments (package-arguments qemu)
254 ((#:configure-flags _ '(list))
255 ;; Restrict to the targets supported by Guix.
256 ''("--target-list=i386-softmmu,x86_64-softmmu,mips64el-softmmu,arm-softmmu,aarch64-softmmu"))))
06da1a6b
LC
257
258 ;; Remove dependencies on optional libraries, notably GUI libraries.
90a8ef8c
RH
259 (native-inputs (fold alist-delete (package-native-inputs qemu)
260 '("gettext")))
06da1a6b 261 (inputs (fold alist-delete (package-inputs qemu)
90a8ef8c 262 '("libusb" "mesa" "sdl2" "spice" "virglrenderer" "gtk+"
28e3569f 263 "usbredir" "libdrm" "libepoxy" "pulseaudio")))))
309693e0 264
27b52c1f
RH
265;; The GRUB test suite fails with later versions of Qemu, so we
266;; keep it at 2.10 for now. See
267;; <https://lists.gnu.org/archive/html/bug-grub/2018-02/msg00004.html>.
268;; This package is hidden since we do not backport updates to it.
269(define-public qemu-minimal-2.10
270 (hidden-package
271 (package
272 (inherit qemu-minimal)
273 (version "2.10.2")
274 (source (origin
275 (method url-fetch)
276 (uri (string-append "https://download.qemu.org/qemu-"
277 version ".tar.xz"))
278 (sha256
279 (base32
3d5ad159
MW
280 "17w21spvaxaidi2am5lpsln8yjpyp2zi3s3gc6nsxj5arlgamzgw"))
281 (patches
282 (search-patches "qemu-glibc-2.27.patch"))))
27b52c1f
RH
283 ;; qemu-minimal-2.10 needs Python 2. Remove below once no longer necessary.
284 (native-inputs `(("python-2" ,python-2)
285 ,@(fold alist-delete (package-native-inputs qemu)
286 '("python-wrapper")))))))
287
a0f6c3b3
RW
288(define-public libosinfo
289 (package
290 (name "libosinfo")
d701f8bd 291 (version "1.0.0")
a0f6c3b3
RW
292 (source
293 (origin
294 (method url-fetch)
d701f8bd 295 (uri (string-append "https://releases.pagure.org/libosinfo/libosinfo-"
a0f6c3b3
RW
296 version ".tar.gz"))
297 (sha256
298 (base32
d701f8bd 299 "0srrs2m6irqd4f867g8ls6jp2dq3ql0l9d0fh80d55sivvn2bd7p"))))
a0f6c3b3
RW
300 (build-system gnu-build-system)
301 (arguments
d701f8bd
RW
302 `(#:configure-flags
303 (list (string-append "--with-usb-ids-path="
304 (assoc-ref %build-inputs "usb.ids"))
305 (string-append "--with-pci-ids-path="
306 (assoc-ref %build-inputs "pci.ids")))
307 #:phases
a0f6c3b3 308 (modify-phases %standard-phases
d701f8bd
RW
309 ;; This odd test fails for unknown reasons.
310 (add-after 'unpack 'disable-broken-test
311 (lambda _
312 (substitute* "test/Makefile.in"
313 (("test-isodetect\\$\\(EXEEXT\\)") ""))
a0f6c3b3
RW
314 #t)))))
315 (inputs
316 `(("libsoup" ,libsoup)
317 ("libxml2" ,libxml2)
318 ("libxslt" ,libxslt)
319 ("gobject-introspection" ,gobject-introspection)))
320 (native-inputs
321 `(("check" ,check)
322 ("glib" ,glib "bin") ; glib-mkenums, etc.
323 ("gtk-doc" ,gtk-doc)
324 ("vala" ,vala)
325 ("intltool" ,intltool)
326 ("pkg-config" ,pkg-config)
327 ("pci.ids"
328 ,(origin
329 (method url-fetch)
d701f8bd 330 (uri "https://github.com/pciutils/pciids/raw/ad02084f0bc143e3c15e31a6152a3dfb1d7a3156/pci.ids")
a0f6c3b3
RW
331 (sha256
332 (base32
d701f8bd 333 "0kfhpj5rnh24hz2714qhfmxk281vwc2w50sm73ggw5d15af7zfsw"))))
a0f6c3b3
RW
334 ("usb.ids"
335 ,(origin
336 (method url-fetch)
0d73f148 337 (uri "https://svn.code.sf.net/p/linux-usb/repo/trunk/htdocs/usb.ids?r=2681")
b02733d4 338 (file-name "usb.ids")
a0f6c3b3
RW
339 (sha256
340 (base32
0d73f148 341 "1m6yhvz5k8aqzxgk7xj3jkk8frl1hbv0h3vgj4wbnvnx79qnvz3r"))))))
a0f6c3b3
RW
342 (home-page "https://libosinfo.org/")
343 (synopsis "Operating system information database")
344 (description "libosinfo is a GObject based library API for managing
345information about operating systems, hypervisors and the (virtual) hardware
346devices they can support. It includes a database containing device metadata
347and provides APIs to match/identify optimal devices for deploying an operating
348system on a hypervisor. Via GObject Introspection, the API is available in
349all common programming languages. Vala bindings are also provided.")
350 ;; The library files are released under LGPLv2.1 or later; the source
351 ;; files in the "tools" directory are released under GPLv2+.
b23b9667 352 (license (list license:lgpl2.1+ license:gpl2+))))
a0f6c3b3 353
5d4a8f9b
SB
354(define-public lxc
355 (package
356 (name "lxc")
cc7058b2 357 (version "3.1.0")
5d4a8f9b
SB
358 (source (origin
359 (method url-fetch)
360 (uri (string-append
361 "https://linuxcontainers.org/downloads/lxc/lxc-"
362 version ".tar.gz"))
363 (sha256
364 (base32
cc7058b2 365 "1igxqgx8q9cp15mcp1y8j564bl85ijw04jcmgb1s5bmfbg1751sd"))))
5d4a8f9b
SB
366 (build-system gnu-build-system)
367 (native-inputs
368 `(("pkg-config" ,pkg-config)))
369 (inputs
370 `(("gnutls" ,gnutls)
371 ("libcap" ,libcap)
372 ("libseccomp" ,libseccomp)
373 ("libselinux" ,libselinux)))
374 (arguments
2e625ef7
TGR
375 `(#:configure-flags
376 (list (string-append "--docdir=" (assoc-ref %outputs "out")
377 "/share/doc/" ,name "-" ,version)
378 "--sysconfdir=/etc"
379 "--localstatedir=/var")
5d4a8f9b
SB
380 #:phases
381 (modify-phases %standard-phases
382 (replace 'install
383 (lambda* (#:key outputs #:allow-other-keys)
384 (let* ((out (assoc-ref outputs "out"))
385 (bashcompdir (string-append out "/etc/bash_completion.d")))
d6870d10 386 (invoke "make" "install"
5d4a8f9b
SB
387 (string-append "bashcompdir=" bashcompdir)
388 ;; Don't install files into /var and /etc.
389 "LXCPATH=/tmp/var/lib/lxc"
390 "localstatedir=/tmp/var"
391 "sysconfdir=/tmp/etc"
d6870d10 392 "sysconfigdir=/tmp/etc/default")))))))
5d4a8f9b
SB
393 (synopsis "Linux container tools")
394 (home-page "https://linuxcontainers.org/")
395 (description
396 "LXC is a userspace interface for the Linux kernel containment features.
397Through a powerful API and simple tools, it lets Linux users easily create and
398manage system or application containers.")
b23b9667 399 (license license:lgpl2.1+)))
5d4a8f9b 400
309693e0
RW
401(define-public libvirt
402 (package
403 (name "libvirt")
8981465b 404 (version "4.10.0")
309693e0
RW
405 (source (origin
406 (method url-fetch)
2e508b6d 407 (uri (string-append "https://libvirt.org/sources/libvirt-"
309693e0
RW
408 version ".tar.xz"))
409 (sha256
410 (base32
8981465b 411 "0v17zzyyb25nn9l18v5244myg7590dp6ppwgi8xysipifc0q77bz"))))
309693e0
RW
412 (build-system gnu-build-system)
413 (arguments
414 `(;; FAIL: virshtest
415 ;; FAIL: virfirewalltest
416 ;; FAIL: virkmodtest
417 ;; FAIL: virnetsockettest
418 ;; FAIL: networkxml2firewalltest
419 ;; FAIL: nwfilterebiptablestest
420 ;; FAIL: nwfilterxml2firewalltest
07378e31 421 ;; Time-out while running commandtest.
309693e0
RW
422 #:tests? #f
423 #:configure-flags
424 (list "--with-polkit"
a4b93921 425 "--sysconfdir=/etc"
309693e0
RW
426 "--localstatedir=/var")
427 #:phases
428 (modify-phases %standard-phases
429 (add-after 'unpack 'fix-tests
430 (lambda _
431 (substitute* '("tests/commandtest.c"
432 "gnulib/tests/test-posix_spawn1.c"
433 "gnulib/tests/test-posix_spawn2.c")
434 (("/bin/sh") (which "sh")))
435 #t))
a4b93921
SB
436 (replace 'install
437 ;; Since the sysconfdir and localstatedir should be /etc and /var
438 ;; at runtime, we must prevent writing to them at installation
439 ;; time.
440 (lambda _
07378e31
TGR
441 (invoke "make" "install"
442 "sysconfdir=/tmp/etc"
443 "localstatedir=/tmp/var")))
903e051a
CB
444 (add-after 'install 'wrap-libvirtd
445 (lambda* (#:key inputs outputs #:allow-other-keys)
446 (let ((out (assoc-ref outputs "out")))
447 (wrap-program (string-append out "/sbin/libvirtd")
448 `("PATH" = (,(string-append (assoc-ref inputs "iproute")
449 "/sbin")
450 ,(string-append (assoc-ref inputs "qemu")
451 "/bin"))))
452 #t))))))
309693e0
RW
453 (inputs
454 `(("libxml2" ,libxml2)
8981465b
RH
455 ("eudev" ,eudev)
456 ("libpciaccess" ,libpciaccess)
309693e0
RW
457 ("gnutls" ,gnutls)
458 ("dbus" ,dbus)
459 ("qemu" ,qemu)
309693e0
RW
460 ("libpcap" ,libpcap)
461 ("libnl" ,libnl)
462 ("libuuid" ,util-linux)
463 ("lvm2" ,lvm2) ; for libdevmapper
464 ("curl" ,curl)
465 ("openssl" ,openssl)
466 ("cyrus-sasl" ,cyrus-sasl)
309693e0 467 ("libyajl" ,libyajl)
8fc7bd23
SB
468 ("audit" ,audit)
469 ("dmidecode" ,dmidecode)
470 ("dnsmasq" ,dnsmasq)
471 ("ebtables" ,ebtables)
472 ("iproute" ,iproute)
473 ("iptables" ,iptables)))
309693e0 474 (native-inputs
2f110b32 475 `(("xsltproc" ,libxslt)
b8fb94d5
TGR
476 ("perl" ,perl)
477 ("pkg-config" ,pkg-config)
478 ("polkit" ,polkit)
35d56c1c 479 ("python" ,python)))
2e508b6d 480 (home-page "https://libvirt.org")
309693e0
RW
481 (synopsis "Simple API for virtualization")
482 (description "Libvirt is a C toolkit to interact with the virtualization
483capabilities of recent versions of Linux. The library aims at providing long
484term stable C API initially for the Xen paravirtualization but should be able
485to integrate other virtualization mechanisms if needed.")
b23b9667 486 (license license:lgpl2.1+)))
597ea122
RW
487
488(define-public libvirt-glib
489 (package
490 (name "libvirt-glib")
c3c03162 491 (version "1.0.0")
597ea122
RW
492 (source (origin
493 (method url-fetch)
494 (uri (string-append "ftp://libvirt.org/libvirt/glib/"
495 "libvirt-glib-" version ".tar.gz"))
496 (sha256
497 (base32
c3c03162 498 "0iwa5sdbii52pjpdm5j37f67sdmf0kpcky4liwhy1nf43k85i4fa"))))
597ea122
RW
499 (build-system gnu-build-system)
500 (arguments
501 `(#:phases
502 (modify-phases %standard-phases
503 (add-after 'unpack 'fix-tests
504 (lambda _
505 (substitute* "tests/test-events.c"
506 (("/bin/true") (which "true")))
507 #t)))))
508 (inputs
509 `(("libxml2" ,libxml2)
510 ("libvirt" ,libvirt)
511 ("gobject-introspection" ,gobject-introspection)
512 ("glib" ,glib)
513 ("openssl" ,openssl)
514 ("cyrus-sasl" ,cyrus-sasl)
515 ("lvm2" ,lvm2) ; for libdevmapper
516 ("libyajl" ,libyajl)))
517 (native-inputs
518 `(("pkg-config" ,pkg-config)
519 ("intltool" ,intltool)
520 ("glib" ,glib "bin")
521 ("vala" ,vala)))
b3fee5c1 522 (home-page "https://libvirt.org")
597ea122
RW
523 (synopsis "GLib wrapper around libvirt")
524 (description "libvirt-glib wraps the libvirt library to provide a
525high-level object-oriented API better suited for glib-based applications, via
526three libraries:
527
528@enumerate
529@item libvirt-glib - GLib main loop integration & misc helper APIs
530@item libvirt-gconfig - GObjects for manipulating libvirt XML documents
531@item libvirt-gobject - GObjects for managing libvirt objects
532@end enumerate
533")
b23b9667 534 (license license:lgpl2.1+)))
7cd2032f
RW
535
536(define-public python-libvirt
537 (package
538 (name "python-libvirt")
d15211c9 539 (version "4.10.0")
7cd2032f
RW
540 (source (origin
541 (method url-fetch)
542 (uri (pypi-uri "libvirt-python" version))
543 (sha256
544 (base32
d15211c9 545 "11fipj9naihgc9afc8bz5hi05xa1shp4qcy170sa18p3sl4zljb9"))))
7cd2032f
RW
546 (build-system python-build-system)
547 (arguments
548 `(#:phases
549 (modify-phases %standard-phases
550 (add-after 'unpack 'patch-nosetests-path
551 (lambda* (#:key inputs #:allow-other-keys)
552 (substitute* "setup.py"
9271dfdd
SB
553 (("\"/usr/bin/nosetests\"")
554 (string-append "\"" (which "nosetests") "\""))
555 (("self\\.spawn\\(\\[sys\\.executable, nose\\]\\)")
556 (format #f "self.spawn([\"~a\", nose])" (which "bash"))))
7cd2032f
RW
557 #t)))))
558 (inputs
482d9591
HG
559 `(("libvirt" ,libvirt)))
560 (propagated-inputs
561 `(("python-lxml" ,python-lxml)))
7cd2032f
RW
562 (native-inputs
563 `(("pkg-config" ,pkg-config)
564 ("python-nose" ,python-nose)))
b3fee5c1 565 (home-page "https://libvirt.org")
7cd2032f
RW
566 (synopsis "Python bindings to libvirt")
567 (description "This package provides Python bindings to the libvirt
568virtualization library.")
b23b9667 569 (license license:lgpl2.1+)))
7cd2032f
RW
570
571(define-public python2-libvirt
572 (package-with-python2 python-libvirt))
2f82b53b
RW
573
574(define-public virt-manager
575 (package
576 (name "virt-manager")
af7014a1 577 (version "2.1.0")
2f82b53b
RW
578 (source (origin
579 (method url-fetch)
580 (uri (string-append "https://virt-manager.org/download/sources"
581 "/virt-manager/virt-manager-"
582 version ".tar.gz"))
583 (sha256
584 (base32
af7014a1 585 "1m038kyngmxlgz91c7z8g73lb2wy0ajyah871a3g3wb5cnd0dsil"))))
2f82b53b
RW
586 (build-system python-build-system)
587 (arguments
af7014a1 588 `(#:use-setuptools? #f ; uses custom distutils 'install' command
2f82b53b
RW
589 ;; Some of the tests seem to require network access to install virtual
590 ;; machines.
591 #:tests? #f
f023685d
AP
592 #:imported-modules ((guix build glib-or-gtk-build-system)
593 ,@%python-build-system-modules)
2f82b53b
RW
594 #:modules ((ice-9 match)
595 (srfi srfi-26)
596 (guix build python-build-system)
f023685d 597 ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
2f82b53b
RW
598 (guix build utils))
599 #:phases
600 (modify-phases %standard-phases
601 (add-after 'unpack 'fix-setup
602 (lambda* (#:key outputs #:allow-other-keys)
603 (substitute* "virtcli/cliconfig.py"
604 (("/usr") (assoc-ref outputs "out")))
605 #t))
4ad8fbd1
AP
606 (add-after 'unpack 'fix-default-uri
607 (lambda* (#:key inputs #:allow-other-keys)
af7014a1 608 ;; Xen is not available for now - so only patch qemu.
4ad8fbd1
AP
609 (substitute* "virtManager/connect.py"
610 (("/usr(/bin/qemu-system)" _ suffix)
611 (string-append (assoc-ref inputs "qemu") suffix)))
612 #t))
2f82b53b
RW
613 (add-before 'wrap 'wrap-with-GI_TYPELIB_PATH
614 (lambda* (#:key inputs outputs #:allow-other-keys)
615 (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
616 (bin-files (find-files bin ".*"))
617 (paths (map (match-lambda
618 ((output . directory)
619 (let* ((girepodir (string-append
620 directory
621 "/lib/girepository-1.0")))
622 (if (file-exists? girepodir)
623 girepodir #f))))
624 inputs)))
625 (for-each (lambda (file)
626 (format #t "wrapping ~a\n" file)
627 (wrap-program file
628 `("GI_TYPELIB_PATH" ":" prefix
629 ,(filter identity paths))))
630 bin-files))
f023685d
AP
631 #t))
632 (add-after 'install 'glib-or-gtk-compile-schemas
633 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
634 (add-after 'install 'glib-or-gtk-wrap
635 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
2f82b53b 636 (inputs
b1e9837a
AP
637 `(("dconf" ,dconf)
638 ("gtk+" ,gtk+)
45214efe 639 ("gtk-vnc" ,gtk-vnc)
2f82b53b
RW
640 ("libvirt" ,libvirt)
641 ("libvirt-glib" ,libvirt-glib)
642 ("libosinfo" ,libosinfo)
45214efe 643 ("vte" ,vte)
2f82b53b 644 ("gobject-introspection" ,gobject-introspection)
f8be7664
RH
645 ("python-libvirt" ,python-libvirt)
646 ("python-requests" ,python-requests)
647 ("python-ipaddress" ,python-ipaddress)
648 ("python-pycairo" ,python-pycairo)
649 ("python-pygobject" ,python-pygobject)
650 ("python-libxml2" ,python-libxml2)
8da7f792 651 ("spice-gtk" ,spice-gtk)))
2f82b53b
RW
652 ;; virt-manager searches for qemu-img or kvm-img in the PATH.
653 (propagated-inputs
654 `(("qemu" ,qemu)))
655 (native-inputs
af7014a1 656 `(("glib" ,glib "bin") ; glib-compile-schemas
e6efcd58 657 ("gtk+" ,gtk+ "bin") ; gtk-update-icon-cache
2f82b53b
RW
658 ("perl" ,perl) ; pod2man
659 ("intltool" ,intltool)))
660 (home-page "https://virt-manager.org/")
661 (synopsis "Manage virtual machines")
662 (description
663 "The virt-manager application is a desktop user interface for managing
664virtual machines through libvirt. It primarily targets KVM VMs, but also
665manages Xen and LXC (Linux containers). It presents a summary view of running
666domains, their live performance and resource utilization statistics.")
b23b9667 667 (license license:gpl2+)))
fe420383
RW
668
669(define-public criu
670 (package
671 (name "criu")
580f33e1 672 (version "3.11")
fe420383
RW
673 (source (origin
674 (method url-fetch)
675 (uri (string-append "http://download.openvz.org/criu/criu-"
676 version ".tar.bz2"))
677 (sha256
678 (base32
580f33e1 679 "03nimyn3wy5mlw30gq7bvlzvvprqjv8f25240yj5arzlld8mhsw8"))))
fe420383
RW
680 (build-system gnu-build-system)
681 (arguments
682 `(#:test-target "test"
683 #:tests? #f ; tests require mounting as root
684 #:make-flags
685 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
686 (string-append "LIBDIR=" (assoc-ref %outputs "out")
687 "/lib"))
688 #:phases
689 (modify-phases %standard-phases
690 (replace 'configure
691 (lambda* (#:key inputs #:allow-other-keys)
692 ;; The includes for libnl are located in a sub-directory.
693 (setenv "C_INCLUDE_PATH"
694 (string-append (assoc-ref inputs "libnl")
695 "/include/libnl3:"
696 (getenv "C_INCLUDE_PATH")))
697 ;; Prevent xmlto from failing the install phase.
698 (substitute* "Documentation/Makefile"
699 (("XMLTO.*:=.*")
700 (string-append "XMLTO:="
701 (assoc-ref inputs "xmlto")
702 "/bin/xmlto"
703 " --skip-validation "
704 " -x "
705 (assoc-ref inputs "docbook-xsl")
706 "/xml/xsl/docbook-xsl-"
707 ,(package-version docbook-xsl)
580f33e1
EF
708 "/manpages/docbook.xsl"))
709 (("\\$\\(XMLTO\\);")
710 (string-append (assoc-ref inputs "xmlto")
711 "/bin/xmlto;")))
712 #t))
713 (add-after 'unpack 'hardcode-variables
714 (lambda* (#:key inputs #:allow-other-keys)
715 ;; Hardcode arm version detection
716 (substitute* "Makefile"
717 (("ARMV.*:=.*") "ARMV := 7\n"))
718 ;; We are currently using python-2
719 (substitute* "crit/Makefile"
720 (("\\$\\(PYTHON\\)") "python2"))
721 (substitute* "lib/Makefile"
722 (("\\$\\(PYTHON\\)")
723 (string-append (assoc-ref inputs "python")
724 "/bin/python")))
fe420383
RW
725 #t))
726 (add-before 'build 'fix-symlink
727 (lambda* (#:key inputs #:allow-other-keys)
728 ;; The file 'images/google/protobuf/descriptor.proto' points to
729 ;; /usr/include/..., which obviously does not exist.
730 (let* ((file "google/protobuf/descriptor.proto")
731 (target (string-append "images/" file))
732 (source (string-append (assoc-ref inputs "protobuf")
733 "/include/" file)))
734 (delete-file target)
735 (symlink source target)
736 #t)))
737 (add-after 'install 'wrap
738 (lambda* (#:key inputs outputs #:allow-other-keys)
739 ;; Make sure 'crit' runs with the correct PYTHONPATH.
740 (let* ((out (assoc-ref outputs "out"))
741 (path (string-append out
742 "/lib/python"
743 (string-take (string-take-right
744 (assoc-ref inputs "python") 5) 3)
745 "/site-packages:"
746 (getenv "PYTHONPATH"))))
747 (wrap-program (string-append out "/bin/crit")
748 `("PYTHONPATH" ":" prefix (,path))))
749 #t)))))
750 (inputs
751 `(("protobuf" ,protobuf)
752 ("python" ,python-2)
753 ("python2-protobuf" ,python2-protobuf)
754 ("python2-ipaddr" ,python2-ipaddr)
755 ("iproute" ,iproute)
756 ("libaio" ,libaio)
757 ("libcap" ,libcap)
758 ("libnet" ,libnet)
759 ("libnl" ,libnl)))
760 (native-inputs
761 `(("pkg-config" ,pkg-config)
3bf94bc8 762 ("perl" ,perl)
fe420383
RW
763 ("protobuf-c" ,protobuf-c)
764 ("asciidoc" ,asciidoc)
765 ("xmlto" ,xmlto)
766 ("docbook-xml" ,docbook-xml)
767 ("docbook-xsl" ,docbook-xsl)))
768 (home-page "https://criu.org")
769 (synopsis "Checkpoint and restore in user space")
770 (description "Using this tool, you can freeze a running application (or
771part of it) and checkpoint it to a hard drive as a collection of files. You
772can then use the files to restore and run the application from the point it
773was frozen at. The distinctive feature of the CRIU project is that it is
774mainly implemented in user space.")
775 ;; The project is licensed under GPLv2; files in the lib/ directory are
776 ;; LGPLv2.1.
b23b9667 777 (license (list license:gpl2 license:lgpl2.1))))
f46a3523
RH
778
779(define-public qmpbackup
780 (package
781 (name "qmpbackup")
782 (version "0.2")
783 (source (origin
784 (method url-fetch)
785 (uri (string-append "https://github.com/abbbi/qmpbackup/archive/"
786 version ".tar.gz"))
787 (sha256
788 (base32
789 "10k9mnb1yrg4gw1rvz4kw4dxc4aajl8gnjrpm3axqkg63qmxj3qn"))
790 (file-name (string-append name "-" version ".tar.gz"))))
791 (build-system python-build-system)
792 (arguments
793 `(#:python ,python-2))
794 (home-page "https://github.com/abbbi/qmpbackup")
795 (synopsis "Backup and restore QEMU machines")
796 (description "qmpbackup is designed to create and restore full and
797incremental backups of running QEMU virtual machines via QMP, the QEMU
798Machine Protocol.")
b23b9667 799 (license license:gpl3+)))
fb9472a3 800
c9d2d310
RH
801(define-public looking-glass-client
802 (let ((commit "182c4752d57690da7f99d5e788de9b8baea33895"))
16a47f23 803 (package
c9d2d310 804 (name "looking-glass-client")
16a47f23
RH
805 (version (string-append "a12-" (string-take commit 7)))
806 (source
807 (origin
808 (method git-fetch)
809 (uri (git-reference (url "https://github.com/gnif/LookingGlass")
810 (commit commit)))
811 (file-name (git-file-name name version))
812 (sha256
813 (base32
c9d2d310 814 "02bq46ndmzq9cihazzn7xq1x7q5nzm7iw4l9lqzihxcxp9famkhw"))))
16a47f23
RH
815 (build-system cmake-build-system)
816 (inputs `(("fontconfig" ,fontconfig)
817 ("glu" ,glu)
818 ("mesa" ,mesa)
819 ("openssl" ,openssl)
820 ("sdl2" ,sdl2)
821 ("sdl2-ttf" ,sdl2-ttf)
822 ("spice-protocol" ,spice-protocol)
823 ("wayland" ,wayland)))
824 (native-inputs `(("libconfig" ,libconfig)
825 ("nettle" ,nettle)
826 ("pkg-config" ,pkg-config)))
827 (arguments
828 `(#:tests? #f ;; No tests are available.
829 #:make-flags '("CC=gcc")
830 #:phases (modify-phases %standard-phases
831 (add-before 'configure 'chdir-to-client
832 (lambda* (#:key outputs #:allow-other-keys)
833 (chdir "client")
834 #t))
835 (replace 'install
836 (lambda* (#:key outputs #:allow-other-keys)
837 (install-file "looking-glass-client"
838 (string-append (assoc-ref outputs "out")
839 "/bin"))
840 #t))
841 )))
842 (home-page "https://looking-glass.hostfission.com")
843 (synopsis "KVM Frame Relay (KVMFR) implementation")
844 (description "Looking Glass allows the use of a KVM (Kernel-based Virtual
fb9472a3
RH
845Machine) configured for VGA PCI Pass-through without an attached physical
846monitor, keyboard or mouse. It displays the VM's rendered contents on your main
847monitor/GPU.")
16a47f23
RH
848 ;; This package requires SSE instructions.
849 (supported-systems '("i686-linux" "x86_64-linux"))
850 (license license:gpl2+))))
de7f03ce 851
c9d2d310
RH
852(define-public lookingglass
853 (deprecated-package "lookingglass" looking-glass-client))
854
de7f03ce
SB
855(define-public runc
856 (package
857 (name "runc")
ce4593ec 858 (version "1.0.0-rc6")
de7f03ce
SB
859 (source (origin
860 (method url-fetch)
861 (uri (string-append
862 "https://github.com/opencontainers/runc/releases/"
863 "download/v" version "/runc.tar.xz"))
ce4593ec
LF
864 (file-name (string-append name "-" version ".tar.xz"))
865 (patches (search-patches "runc-CVE-2019-5736.patch"))
de7f03ce
SB
866 (sha256
867 (base32
ce4593ec 868 "1c7832dq70slkjh8qp2civ1wxhhdd2hrx84pq7db1mmqc9fdr3cc"))))
de7f03ce
SB
869 (build-system go-build-system)
870 (arguments
871 '(#:import-path "github.com/opencontainers/runc"
872 #:install-source? #f
03e45891
SB
873 ;; XXX: 20/139 tests fail due to missing /var, cgroups and apparmor in
874 ;; the build environment.
875 #:tests? #f
de7f03ce
SB
876 #:phases
877 (modify-phases %standard-phases
878 (replace 'unpack
879 (lambda* (#:key source import-path #:allow-other-keys)
880 ;; Unpack the tarball into 'runc' instead of 'runc-1.0.0-rc5'.
881 (let ((dest (string-append "src/" import-path)))
882 (mkdir-p dest)
883 (invoke "tar" "-C" (string-append "src/" import-path)
884 "--strip-components=1"
885 "-xvf" source))))
886 (replace 'build
887 (lambda* (#:key import-path #:allow-other-keys)
888 (chdir (string-append "src/" import-path))
889 ;; XXX: requires 'go-md2man'.
890 ;; (invoke "make" "man")
891 (invoke "make")))
892 ;; (replace 'check
893 ;; (lambda _
894 ;; (invoke "make" "localunittest")))
895 (replace 'install
896 (lambda* (#:key outputs #:allow-other-keys)
897 (let ((out (assoc-ref outputs "out")))
898 (invoke "make" "install" "install-bash"
899 (string-append "PREFIX=" out))))))))
900 (native-inputs
901 `(("pkg-config" ,pkg-config)))
902 (inputs
903 `(("libseccomp" ,libseccomp)))
904 (synopsis "Open container initiative runtime")
905 (home-page "https://www.opencontainers.org/")
906 (description
907 "@command{runc} is a command line client for running applications
908packaged according to the
909@uref{https://github.com/opencontainers/runtime-spec/blob/master/spec.md, Open
910Container Initiative (OCI) format} and is a compliant implementation of the
911Open Container Initiative specification.")
b23b9667 912 (license license:asl2.0)))
efdaf8de
SB
913
914(define-public umoci
915 (package
916 (name "umoci")
9d58e881 917 (version "0.4.4")
efdaf8de
SB
918 (source (origin
919 (method url-fetch)
920 (uri (string-append
921 "https://github.com/openSUSE/umoci/releases/download/v"
922 version "/umoci.tar.xz"))
923 (file-name (string-append "umoci-" version ".tar.xz"))
924 (sha256
925 (base32
9d58e881 926 "1wchmha5k2f370jfijmx9fqp0cp99zfa9ajmfbq3j24qc8p5k8lk"))))
efdaf8de
SB
927 (build-system go-build-system)
928 (arguments
929 '(#:import-path "github.com/openSUSE/umoci"
930 #:install-source? #f
931 #:phases
932 (modify-phases %standard-phases
933 (replace 'unpack
934 (lambda* (#:key source import-path #:allow-other-keys)
935 ;; Unpack the tarball into 'umoci' instead of "runc-${version}".
936 (let ((dest (string-append "src/" import-path)))
937 (mkdir-p dest)
938 (invoke "tar" "-C" (string-append "src/" import-path)
939 "--strip-components=1"
940 "-xvf" source))))
941 (replace 'build
942 (lambda* (#:key import-path #:allow-other-keys)
943 (chdir (string-append "src/" import-path))
944 ;; TODO: build manpages with 'go-md2man'.
945 (invoke "make" "SHELL=bash")))
946 (replace 'install
947 (lambda* (#:key outputs #:allow-other-keys)
948 (let* ((out (assoc-ref outputs "out"))
949 (bindir (string-append out "/bin")))
950 (install-file "umoci" bindir)
951 #t))))))
952 (home-page "https://umo.ci/")
953 (synopsis "Tool for modifying Open Container images")
954 (description
955 "@command{umoci} is a tool that allows for high-level modification of an
956Open Container Initiative (OCI) image layout and its tagged images.")
b23b9667 957 (license license:asl2.0)))
7714a069
SB
958
959(define-public skopeo
960 (package
961 (name "skopeo")
962 (version "0.1.28")
963 (source (origin
964 (method git-fetch)
965 (uri (git-reference
966 (url "https://github.com/projectatomic/skopeo")
967 (commit (string-append "v" version))))
968 (file-name (git-file-name name version))
969 (sha256
970 (base32
971 "068nwrr3nr27alravcq1sxyhdd5jjr24213vdgn1dqva3885gbi0"))))
972 (build-system go-build-system)
973 (native-inputs
974 `(("pkg-config" ,pkg-config)))
975 (inputs
976 `(("btrfs-progs" ,btrfs-progs)
977 ("eudev" ,eudev)
978 ("libassuan" ,libassuan)
979 ("libselinux" ,libselinux)
980 ("libostree" ,libostree)
981 ("lvm2" ,lvm2)
982 ("glib" ,glib)
983 ("gpgme" ,gpgme)))
984 (arguments
985 '(#:import-path "github.com/projectatomic/skopeo"
986 #:install-source? #f
987 #:phases
988 (modify-phases %standard-phases
989 (replace 'build
990 (lambda* (#:key import-path #:allow-other-keys)
991 (chdir (string-append "src/" import-path))
992 ;; TODO: build manpages with 'go-md2man'.
993 (invoke "make" "binary-local")))
994 (replace 'install
995 (lambda* (#:key outputs #:allow-other-keys)
996 (let ((out (assoc-ref outputs "out")))
997 (invoke "make" "install-binary" "install-completions"
998 (string-append "PREFIX=" out))))))))
999 (home-page "https://github.com/projectatomic/skopeo")
1000 (synopsis "Interact with container images and container image registries")
1001 (description
1002 "@command{skopeo} is a command line utility providing various operations
1003with container images and container image registries. It can:
1004@enumerate
1005
1006@item Copy container images between various containers image stores,
1007converting them as necessary.
1008
1009@item Convert a Docker schema 2 or schema 1 container image to an OCI image.
1010
1011@item Inspect a repository on a container registry without needlessly pulling
1012the image.
1013
1014@item Sign and verify container images.
1015
1016@item Delete container images from a remote container registry.
1017
1018@end enumerate")
b23b9667 1019 (license license:asl2.0)))
5e95181b
EF
1020
1021(define-public python-vagrant
1022 (package
1023 (name "python-vagrant")
1024 (version "0.5.15")
1025 (source
1026 (origin
1027 (method url-fetch)
1028 (uri (pypi-uri "python-vagrant" version))
1029 (sha256
1030 (base32
1031 "1ikrh6canhcxg5y7pzmkcnnydikppv7s6sm9prfx90nk0ac8m6mg"))))
1032 (build-system python-build-system)
1033 (arguments
1034 '(#:tests? #f)) ; tests involve running vagrant.
1035 (home-page "https://github.com/todddeluca/python-vagrant")
1036 (synopsis "Python bindings for Vagrant")
1037 (description
1038 "Python-vagrant is a Python module that provides a thin wrapper around the
1039@code{vagrant} command line executable, allowing programmatic control of Vagrant
1040virtual machines.")
1041 (license license:expat)))
f6e55da0
JL
1042
1043(define-public bubblewrap
1044 (package
1045 (name "bubblewrap")
1046 (version "0.3.1")
1047 (source (origin
1048 (method url-fetch)
1049 (uri (string-append "https://github.com/projectatomic/bubblewrap/"
1050 "releases/download/v" version "/bubblewrap-"
1051 version ".tar.xz"))
1052 (sha256
1053 (base32
1054 "1y2bdlxnlr84xcbf31lzirc292c5ak9bd2wvcvh4ppsliih6pjny"))))
1055 (build-system gnu-build-system)
1056 (arguments
1057 `(#:phases
1058 (modify-phases %standard-phases
1059 (add-after 'unpack 'fix-test
1060 (lambda* (#:key outputs #:allow-other-keys)
1061 ;; Tests try to access /var/tmp, which is not possible in our build
1062 ;; environment. Let's give them another directory.
1063 ;; /tmp gets overriden in some tests, so we need another directory.
1064 ;; the only possibility is the output directory.
1065 (let ((tmp-dir (string-append (assoc-ref outputs "out") "/tmp")))
1066 (mkdir-p tmp-dir)
1067 (substitute* "tests/test-run.sh"
1068 (("/var/tmp") tmp-dir)
1069 ;; Tests create a temporary python script, so fix its shebang.
1070 (("/usr/bin/env python") (which "python"))
1071 ;; Some tests try to access /usr, but that doesn't exist.
1072 ;; Give them /gnu instead.
1073 (("/usr") "/gnu")
1074 ((" */bin/bash") (which "bash"))
1075 (("/bin/sh") (which "sh"))
1076 (("findmnt") (which "findmnt"))))
1077 #t))
1078 ;; Remove the directory we gave to tests to have a clean package.
1079 (add-after 'check 'remove-tmp-dir
1080 (lambda* (#:key outputs #:allow-other-keys)
1081 (delete-file-recursively (string-append (assoc-ref outputs "out") "/tmp"))
1082 #t)))))
1083 (inputs
1084 `(("libcap" ,libcap)))
1085 (native-inputs
1086 `(("python-2" ,python-2)
1087 ("util-linux" ,util-linux)))
1088 (home-page "https://github.com/projectatomic/bubblewrap")
1089 (synopsis "Unprivileged sandboxing tool")
1090 (description "Bubblewrap is aimed at running applications in a sandbox,
1091where it has restricted access to parts of the operating system or user data
1092such as the home directory. Bubblewrap always creates a new mount namespace,
1093and the user can specify exactly what parts of the filesystem should be visible
1094in the sandbox. Any such directories specified is mounted nodev by default,
1095and can be made readonly.")
1096 (license license:lgpl2.0+)))
17043677 1097
1098(define-public bochs
1099 (package
1100 (name "bochs")
1101 (version "2.6.9")
1102 (source
1103 (origin
1104 (method url-fetch)
1105 (uri (string-append "https://sourceforge.net/projects/bochs/files/bochs/"
1106 version "/bochs-" version ".tar.gz"))
1107 (sha256
1108 (base32
1109 "1379cq4cnfprhw8mgh60i0q9j8fz8d7n3d5fnn2g9fdiv5znfnzf"))))
1110 (build-system gnu-build-system)
1111 (arguments
1112 `(#:tests? #f)) ; No tests exist
1113 (inputs
1114 `(("libxrandr" ,libxrandr)))
1115 (home-page "http://bochs.sourceforge.net/")
1116 (synopsis "Emulator for x86 PC")
1117 (description
1118 "Bochs is an emulator which can emulate Intel x86 CPU, common I/O
1119devices, and a custom BIOS. It can also be compiled to emulate many different
1120x86 CPUs, from early 386 to the most recent x86-64 Intel and AMD processors.
1121Bochs can run most Operating Systems inside the emulation including Linux,
1122DOS or Microsoft Windows.")
1123 (license license:lgpl2.0+)))
35e8900d 1124
35e8900d
DM
1125(define-public xen
1126 (package
1127 (name "xen")
1128 (version "4.11.1")
1129 (source (origin
1130 (method git-fetch)
1131 (uri (git-reference
1132 (url "git://xenbits.xenproject.org/xen.git")
1133 (commit (string-append "RELEASE-" version))))
1134 (file-name (git-file-name name version))
1135 (sha256
1136 (base32
1137 "1wv1hyfii14vi9lfjmnv07h2gpm3b7kvh2p55f4yy2b40simksgk"))))
1138 (build-system gnu-build-system)
1139 (arguments
1140 `(#:configure-flags
1141 (list "--enable-rpath"
1142 "--disable-qemu-traditional" ; It tries to do "git clone"
1143 "--disable-rombios" ; would try to "git clone" via etherboot.
35e8900d
DM
1144 ;; TODO: Re-enable stubdom (it's "more secure" to use it).
1145 "--disable-stubdom" ; tries to "git clone" old patched newlib.
1146 (string-append "--with-initddir="
1147 (assoc-ref %outputs "out")
1148 "/etc/init.d")
1149 (string-append "--with-system-qemu="
1150 (assoc-ref %build-inputs "qemu")
1151 "/bin/qemu-system-i386")
1152 (string-append "--with-system-seabios="
1153 (assoc-ref %build-inputs "seabios")
1154 "/share/firmware/bios.bin")
1155 (string-append "--with-system-ovmf="
1156 (assoc-ref %build-inputs "ovmf")
1157 "/share/firmware/ovmf_ia32.bin"))
1158 #:make-flags (list "-j" "1"
1159 "XEN_BUILD_DATE=Thu Jan 1 01:00:01 CET 1970"
1160 "XEN_BUILD_TIME=01:00:01"
1161 "XEN_BUILD_HOST="
1162 "ETHERBOOT_NICS="
1163 "SMBIOS_REL_DATE=01/01/1970"
1164 "VGABIOS_REL_DATE=01 Jan 1970"
1165 ; QEMU_TRADITIONAL_LOC
1166 ; QEMU_UPSTREAM_LOC
1167 "SYSCONFIG_DIR=/tmp/etc/default"
1168 (string-append "BASH_COMPLETION_DIR="
1169 (assoc-ref %outputs "out")
1170 "/etc/bash_completion.d")
1171 (string-append "BOOT_DIR="
1172 (assoc-ref %outputs "out")
1173 "/boot")
1174 (string-append "DEBUG_DIR="
1175 (assoc-ref %outputs "out")
1176 "/lib/debug")
1177 (string-append "EFI_DIR="
1178 (assoc-ref %outputs "out")
1179 "/lib/efi") ; TODO lib64 ?
1180 "MINIOS_UPSTREAM_URL="
1181 ;(string-append "DISTDIR="
1182 ; (assoc-ref %outputs "out"))
1183)
1184 #:test-target "test"
1185 #:phases
1186 (modify-phases %standard-phases
1187 (add-after 'unpack 'unpack-mini-os
1188 (lambda* (#:key inputs #:allow-other-keys)
1189 (copy-recursively (assoc-ref inputs "mini-os") "extras/mini-os")
1190 #t))
1191 (add-after 'unpack-mini-os 'patch
1192 (lambda* (#:key inputs outputs #:allow-other-keys)
1193 (substitute* "tools/firmware/Rules.mk"
1194 (("override XEN_TARGET_ARCH = x86_32")
1195 (string-append "override XEN_TARGET_ARCH = x86_32
1196override CC = " (assoc-ref inputs "cross-gcc") "/bin/i686-linux-gnu-gcc"))
1197 (("^CFLAGS =$")
1198 (string-append "CFLAGS=-I" (assoc-ref inputs "cross-libc")
1199 "/include\n")))
1200 (substitute* "config/x86_32.mk"
1201 (("CFLAGS += -m32 -march=i686")
1202 (string-append "CFLAGS += -march=i686 -I"
1203 (assoc-ref inputs "cross-libc")
1204 "/include")))
35e8900d
DM
1205 ;; /var is not in /gnu/store , so don't try to create it.
1206 (substitute* '("tools/Makefile"
1207 "tools/xenstore/Makefile"
1208 "tools/xenpaging/Makefile")
1209 (("\\$\\(INSTALL_DIR\\) .*XEN_(DUMP|LOG|RUN|LIB|PAGING)_DIR.*")
1210 "\n")
1211 (("\\$\\(INSTALL_DIR\\) .*XEN_(RUN|LIB)_STORED.*")
1212 "\n"))
1213 ;; Prevent xen from creating /etc .
1214 (substitute* "tools/examples/Makefile"
1215 ((" install-readmes") "")
1216 ((" install-configs") ""))
1217 ;; Set rpath.
1218 (substitute* "tools/pygrub/setup.py"
1219 (("library_dirs =")
1220 ; TODO: extra_link_args = ['-Wl,-rpath=/opt/foo'],
1221 (string-append "runtime_library_dirs = ['"
1222 (assoc-ref outputs "out")
1223 "/lib'],\nlibrary_dirs =")))
1224 #t))
1225 (add-before 'configure 'patch-xen-script-directory
1226 (lambda* (#:key outputs #:allow-other-keys)
1227 (substitute* '("configure"
1228 "tools/configure"
1229 "docs/configure")
1230 (("XEN_SCRIPT_DIR=.*")
1231 (string-append "XEN_SCRIPT_DIR="
1232 (assoc-ref outputs "out")
1233 "/etc/xen/scripts")))
1234 #t))
1235 (add-before 'configure 'set-environment-up
1236 (lambda* (#:key make-flags #:allow-other-keys)
1237 (define (cross? x)
1238 (string-contains x "cross-i686-linux"))
1239 (define (filter-environment! filter-predicate
1240 environment-variable-names)
1241 (for-each
1242 (lambda (env-name)
1243 (let* ((env-value (getenv env-name))
1244 (search-path (search-path-as-string->list env-value))
1245 (new-search-path (filter filter-predicate
1246 search-path))
1247 (new-env-value (list->search-path-as-string
1248 new-search-path ":")))
1249 (setenv env-name new-env-value)))
1250 environment-variable-names))
1251 (setenv "CROSS_C_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
1252 (setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
1253 (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
1254 (filter-environment! cross?
1255 '("CROSS_C_INCLUDE_PATH" "CROSS_CPLUS_INCLUDE_PATH"
1256 "CROSS_LIBRARY_PATH"))
1257 (filter-environment! (lambda (e) (not (cross? e)))
1258 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
1259 "LIBRARY_PATH"))
1260 ;; Guix tries to be helpful and automatically adds
1261 ;; mini-os-git-checkout/include to the include path,
1262 ;; but actually we don't want it to be there (yet).
1263 (filter-environment! (lambda (e)
1264 (not
1265 (string-contains e
1266 "mini-os-git-checkout")))
1267 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
1268 "LIBRARY_PATH"))
1269 (setenv "EFI_VENDOR" "guix")
1270 #t))
1271 (replace 'build
1272 (lambda* (#:key make-flags #:allow-other-keys)
1273 (apply invoke "make" "world" make-flags))))))
1274 (inputs
1275 `(("acpica" ,acpica) ; TODO: patch iasl invocation.
1276 ("bridge-utils" ,bridge-utils) ; TODO: patch invocations.
1277 ("glib" ,glib)
1278 ("iproute" ,iproute) ; TODO: patch invocations.
1279 ("libaio" ,libaio)
1280 ("libx11" ,libx11)
1281 ("libyajl" ,libyajl)
1282 ("ncurses" ,ncurses)
1283 ("openssl" ,openssl)
1284 ("ovmf" ,ovmf)
1285 ("pixman" ,pixman)
1286 ("qemu" ,qemu-minimal)
1287 ("seabios" ,seabios)
1288 ("util-linux" ,util-linux) ; uuid
1289 ; TODO: ocaml-findlib, ocaml-nox.
1290 ("xz" ,xz) ; for liblzma
1291 ("zlib" ,zlib)))
1292 (native-inputs
1293 `(("dev86" ,dev86)
1294 ("bison" ,bison)
1295 ("cmake" ,cmake)
1296 ("figlet" ,figlet)
1297 ("flex" ,flex)
1298 ("gettext" ,gettext-minimal)
1299 ("libnl" ,libnl)
1300 ("mini-os"
1301 ,(origin
1302 (method git-fetch)
1303 (uri (git-reference
1304 (url "http://xenbits.xen.org/git-http/mini-os.git")
1305 (commit (string-append "xen-RELEASE-" version))))
1306 (sha256
1307 (base32
1308 "1i8pcl19n60i2m9vlg79q3nknpj209c9ic5x10wxaicx45kc107f"))
1309 (file-name "mini-os-git-checkout")))
1310 ("perl" ,perl)
1311 ; TODO: markdown
1312 ("pkg-config" ,pkg-config)
1313 ("python" ,python-2)
1314 ("wget" ,wget)
1315 ("cross-gcc" ,(cross-gcc "i686-linux-gnu"
1316 #:xbinutils (cross-binutils "i686-linux-gnu")
1317 #:libc (cross-libc "i686-linux-gnu")))
1318 ("cross-libc" ,(cross-libc "i686-linux-gnu")) ; header files
1319 ("cross-libc-static" ,(cross-libc "i686-linux-gnu") "static")))
1320 (home-page "https://xenproject.org/")
1321 (synopsis "Xen Virtual Machine Monitor")
1322 (description "This package provides the Xen Virtual Machine Monitor
1323which is a hypervisor.")
1324 ;; TODO: Some files are licensed differently. List those.
1325 (license license:gpl2)
1326 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))))