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