gnu: Fix common unquote typos.
[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>
b02733d4 3;;; Copyright © 2015, 2016, 2017 Mark H Weaver <mhw@netris.org>
9ca19727 4;;; Copyright © 2016, 2017 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>
34a28c13 8;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
07378e31 9;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
b15fcf9e
LC
10;;;
11;;; This file is part of GNU Guix.
12;;;
13;;; GNU Guix is free software; you can redistribute it and/or modify it
14;;; under the terms of the GNU General Public License as published by
15;;; the Free Software Foundation; either version 3 of the License, or (at
16;;; your option) any later version.
17;;;
18;;; GNU Guix is distributed in the hope that it will be useful, but
19;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;;; GNU General Public License for more details.
22;;;
23;;; You should have received a copy of the GNU General Public License
24;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
59132b80 26(define-module (gnu packages virtualization)
161ed547 27 #:use-module (gnu packages)
309693e0 28 #:use-module (gnu packages admin)
efcada41 29 #:use-module (gnu packages attr)
309693e0 30 #:use-module (gnu packages autotools)
a0f6c3b3 31 #:use-module (gnu packages check)
b15fcf9e 32 #:use-module (gnu packages compression)
309693e0
RW
33 #:use-module (gnu packages curl)
34 #:use-module (gnu packages cyrus-sasl)
35 #:use-module (gnu packages disk)
8fc7bd23 36 #:use-module (gnu packages dns)
fe420383
RW
37 #:use-module (gnu packages docbook)
38 #:use-module (gnu packages documentation)
fb9472a3 39 #:use-module (gnu packages fontutils)
efcada41
DC
40 #:use-module (gnu packages gl)
41 #:use-module (gnu packages glib)
a0f6c3b3
RW
42 #:use-module (gnu packages gnome)
43 #:use-module (gnu packages gtk)
e55354b8 44 #:use-module (gnu packages image)
fb9d7865 45 #:use-module (gnu packages libusb)
efcada41
DC
46 #:use-module (gnu packages linux)
47 #:use-module (gnu packages ncurses)
fe420383 48 #:use-module (gnu packages networking)
06da1a6b 49 #:use-module (gnu packages perl)
efcada41 50 #:use-module (gnu packages pkg-config)
309693e0 51 #:use-module (gnu packages polkit)
fe420383 52 #:use-module (gnu packages protobuf)
efcada41 53 #:use-module (gnu packages python)
589e3f4e 54 #:use-module (gnu packages python-web)
28e3569f 55 #:use-module (gnu packages pulseaudio)
5d4a8f9b 56 #:use-module (gnu packages selinux)
efcada41 57 #:use-module (gnu packages sdl)
38b9ce44 58 #:use-module (gnu packages spice)
efcada41 59 #:use-module (gnu packages texinfo)
309693e0
RW
60 #:use-module (gnu packages tls)
61 #:use-module (gnu packages web)
efcada41 62 #:use-module (gnu packages xdisorg)
309693e0 63 #:use-module (gnu packages xml)
efcada41 64 #:use-module (guix build-system gnu)
7cd2032f 65 #:use-module (guix build-system python)
efcada41 66 #:use-module (guix download)
f46a3523 67 #:use-module ((guix licenses) #:select (gpl2 gpl2+ gpl3+ lgpl2.1 lgpl2.1+))
efcada41
DC
68 #:use-module (guix packages)
69 #:use-module (guix utils)
06da1a6b 70 #:use-module (srfi srfi-1))
b15fcf9e 71
e38a71ee
LC
72(define (qemu-patch commit file-name sha256)
73 "Return an origin for COMMIT."
74 (origin
75 (method url-fetch)
76 (uri (string-append
77 "http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h="
78 commit))
79 (sha256 sha256)
80 (file-name file-name)))
81
06da1a6b 82(define-public qemu
b15fcf9e 83 (package
06da1a6b 84 (name "qemu")
5fa6b52a 85 (version "2.11.1")
b15fcf9e
LC
86 (source (origin
87 (method url-fetch)
2de7d137 88 (uri (string-append "https://download.qemu.org/qemu-"
fbd6fb1a 89 version ".tar.xz"))
b15fcf9e
LC
90 (sha256
91 (base32
5fa6b52a 92 "11l6cs6mib16rgdrnqrhkqs033fjik316gkgfz3asbmxz38lalca"))))
b15fcf9e
LC
93 (build-system gnu-build-system)
94 (arguments
219b4556
LC
95 '(;; Running tests in parallel can occasionally lead to failures, like:
96 ;; boot_sector_test: assertion failed (signature == SIGNATURE): (0x00000000 == 0x0000dead)
97 #:parallel-tests? #f
0e5d0f66
RH
98 #:configure-flags (list "--enable-usb-redir" "--enable-opengl"
99 (string-append "--smbd="
100 (assoc-ref %outputs "out")
28e3569f
OP
101 "/libexec/samba-wrapper")
102 "--audio-drv-list=alsa,pa,sdl")
05051e8b
LC
103 #:phases
104 (modify-phases %standard-phases
105 (replace 'configure
106 (lambda* (#:key inputs outputs (configure-flags '())
20c263b0 107 #:allow-other-keys)
05051e8b
LC
108 ;; The `configure' script doesn't understand some of the
109 ;; GNU options. Thus, add a new phase that's compatible.
110 (let ((out (assoc-ref outputs "out")))
111 (setenv "SHELL" (which "bash"))
b15fcf9e 112
05051e8b
LC
113 ;; While we're at it, patch for tests.
114 (substitute* "tests/libqtest.c"
115 (("/bin/sh") (which "sh")))
50731c51 116
05051e8b
LC
117 ;; The binaries need to be linked against -lrt.
118 (setenv "LDFLAGS" "-lrt")
119 (zero?
120 (apply system*
121 `("./configure"
122 ,(string-append "--cc=" (which "gcc"))
d229ba95
EF
123 ;; Some architectures insist on using HOST_CC
124 ,(string-append "--host-cc=" (which "gcc"))
05051e8b
LC
125 "--disable-debug-info" ; save build space
126 "--enable-virtfs" ; just to be sure
127 ,(string-append "--prefix=" out)
aaba1204 128 ,(string-append "--sysconfdir=/etc")
05051e8b
LC
129 ,@configure-flags))))))
130 (add-after 'install 'install-info
131 (lambda* (#:key inputs outputs #:allow-other-keys)
132 ;; Install the Info manual, unless Texinfo is missing.
133 (or (not (assoc-ref inputs "texinfo"))
134 (let ((out (assoc-ref outputs "out")))
135 (and (zero? (system* "make" "info"))
136 (let ((infodir (string-append out "/share/info")))
05051e8b 137 (for-each (lambda (info)
8489d79d 138 (install-file info infodir))
1e347214 139 (find-files "." "\\.info"))
05051e8b 140 #t))))))
0e5d0f66
RH
141 ;; Create a wrapper for Samba. This allows QEMU to use Samba without
142 ;; pulling it in as an input. Note that you need to explicitly install
143 ;; Samba in your Guix profile for Samba support.
144 (add-after 'install-info 'create-samba-wrapper
145 (lambda* (#:key inputs outputs #:allow-other-keys)
146 (let* ((out (assoc-ref %outputs "out"))
147 (libexec (string-append out "/libexec")))
148 (call-with-output-file "samba-wrapper"
149 (lambda (port)
150 (format port "#!/bin/sh
151exec smbd $@")))
152 (chmod "samba-wrapper" #o755)
153 (install-file "samba-wrapper" libexec))
154 #t))
de3bbf65
LC
155 (add-before 'check 'make-gtester-verbose
156 (lambda _
157 ;; Make GTester verbose to facilitate investigation upon failure.
d229ba95 158 (setenv "V" "1") #t))
05051e8b
LC
159 (add-before 'check 'disable-test-qga
160 (lambda _
43bec6d0 161 (substitute* "tests/Makefile.include"
05051e8b
LC
162 ;; Comment out the test-qga test, which needs /sys and
163 ;; fails within the build environment.
164 (("check-unit-.* tests/test-qga" all)
165 (string-append "# " all)))
166 #t)))))
b15fcf9e 167 (inputs ; TODO: Add optional inputs.
2f042822
DC
168 `(("alsa-lib" ,alsa-lib)
169 ("attr" ,attr)
b15fcf9e 170 ("glib" ,glib)
fa65e84a 171 ("libaio" ,libaio)
2f042822
DC
172 ("libattr" ,attr)
173 ("libcap" ,libcap) ; virtfs support requires libcap & libattr
9a187b39
AP
174 ("libdrm" ,libdrm)
175 ("libepoxy" ,libepoxy)
513885b5 176 ("libjpeg" ,libjpeg-turbo)
2f042822 177 ("libpng" ,libpng)
34a28c13 178 ("libseccomp" ,libseccomp)
2f042822
DC
179 ("libusb" ,libusb) ;USB pass-through support
180 ("mesa" ,mesa)
181 ("ncurses" ,ncurses)
182 ;; ("pciutils" ,pciutils)
2b2fdd45 183 ("pixman" ,pixman)
28e3569f 184 ("pulseaudio" ,pulseaudio)
2f042822 185 ("sdl" ,sdl)
38b9ce44 186 ("spice" ,spice)
b376ec57 187 ("usbredir" ,usbredir)
b15fcf9e 188 ("util-linux" ,util-linux)
2f042822 189 ;; ("vde2" ,vde2)
38b9ce44 190 ("virglrenderer" ,virglrenderer)
2f042822
DC
191 ("zlib" ,zlib)))
192 (native-inputs `(("glib:bin" ,glib "bin") ; gtester, etc.
193 ("perl" ,perl)
194 ("pkg-config" ,pkg-config)
c4c4cc05 195 ("python" ,python-2) ; incompatible with Python 3 according to error message
2f042822 196 ("texinfo" ,texinfo)))
ce9fbae1 197 (home-page "https://www.qemu.org")
06da1a6b 198 (synopsis "Machine emulator and virtualizer")
72b9eebf 199 (description
50731c51 200 "QEMU is a generic machine emulator and virtualizer.
72b9eebf
LC
201
202When used as a machine emulator, QEMU can run OSes and programs made for one
50731c51
LC
203machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
204using dynamic translation, it achieves very good performance.
72b9eebf
LC
205
206When used as a virtualizer, QEMU achieves near native performances by
207executing the guest code directly on the host CPU. QEMU supports
208virtualization when executing under the Xen hypervisor or using
209the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
50731c51
LC
210server and embedded PowerPC, and S390 guests.")
211
212 ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
f47638a3
LC
213 (license gpl2)
214
215 ;; Several tests fail on MIPS; see <http://hydra.gnu.org/build/117914>.
216 (supported-systems (delete "mips64el-linux" %supported-systems))))
50731c51 217
06da1a6b
LC
218(define-public qemu-minimal
219 ;; QEMU without GUI support.
220 (package (inherit qemu)
221 (name "qemu-minimal")
222 (synopsis "Machine emulator and virtualizer (without GUI)")
223 (arguments
b376ec57
AP
224 (substitute-keyword-arguments (package-arguments qemu)
225 ((#:configure-flags _ '(list))
226 ;; Restrict to the targets supported by Guix.
227 ''("--target-list=i386-softmmu,x86_64-softmmu,mips64el-softmmu,arm-softmmu,aarch64-softmmu"))))
06da1a6b
LC
228
229 ;; Remove dependencies on optional libraries, notably GUI libraries.
230 (inputs (fold alist-delete (package-inputs qemu)
b376ec57 231 '("libusb" "mesa" "sdl" "spice" "virglrenderer"
28e3569f 232 "usbredir" "libdrm" "libepoxy" "pulseaudio")))))
309693e0 233
a0f6c3b3
RW
234(define-public libosinfo
235 (package
236 (name "libosinfo")
d701f8bd 237 (version "1.0.0")
a0f6c3b3
RW
238 (source
239 (origin
240 (method url-fetch)
d701f8bd 241 (uri (string-append "https://releases.pagure.org/libosinfo/libosinfo-"
a0f6c3b3
RW
242 version ".tar.gz"))
243 (sha256
244 (base32
d701f8bd 245 "0srrs2m6irqd4f867g8ls6jp2dq3ql0l9d0fh80d55sivvn2bd7p"))))
a0f6c3b3
RW
246 (build-system gnu-build-system)
247 (arguments
d701f8bd
RW
248 `(#:configure-flags
249 (list (string-append "--with-usb-ids-path="
250 (assoc-ref %build-inputs "usb.ids"))
251 (string-append "--with-pci-ids-path="
252 (assoc-ref %build-inputs "pci.ids")))
253 #:phases
a0f6c3b3 254 (modify-phases %standard-phases
d701f8bd
RW
255 ;; This odd test fails for unknown reasons.
256 (add-after 'unpack 'disable-broken-test
257 (lambda _
258 (substitute* "test/Makefile.in"
259 (("test-isodetect\\$\\(EXEEXT\\)") ""))
a0f6c3b3
RW
260 #t)))))
261 (inputs
262 `(("libsoup" ,libsoup)
263 ("libxml2" ,libxml2)
264 ("libxslt" ,libxslt)
265 ("gobject-introspection" ,gobject-introspection)))
266 (native-inputs
267 `(("check" ,check)
268 ("glib" ,glib "bin") ; glib-mkenums, etc.
269 ("gtk-doc" ,gtk-doc)
270 ("vala" ,vala)
271 ("intltool" ,intltool)
272 ("pkg-config" ,pkg-config)
273 ("pci.ids"
274 ,(origin
275 (method url-fetch)
d701f8bd 276 (uri "https://github.com/pciutils/pciids/raw/ad02084f0bc143e3c15e31a6152a3dfb1d7a3156/pci.ids")
a0f6c3b3
RW
277 (sha256
278 (base32
d701f8bd 279 "0kfhpj5rnh24hz2714qhfmxk281vwc2w50sm73ggw5d15af7zfsw"))))
a0f6c3b3
RW
280 ("usb.ids"
281 ,(origin
282 (method url-fetch)
d701f8bd 283 (uri "http://linux-usb.cvs.sourceforge.net/viewvc/linux-usb/htdocs/usb.ids?revision=1.551")
b02733d4 284 (file-name "usb.ids")
a0f6c3b3
RW
285 (sha256
286 (base32
d701f8bd 287 "17rg5i0wbyk289gr8v4kgvnc9q5bidz7ldcvv9x58l083wn16hq3"))))))
a0f6c3b3
RW
288 (home-page "https://libosinfo.org/")
289 (synopsis "Operating system information database")
290 (description "libosinfo is a GObject based library API for managing
291information about operating systems, hypervisors and the (virtual) hardware
292devices they can support. It includes a database containing device metadata
293and provides APIs to match/identify optimal devices for deploying an operating
294system on a hypervisor. Via GObject Introspection, the API is available in
295all common programming languages. Vala bindings are also provided.")
296 ;; The library files are released under LGPLv2.1 or later; the source
297 ;; files in the "tools" directory are released under GPLv2+.
298 (license (list lgpl2.1+ gpl2+))))
299
5d4a8f9b
SB
300(define-public lxc
301 (package
302 (name "lxc")
56295c51 303 (version "2.1.1")
5d4a8f9b
SB
304 (source (origin
305 (method url-fetch)
306 (uri (string-append
307 "https://linuxcontainers.org/downloads/lxc/lxc-"
308 version ".tar.gz"))
309 (sha256
310 (base32
56295c51 311 "1xpghrinxhm2072fwmn42pxhjwh7qx6cbsipw4s6g38a8mkklrk8"))))
5d4a8f9b
SB
312 (build-system gnu-build-system)
313 (native-inputs
314 `(("pkg-config" ,pkg-config)))
315 (inputs
316 `(("gnutls" ,gnutls)
317 ("libcap" ,libcap)
318 ("libseccomp" ,libseccomp)
319 ("libselinux" ,libselinux)))
320 (arguments
321 '(#:configure-flags
322 '("--sysconfdir=/etc"
323 "--localstatedir=/var")
324 #:phases
325 (modify-phases %standard-phases
326 (replace 'install
327 (lambda* (#:key outputs #:allow-other-keys)
328 (let* ((out (assoc-ref outputs "out"))
329 (bashcompdir (string-append out "/etc/bash_completion.d")))
330 (zero? (system*
331 "make" "install"
332 (string-append "bashcompdir=" bashcompdir)
333 ;; Don't install files into /var and /etc.
334 "LXCPATH=/tmp/var/lib/lxc"
335 "localstatedir=/tmp/var"
336 "sysconfdir=/tmp/etc"
337 "sysconfigdir=/tmp/etc/default"))))))))
338 (synopsis "Linux container tools")
339 (home-page "https://linuxcontainers.org/")
340 (description
341 "LXC is a userspace interface for the Linux kernel containment features.
342Through a powerful API and simple tools, it lets Linux users easily create and
343manage system or application containers.")
344 (license lgpl2.1+)))
345
309693e0
RW
346(define-public libvirt
347 (package
348 (name "libvirt")
07378e31 349 (version "4.0.0")
309693e0
RW
350 (source (origin
351 (method url-fetch)
2e508b6d 352 (uri (string-append "https://libvirt.org/sources/libvirt-"
309693e0
RW
353 version ".tar.xz"))
354 (sha256
355 (base32
07378e31 356 "1j6zzajh4j3zzsaqn5f5mrchm0590xcf6rzkfajvqw3bd4dcms79"))))
309693e0
RW
357 (build-system gnu-build-system)
358 (arguments
359 `(;; FAIL: virshtest
360 ;; FAIL: virfirewalltest
361 ;; FAIL: virkmodtest
362 ;; FAIL: virnetsockettest
363 ;; FAIL: networkxml2firewalltest
364 ;; FAIL: nwfilterebiptablestest
365 ;; FAIL: nwfilterxml2firewalltest
07378e31 366 ;; Time-out while running commandtest.
309693e0
RW
367 #:tests? #f
368 #:configure-flags
369 (list "--with-polkit"
a4b93921 370 "--sysconfdir=/etc"
309693e0
RW
371 "--localstatedir=/var")
372 #:phases
373 (modify-phases %standard-phases
374 (add-after 'unpack 'fix-tests
375 (lambda _
376 (substitute* '("tests/commandtest.c"
377 "gnulib/tests/test-posix_spawn1.c"
378 "gnulib/tests/test-posix_spawn2.c")
379 (("/bin/sh") (which "sh")))
380 #t))
a4b93921
SB
381 (replace 'install
382 ;; Since the sysconfdir and localstatedir should be /etc and /var
383 ;; at runtime, we must prevent writing to them at installation
384 ;; time.
385 (lambda _
07378e31
TGR
386 (invoke "make" "install"
387 "sysconfdir=/tmp/etc"
388 "localstatedir=/tmp/var")))
903e051a
CB
389 (add-after 'install 'wrap-libvirtd
390 (lambda* (#:key inputs outputs #:allow-other-keys)
391 (let ((out (assoc-ref outputs "out")))
392 (wrap-program (string-append out "/sbin/libvirtd")
393 `("PATH" = (,(string-append (assoc-ref inputs "iproute")
394 "/sbin")
395 ,(string-append (assoc-ref inputs "qemu")
396 "/bin"))))
397 #t))))))
309693e0
RW
398 (inputs
399 `(("libxml2" ,libxml2)
400 ("gnutls" ,gnutls)
401 ("dbus" ,dbus)
402 ("qemu" ,qemu)
309693e0
RW
403 ("libpcap" ,libpcap)
404 ("libnl" ,libnl)
405 ("libuuid" ,util-linux)
406 ("lvm2" ,lvm2) ; for libdevmapper
407 ("curl" ,curl)
408 ("openssl" ,openssl)
409 ("cyrus-sasl" ,cyrus-sasl)
309693e0 410 ("libyajl" ,libyajl)
8fc7bd23
SB
411 ("audit" ,audit)
412 ("dmidecode" ,dmidecode)
413 ("dnsmasq" ,dnsmasq)
414 ("ebtables" ,ebtables)
415 ("iproute" ,iproute)
416 ("iptables" ,iptables)))
309693e0 417 (native-inputs
2f110b32 418 `(("xsltproc" ,libxslt)
b8fb94d5
TGR
419 ("perl" ,perl)
420 ("pkg-config" ,pkg-config)
421 ("polkit" ,polkit)
422 ("python" ,python-2)))
2e508b6d 423 (home-page "https://libvirt.org")
309693e0
RW
424 (synopsis "Simple API for virtualization")
425 (description "Libvirt is a C toolkit to interact with the virtualization
426capabilities of recent versions of Linux. The library aims at providing long
427term stable C API initially for the Xen paravirtualization but should be able
428to integrate other virtualization mechanisms if needed.")
429 (license lgpl2.1+)))
597ea122
RW
430
431(define-public libvirt-glib
432 (package
433 (name "libvirt-glib")
c3c03162 434 (version "1.0.0")
597ea122
RW
435 (source (origin
436 (method url-fetch)
437 (uri (string-append "ftp://libvirt.org/libvirt/glib/"
438 "libvirt-glib-" version ".tar.gz"))
439 (sha256
440 (base32
c3c03162 441 "0iwa5sdbii52pjpdm5j37f67sdmf0kpcky4liwhy1nf43k85i4fa"))))
597ea122
RW
442 (build-system gnu-build-system)
443 (arguments
444 `(#:phases
445 (modify-phases %standard-phases
446 (add-after 'unpack 'fix-tests
447 (lambda _
448 (substitute* "tests/test-events.c"
449 (("/bin/true") (which "true")))
450 #t)))))
451 (inputs
452 `(("libxml2" ,libxml2)
453 ("libvirt" ,libvirt)
454 ("gobject-introspection" ,gobject-introspection)
455 ("glib" ,glib)
456 ("openssl" ,openssl)
457 ("cyrus-sasl" ,cyrus-sasl)
458 ("lvm2" ,lvm2) ; for libdevmapper
459 ("libyajl" ,libyajl)))
460 (native-inputs
461 `(("pkg-config" ,pkg-config)
462 ("intltool" ,intltool)
463 ("glib" ,glib "bin")
464 ("vala" ,vala)))
b3fee5c1 465 (home-page "https://libvirt.org")
597ea122
RW
466 (synopsis "GLib wrapper around libvirt")
467 (description "libvirt-glib wraps the libvirt library to provide a
468high-level object-oriented API better suited for glib-based applications, via
469three libraries:
470
471@enumerate
472@item libvirt-glib - GLib main loop integration & misc helper APIs
473@item libvirt-gconfig - GObjects for manipulating libvirt XML documents
474@item libvirt-gobject - GObjects for managing libvirt objects
475@end enumerate
476")
477 (license lgpl2.1+)))
7cd2032f
RW
478
479(define-public python-libvirt
480 (package
481 (name "python-libvirt")
864f2f0e 482 (version "3.7.0")
7cd2032f
RW
483 (source (origin
484 (method url-fetch)
485 (uri (pypi-uri "libvirt-python" version))
486 (sha256
487 (base32
864f2f0e 488 "0vy0ai8z88yhzqfk1n08z1gda5flrqxcw9lg1012b3zg125qljhy"))))
7cd2032f
RW
489 (build-system python-build-system)
490 (arguments
491 `(#:phases
492 (modify-phases %standard-phases
493 (add-after 'unpack 'patch-nosetests-path
494 (lambda* (#:key inputs #:allow-other-keys)
495 (substitute* "setup.py"
9271dfdd
SB
496 (("\"/usr/bin/nosetests\"")
497 (string-append "\"" (which "nosetests") "\""))
498 (("self\\.spawn\\(\\[sys\\.executable, nose\\]\\)")
499 (format #f "self.spawn([\"~a\", nose])" (which "bash"))))
7cd2032f
RW
500 #t)))))
501 (inputs
482d9591
HG
502 `(("libvirt" ,libvirt)))
503 (propagated-inputs
504 `(("python-lxml" ,python-lxml)))
7cd2032f
RW
505 (native-inputs
506 `(("pkg-config" ,pkg-config)
507 ("python-nose" ,python-nose)))
b3fee5c1 508 (home-page "https://libvirt.org")
7cd2032f
RW
509 (synopsis "Python bindings to libvirt")
510 (description "This package provides Python bindings to the libvirt
511virtualization library.")
512 (license lgpl2.1+)))
513
514(define-public python2-libvirt
515 (package-with-python2 python-libvirt))
2f82b53b
RW
516
517(define-public virt-manager
518 (package
519 (name "virt-manager")
3b5870aa 520 (version "1.4.3")
2f82b53b
RW
521 (source (origin
522 (method url-fetch)
523 (uri (string-append "https://virt-manager.org/download/sources"
524 "/virt-manager/virt-manager-"
525 version ".tar.gz"))
526 (sha256
527 (base32
3b5870aa 528 "093azs8p4p7y4nf5j25xpsvdxww7gky1g0hs8mkcvmpxl2wjd0jj"))))
2f82b53b
RW
529 (build-system python-build-system)
530 (arguments
531 `(#:python ,python-2
5834a405 532 #:use-setuptools? #f ; Uses custom distutils 'install' command.
2f82b53b
RW
533 ;; Some of the tests seem to require network access to install virtual
534 ;; machines.
535 #:tests? #f
f023685d
AP
536 #:imported-modules ((guix build glib-or-gtk-build-system)
537 ,@%python-build-system-modules)
2f82b53b
RW
538 #:modules ((ice-9 match)
539 (srfi srfi-26)
540 (guix build python-build-system)
f023685d 541 ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
2f82b53b
RW
542 (guix build utils))
543 #:phases
544 (modify-phases %standard-phases
545 (add-after 'unpack 'fix-setup
546 (lambda* (#:key outputs #:allow-other-keys)
547 (substitute* "virtcli/cliconfig.py"
548 (("/usr") (assoc-ref outputs "out")))
549 #t))
4ad8fbd1
AP
550 (add-after 'unpack 'fix-default-uri
551 (lambda* (#:key inputs #:allow-other-keys)
552 ;; xen is not available for now - so only patch qemu
553 (substitute* "virtManager/connect.py"
554 (("/usr(/bin/qemu-system)" _ suffix)
555 (string-append (assoc-ref inputs "qemu") suffix)))
556 #t))
2f82b53b
RW
557 (add-before 'wrap 'wrap-with-GI_TYPELIB_PATH
558 (lambda* (#:key inputs outputs #:allow-other-keys)
559 (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
560 (bin-files (find-files bin ".*"))
561 (paths (map (match-lambda
562 ((output . directory)
563 (let* ((girepodir (string-append
564 directory
565 "/lib/girepository-1.0")))
566 (if (file-exists? girepodir)
567 girepodir #f))))
568 inputs)))
569 (for-each (lambda (file)
570 (format #t "wrapping ~a\n" file)
571 (wrap-program file
572 `("GI_TYPELIB_PATH" ":" prefix
573 ,(filter identity paths))))
574 bin-files))
f023685d
AP
575 #t))
576 (add-after 'install 'glib-or-gtk-compile-schemas
577 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
578 (add-after 'install 'glib-or-gtk-wrap
579 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
2f82b53b 580 (inputs
b1e9837a
AP
581 `(("dconf" ,dconf)
582 ("gtk+" ,gtk+)
45214efe 583 ("gtk-vnc" ,gtk-vnc)
2f82b53b
RW
584 ("libvirt" ,libvirt)
585 ("libvirt-glib" ,libvirt-glib)
586 ("libosinfo" ,libosinfo)
45214efe 587 ("vte" ,vte)
2f82b53b
RW
588 ("gobject-introspection" ,gobject-introspection)
589 ("python2-libvirt" ,python2-libvirt)
590 ("python2-requests" ,python2-requests)
591 ("python2-ipaddr" ,python2-ipaddr)
b764a9f5 592 ("python2-pycairo" ,python2-pycairo)
2f82b53b 593 ("python2-pygobject" ,python2-pygobject)
8da7f792
AP
594 ("python2-libxml2" ,python2-libxml2)
595 ("spice-gtk" ,spice-gtk)))
2f82b53b
RW
596 ;; virt-manager searches for qemu-img or kvm-img in the PATH.
597 (propagated-inputs
598 `(("qemu" ,qemu)))
599 (native-inputs
600 `(("glib" ,glib "bin") ; glib-compile-schemas.
e6efcd58 601 ("gtk+" ,gtk+ "bin") ; gtk-update-icon-cache
2f82b53b
RW
602 ("perl" ,perl) ; pod2man
603 ("intltool" ,intltool)))
604 (home-page "https://virt-manager.org/")
605 (synopsis "Manage virtual machines")
606 (description
607 "The virt-manager application is a desktop user interface for managing
608virtual machines through libvirt. It primarily targets KVM VMs, but also
609manages Xen and LXC (Linux containers). It presents a summary view of running
610domains, their live performance and resource utilization statistics.")
611 (license gpl2+)))
fe420383
RW
612
613(define-public criu
614 (package
615 (name "criu")
bd971438 616 (version "3.7")
fe420383
RW
617 (source (origin
618 (method url-fetch)
619 (uri (string-append "http://download.openvz.org/criu/criu-"
620 version ".tar.bz2"))
621 (sha256
622 (base32
bd971438 623 "0qrpz7pvnks34v7d8lb73flz3mb7qwnib94pdwaxh0mskn8470fq"))))
fe420383
RW
624 (build-system gnu-build-system)
625 (arguments
626 `(#:test-target "test"
627 #:tests? #f ; tests require mounting as root
628 #:make-flags
629 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
630 (string-append "LIBDIR=" (assoc-ref %outputs "out")
631 "/lib"))
632 #:phases
633 (modify-phases %standard-phases
634 (replace 'configure
635 (lambda* (#:key inputs #:allow-other-keys)
636 ;; The includes for libnl are located in a sub-directory.
637 (setenv "C_INCLUDE_PATH"
638 (string-append (assoc-ref inputs "libnl")
639 "/include/libnl3:"
640 (getenv "C_INCLUDE_PATH")))
641 ;; Prevent xmlto from failing the install phase.
642 (substitute* "Documentation/Makefile"
643 (("XMLTO.*:=.*")
644 (string-append "XMLTO:="
645 (assoc-ref inputs "xmlto")
646 "/bin/xmlto"
647 " --skip-validation "
648 " -x "
649 (assoc-ref inputs "docbook-xsl")
650 "/xml/xsl/docbook-xsl-"
651 ,(package-version docbook-xsl)
652 "/manpages/docbook.xsl")))
653 #t))
654 (add-before 'build 'fix-symlink
655 (lambda* (#:key inputs #:allow-other-keys)
656 ;; The file 'images/google/protobuf/descriptor.proto' points to
657 ;; /usr/include/..., which obviously does not exist.
658 (let* ((file "google/protobuf/descriptor.proto")
659 (target (string-append "images/" file))
660 (source (string-append (assoc-ref inputs "protobuf")
661 "/include/" file)))
662 (delete-file target)
663 (symlink source target)
664 #t)))
665 (add-after 'install 'wrap
666 (lambda* (#:key inputs outputs #:allow-other-keys)
667 ;; Make sure 'crit' runs with the correct PYTHONPATH.
668 (let* ((out (assoc-ref outputs "out"))
669 (path (string-append out
670 "/lib/python"
671 (string-take (string-take-right
672 (assoc-ref inputs "python") 5) 3)
673 "/site-packages:"
674 (getenv "PYTHONPATH"))))
675 (wrap-program (string-append out "/bin/crit")
676 `("PYTHONPATH" ":" prefix (,path))))
677 #t)))))
678 (inputs
679 `(("protobuf" ,protobuf)
680 ("python" ,python-2)
681 ("python2-protobuf" ,python2-protobuf)
682 ("python2-ipaddr" ,python2-ipaddr)
683 ("iproute" ,iproute)
684 ("libaio" ,libaio)
685 ("libcap" ,libcap)
686 ("libnet" ,libnet)
687 ("libnl" ,libnl)))
688 (native-inputs
689 `(("pkg-config" ,pkg-config)
3bf94bc8 690 ("perl" ,perl)
fe420383
RW
691 ("protobuf-c" ,protobuf-c)
692 ("asciidoc" ,asciidoc)
693 ("xmlto" ,xmlto)
694 ("docbook-xml" ,docbook-xml)
695 ("docbook-xsl" ,docbook-xsl)))
696 (home-page "https://criu.org")
697 (synopsis "Checkpoint and restore in user space")
698 (description "Using this tool, you can freeze a running application (or
699part of it) and checkpoint it to a hard drive as a collection of files. You
700can then use the files to restore and run the application from the point it
701was frozen at. The distinctive feature of the CRIU project is that it is
702mainly implemented in user space.")
703 ;; The project is licensed under GPLv2; files in the lib/ directory are
704 ;; LGPLv2.1.
705 (license (list gpl2 lgpl2.1))))
f46a3523
RH
706
707(define-public qmpbackup
708 (package
709 (name "qmpbackup")
710 (version "0.2")
711 (source (origin
712 (method url-fetch)
713 (uri (string-append "https://github.com/abbbi/qmpbackup/archive/"
714 version ".tar.gz"))
715 (sha256
716 (base32
717 "10k9mnb1yrg4gw1rvz4kw4dxc4aajl8gnjrpm3axqkg63qmxj3qn"))
718 (file-name (string-append name "-" version ".tar.gz"))))
719 (build-system python-build-system)
720 (arguments
721 `(#:python ,python-2))
722 (home-page "https://github.com/abbbi/qmpbackup")
723 (synopsis "Backup and restore QEMU machines")
724 (description "qmpbackup is designed to create and restore full and
725incremental backups of running QEMU virtual machines via QMP, the QEMU
726Machine Protocol.")
727 (license gpl3+)))
fb9472a3
RH
728
729(define-public lookingglass
730 (package
731 (name "lookingglass")
d77f2bd8 732 (version "a10")
fb9472a3
RH
733 (source
734 (origin
735 (method url-fetch)
736 (uri (string-append "https://github.com/gnif/LookingGlass/archive/"
737 version ".tar.gz"))
738 (file-name (string-append name "-" version))
739 (sha256
740 (base32
d77f2bd8 741 "0zlxg9ibzr0a598wr5nl1pb4l7mzsqn8ip72v4frph0vwsm5il6c"))))
fb9472a3
RH
742 (build-system gnu-build-system)
743 (inputs `(("fontconfig" ,fontconfig)
744 ("glu" ,glu)
745 ("mesa" ,mesa)
746 ("openssl" ,openssl)
747 ("sdl2" ,sdl2)
748 ("sdl2-ttf" ,sdl2-ttf)
749 ("spice-protocol" ,spice-protocol)))
c695fb76 750 (native-inputs `(("pkg-config" ,pkg-config)))
fb9472a3
RH
751 (arguments
752 `(#:tests? #f ;; No tests are available.
753 #:phases (modify-phases %standard-phases
754 (replace 'configure
755 (lambda* (#:key outputs #:allow-other-keys)
756 (chdir "client")
757 #t))
758 (replace 'install
759 (lambda* (#:key outputs #:allow-other-keys)
760 (install-file "bin/looking-glass-client"
761 (string-append (assoc-ref outputs "out")
762 "/bin"))
763 #t)))))
764 (home-page "https://looking-glass.hostfission.com")
765 (synopsis "KVM Frame Relay (KVMFR) implementation")
766 (description "Looking Glass allows the use of a KVM (Kernel-based Virtual
767Machine) configured for VGA PCI Pass-through without an attached physical
768monitor, keyboard or mouse. It displays the VM's rendered contents on your main
769monitor/GPU.")
25504aaf
EF
770 ;; This package requires SSE instructions.
771 (supported-systems '("i686-linux" "x86_64-linux"))
fb9472a3 772 (license gpl2+)))