gnu: OpenSSH: Update to 7.9p1.
[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>
5e95181b 4;;; Copyright © 2016, 2017, 2018 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>
27b52c1f 8;;; Copyright © 2017, 2018 Rutger Helling <rhelling@mykolab.com>
07378e31 9;;; Copyright © 2017, 2018 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>
b15fcf9e
LC
12;;;
13;;; This file is part of GNU Guix.
14;;;
15;;; GNU Guix is free software; you can redistribute it and/or modify it
16;;; under the terms of the GNU General Public License as published by
17;;; the Free Software Foundation; either version 3 of the License, or (at
18;;; your option) any later version.
19;;;
20;;; GNU Guix is distributed in the hope that it will be useful, but
21;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23;;; GNU General Public License for more details.
24;;;
25;;; You should have received a copy of the GNU General Public License
26;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27
59132b80 28(define-module (gnu packages virtualization)
161ed547 29 #:use-module (gnu packages)
309693e0 30 #:use-module (gnu packages admin)
efcada41 31 #:use-module (gnu packages attr)
309693e0 32 #:use-module (gnu packages autotools)
ecfe88b7 33 #:use-module (gnu packages bison)
a0f6c3b3 34 #:use-module (gnu packages check)
b15fcf9e 35 #:use-module (gnu packages compression)
309693e0
RW
36 #:use-module (gnu packages curl)
37 #:use-module (gnu packages cyrus-sasl)
38 #:use-module (gnu packages disk)
8fc7bd23 39 #:use-module (gnu packages dns)
fe420383
RW
40 #:use-module (gnu packages docbook)
41 #:use-module (gnu packages documentation)
ecfe88b7 42 #:use-module (gnu packages flex)
fb9472a3 43 #:use-module (gnu packages fontutils)
90a8ef8c 44 #:use-module (gnu packages gettext)
efcada41
DC
45 #:use-module (gnu packages gl)
46 #:use-module (gnu packages glib)
a0f6c3b3 47 #:use-module (gnu packages gnome)
7714a069 48 #:use-module (gnu packages gnupg)
de7f03ce 49 #:use-module (gnu packages golang)
a0f6c3b3 50 #:use-module (gnu packages gtk)
e55354b8 51 #:use-module (gnu packages image)
fb9d7865 52 #:use-module (gnu packages libusb)
efcada41
DC
53 #:use-module (gnu packages linux)
54 #:use-module (gnu packages ncurses)
71d4ba52 55 #:use-module (gnu packages nettle)
fe420383 56 #:use-module (gnu packages networking)
7714a069 57 #:use-module (gnu packages package-management)
06da1a6b 58 #:use-module (gnu packages perl)
efcada41 59 #:use-module (gnu packages pkg-config)
309693e0 60 #:use-module (gnu packages polkit)
fe420383 61 #:use-module (gnu packages protobuf)
efcada41 62 #:use-module (gnu packages python)
589e3f4e 63 #:use-module (gnu packages python-web)
28e3569f 64 #:use-module (gnu packages pulseaudio)
5d4a8f9b 65 #:use-module (gnu packages selinux)
efcada41 66 #:use-module (gnu packages sdl)
38b9ce44 67 #:use-module (gnu packages spice)
efcada41 68 #:use-module (gnu packages texinfo)
71d4ba52 69 #:use-module (gnu packages textutils)
309693e0
RW
70 #:use-module (gnu packages tls)
71 #:use-module (gnu packages web)
efcada41 72 #:use-module (gnu packages xdisorg)
309693e0 73 #:use-module (gnu packages xml)
efcada41 74 #:use-module (guix build-system gnu)
de7f03ce 75 #:use-module (guix build-system go)
7cd2032f 76 #:use-module (guix build-system python)
efcada41 77 #:use-module (guix download)
7714a069 78 #:use-module (guix git-download)
b23b9667 79 #:use-module ((guix licenses) #:prefix license:)
efcada41
DC
80 #:use-module (guix packages)
81 #:use-module (guix utils)
06da1a6b 82 #:use-module (srfi srfi-1))
b15fcf9e 83
e38a71ee
LC
84(define (qemu-patch commit file-name sha256)
85 "Return an origin for COMMIT."
86 (origin
87 (method url-fetch)
88 (uri (string-append
89 "http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h="
90 commit))
91 (sha256 sha256)
92 (file-name file-name)))
93
06da1a6b 94(define-public qemu
b15fcf9e 95 (package
06da1a6b 96 (name "qemu")
5dc8437f 97 (version "3.0.0")
b15fcf9e
LC
98 (source (origin
99 (method url-fetch)
2de7d137 100 (uri (string-append "https://download.qemu.org/qemu-"
fbd6fb1a 101 version ".tar.xz"))
b15fcf9e
LC
102 (sha256
103 (base32
5dc8437f 104 "04sp3f1gp4bdb913jf7fw761njaqp2l32wgipp1sapmxx17zcyld"))))
b15fcf9e
LC
105 (build-system gnu-build-system)
106 (arguments
219b4556
LC
107 '(;; Running tests in parallel can occasionally lead to failures, like:
108 ;; boot_sector_test: assertion failed (signature == SIGNATURE): (0x00000000 == 0x0000dead)
109 #:parallel-tests? #f
0e5d0f66
RH
110 #:configure-flags (list "--enable-usb-redir" "--enable-opengl"
111 (string-append "--smbd="
112 (assoc-ref %outputs "out")
28e3569f
OP
113 "/libexec/samba-wrapper")
114 "--audio-drv-list=alsa,pa,sdl")
05051e8b
LC
115 #:phases
116 (modify-phases %standard-phases
117 (replace 'configure
118 (lambda* (#:key inputs outputs (configure-flags '())
20c263b0 119 #:allow-other-keys)
05051e8b
LC
120 ;; The `configure' script doesn't understand some of the
121 ;; GNU options. Thus, add a new phase that's compatible.
122 (let ((out (assoc-ref outputs "out")))
123 (setenv "SHELL" (which "bash"))
b15fcf9e 124
05051e8b
LC
125 ;; While we're at it, patch for tests.
126 (substitute* "tests/libqtest.c"
127 (("/bin/sh") (which "sh")))
50731c51 128
05051e8b
LC
129 ;; The binaries need to be linked against -lrt.
130 (setenv "LDFLAGS" "-lrt")
642d2db5
TGR
131 (apply invoke
132 `("./configure"
133 ,(string-append "--cc=" (which "gcc"))
134 ;; Some architectures insist on using HOST_CC
135 ,(string-append "--host-cc=" (which "gcc"))
136 "--disable-debug-info" ; save build space
137 "--enable-virtfs" ; just to be sure
138 ,(string-append "--prefix=" out)
139 ,(string-append "--sysconfdir=/etc")
140 ,@configure-flags)))))
05051e8b
LC
141 (add-after 'install 'install-info
142 (lambda* (#:key inputs outputs #:allow-other-keys)
143 ;; Install the Info manual, unless Texinfo is missing.
642d2db5
TGR
144 (when (assoc-ref inputs "texinfo")
145 (let* ((out (assoc-ref outputs "out"))
146 (dir (string-append out "/share/info")))
147 (invoke "make" "info")
148 (for-each (lambda (info)
149 (install-file info dir))
150 (find-files "." "\\.info"))))
151 #t))
0e5d0f66
RH
152 ;; Create a wrapper for Samba. This allows QEMU to use Samba without
153 ;; pulling it in as an input. Note that you need to explicitly install
154 ;; Samba in your Guix profile for Samba support.
155 (add-after 'install-info 'create-samba-wrapper
156 (lambda* (#:key inputs outputs #:allow-other-keys)
157 (let* ((out (assoc-ref %outputs "out"))
158 (libexec (string-append out "/libexec")))
159 (call-with-output-file "samba-wrapper"
160 (lambda (port)
161 (format port "#!/bin/sh
162exec smbd $@")))
163 (chmod "samba-wrapper" #o755)
164 (install-file "samba-wrapper" libexec))
165 #t))
de3bbf65
LC
166 (add-before 'check 'make-gtester-verbose
167 (lambda _
168 ;; Make GTester verbose to facilitate investigation upon failure.
d229ba95 169 (setenv "V" "1") #t))
05051e8b
LC
170 (add-before 'check 'disable-test-qga
171 (lambda _
43bec6d0 172 (substitute* "tests/Makefile.include"
05051e8b
LC
173 ;; Comment out the test-qga test, which needs /sys and
174 ;; fails within the build environment.
175 (("check-unit-.* tests/test-qga" all)
176 (string-append "# " all)))
177 #t)))))
b15fcf9e 178 (inputs ; TODO: Add optional inputs.
2f042822
DC
179 `(("alsa-lib" ,alsa-lib)
180 ("attr" ,attr)
b15fcf9e 181 ("glib" ,glib)
90a8ef8c 182 ("gtk+" ,gtk+)
fa65e84a 183 ("libaio" ,libaio)
2f042822
DC
184 ("libattr" ,attr)
185 ("libcap" ,libcap) ; virtfs support requires libcap & libattr
9a187b39
AP
186 ("libdrm" ,libdrm)
187 ("libepoxy" ,libepoxy)
513885b5 188 ("libjpeg" ,libjpeg-turbo)
2f042822 189 ("libpng" ,libpng)
34a28c13 190 ("libseccomp" ,libseccomp)
2f042822
DC
191 ("libusb" ,libusb) ;USB pass-through support
192 ("mesa" ,mesa)
193 ("ncurses" ,ncurses)
194 ;; ("pciutils" ,pciutils)
2b2fdd45 195 ("pixman" ,pixman)
28e3569f 196 ("pulseaudio" ,pulseaudio)
27b52c1f 197 ("sdl2" ,sdl2)
38b9ce44 198 ("spice" ,spice)
b376ec57 199 ("usbredir" ,usbredir)
b15fcf9e 200 ("util-linux" ,util-linux)
2f042822 201 ;; ("vde2" ,vde2)
38b9ce44 202 ("virglrenderer" ,virglrenderer)
2f042822 203 ("zlib" ,zlib)))
90a8ef8c
RH
204 (native-inputs `(("gettext" ,gettext-minimal)
205 ("glib:bin" ,glib "bin") ; gtester, etc.
2f042822 206 ("perl" ,perl)
ecfe88b7
MW
207 ("flex" ,flex)
208 ("bison" ,bison)
2f042822 209 ("pkg-config" ,pkg-config)
27b52c1f 210 ("python-wrapper" ,python-wrapper)
2f042822 211 ("texinfo" ,texinfo)))
ce9fbae1 212 (home-page "https://www.qemu.org")
06da1a6b 213 (synopsis "Machine emulator and virtualizer")
72b9eebf 214 (description
50731c51 215 "QEMU is a generic machine emulator and virtualizer.
72b9eebf
LC
216
217When used as a machine emulator, QEMU can run OSes and programs made for one
50731c51
LC
218machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
219using dynamic translation, it achieves very good performance.
72b9eebf
LC
220
221When used as a virtualizer, QEMU achieves near native performances by
222executing the guest code directly on the host CPU. QEMU supports
223virtualization when executing under the Xen hypervisor or using
224the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
50731c51
LC
225server and embedded PowerPC, and S390 guests.")
226
227 ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
b23b9667 228 (license license:gpl2)
f47638a3
LC
229
230 ;; Several tests fail on MIPS; see <http://hydra.gnu.org/build/117914>.
231 (supported-systems (delete "mips64el-linux" %supported-systems))))
50731c51 232
06da1a6b
LC
233(define-public qemu-minimal
234 ;; QEMU without GUI support.
235 (package (inherit qemu)
236 (name "qemu-minimal")
237 (synopsis "Machine emulator and virtualizer (without GUI)")
238 (arguments
b376ec57
AP
239 (substitute-keyword-arguments (package-arguments qemu)
240 ((#:configure-flags _ '(list))
241 ;; Restrict to the targets supported by Guix.
242 ''("--target-list=i386-softmmu,x86_64-softmmu,mips64el-softmmu,arm-softmmu,aarch64-softmmu"))))
06da1a6b
LC
243
244 ;; Remove dependencies on optional libraries, notably GUI libraries.
90a8ef8c
RH
245 (native-inputs (fold alist-delete (package-native-inputs qemu)
246 '("gettext")))
06da1a6b 247 (inputs (fold alist-delete (package-inputs qemu)
90a8ef8c 248 '("libusb" "mesa" "sdl2" "spice" "virglrenderer" "gtk+"
28e3569f 249 "usbredir" "libdrm" "libepoxy" "pulseaudio")))))
309693e0 250
27b52c1f
RH
251;; The GRUB test suite fails with later versions of Qemu, so we
252;; keep it at 2.10 for now. See
253;; <https://lists.gnu.org/archive/html/bug-grub/2018-02/msg00004.html>.
254;; This package is hidden since we do not backport updates to it.
255(define-public qemu-minimal-2.10
256 (hidden-package
257 (package
258 (inherit qemu-minimal)
259 (version "2.10.2")
260 (source (origin
261 (method url-fetch)
262 (uri (string-append "https://download.qemu.org/qemu-"
263 version ".tar.xz"))
264 (sha256
265 (base32
3d5ad159
MW
266 "17w21spvaxaidi2am5lpsln8yjpyp2zi3s3gc6nsxj5arlgamzgw"))
267 (patches
268 (search-patches "qemu-glibc-2.27.patch"))))
27b52c1f
RH
269 ;; qemu-minimal-2.10 needs Python 2. Remove below once no longer necessary.
270 (native-inputs `(("python-2" ,python-2)
271 ,@(fold alist-delete (package-native-inputs qemu)
272 '("python-wrapper")))))))
273
a0f6c3b3
RW
274(define-public libosinfo
275 (package
276 (name "libosinfo")
d701f8bd 277 (version "1.0.0")
a0f6c3b3
RW
278 (source
279 (origin
280 (method url-fetch)
d701f8bd 281 (uri (string-append "https://releases.pagure.org/libosinfo/libosinfo-"
a0f6c3b3
RW
282 version ".tar.gz"))
283 (sha256
284 (base32
d701f8bd 285 "0srrs2m6irqd4f867g8ls6jp2dq3ql0l9d0fh80d55sivvn2bd7p"))))
a0f6c3b3
RW
286 (build-system gnu-build-system)
287 (arguments
d701f8bd
RW
288 `(#:configure-flags
289 (list (string-append "--with-usb-ids-path="
290 (assoc-ref %build-inputs "usb.ids"))
291 (string-append "--with-pci-ids-path="
292 (assoc-ref %build-inputs "pci.ids")))
293 #:phases
a0f6c3b3 294 (modify-phases %standard-phases
d701f8bd
RW
295 ;; This odd test fails for unknown reasons.
296 (add-after 'unpack 'disable-broken-test
297 (lambda _
298 (substitute* "test/Makefile.in"
299 (("test-isodetect\\$\\(EXEEXT\\)") ""))
a0f6c3b3
RW
300 #t)))))
301 (inputs
302 `(("libsoup" ,libsoup)
303 ("libxml2" ,libxml2)
304 ("libxslt" ,libxslt)
305 ("gobject-introspection" ,gobject-introspection)))
306 (native-inputs
307 `(("check" ,check)
308 ("glib" ,glib "bin") ; glib-mkenums, etc.
309 ("gtk-doc" ,gtk-doc)
310 ("vala" ,vala)
311 ("intltool" ,intltool)
312 ("pkg-config" ,pkg-config)
313 ("pci.ids"
314 ,(origin
315 (method url-fetch)
d701f8bd 316 (uri "https://github.com/pciutils/pciids/raw/ad02084f0bc143e3c15e31a6152a3dfb1d7a3156/pci.ids")
a0f6c3b3
RW
317 (sha256
318 (base32
d701f8bd 319 "0kfhpj5rnh24hz2714qhfmxk281vwc2w50sm73ggw5d15af7zfsw"))))
a0f6c3b3
RW
320 ("usb.ids"
321 ,(origin
322 (method url-fetch)
0d73f148 323 (uri "https://svn.code.sf.net/p/linux-usb/repo/trunk/htdocs/usb.ids?r=2681")
b02733d4 324 (file-name "usb.ids")
a0f6c3b3
RW
325 (sha256
326 (base32
0d73f148 327 "1m6yhvz5k8aqzxgk7xj3jkk8frl1hbv0h3vgj4wbnvnx79qnvz3r"))))))
a0f6c3b3
RW
328 (home-page "https://libosinfo.org/")
329 (synopsis "Operating system information database")
330 (description "libosinfo is a GObject based library API for managing
331information about operating systems, hypervisors and the (virtual) hardware
332devices they can support. It includes a database containing device metadata
333and provides APIs to match/identify optimal devices for deploying an operating
334system on a hypervisor. Via GObject Introspection, the API is available in
335all common programming languages. Vala bindings are also provided.")
336 ;; The library files are released under LGPLv2.1 or later; the source
337 ;; files in the "tools" directory are released under GPLv2+.
b23b9667 338 (license (list license:lgpl2.1+ license:gpl2+))))
a0f6c3b3 339
5d4a8f9b
SB
340(define-public lxc
341 (package
342 (name "lxc")
c4f8953a 343 (version "3.0.2")
5d4a8f9b
SB
344 (source (origin
345 (method url-fetch)
346 (uri (string-append
347 "https://linuxcontainers.org/downloads/lxc/lxc-"
348 version ".tar.gz"))
349 (sha256
350 (base32
c4f8953a 351 "0p1gy553cm4mhwxi85fl6qiwz61rjmvysm8c8pd20qh62xxi3dva"))))
5d4a8f9b
SB
352 (build-system gnu-build-system)
353 (native-inputs
354 `(("pkg-config" ,pkg-config)))
355 (inputs
356 `(("gnutls" ,gnutls)
357 ("libcap" ,libcap)
358 ("libseccomp" ,libseccomp)
359 ("libselinux" ,libselinux)))
360 (arguments
361 '(#:configure-flags
362 '("--sysconfdir=/etc"
363 "--localstatedir=/var")
364 #:phases
365 (modify-phases %standard-phases
366 (replace 'install
367 (lambda* (#:key outputs #:allow-other-keys)
368 (let* ((out (assoc-ref outputs "out"))
369 (bashcompdir (string-append out "/etc/bash_completion.d")))
d6870d10 370 (invoke "make" "install"
5d4a8f9b
SB
371 (string-append "bashcompdir=" bashcompdir)
372 ;; Don't install files into /var and /etc.
373 "LXCPATH=/tmp/var/lib/lxc"
374 "localstatedir=/tmp/var"
375 "sysconfdir=/tmp/etc"
d6870d10 376 "sysconfigdir=/tmp/etc/default")))))))
5d4a8f9b
SB
377 (synopsis "Linux container tools")
378 (home-page "https://linuxcontainers.org/")
379 (description
380 "LXC is a userspace interface for the Linux kernel containment features.
381Through a powerful API and simple tools, it lets Linux users easily create and
382manage system or application containers.")
b23b9667 383 (license license:lgpl2.1+)))
5d4a8f9b 384
309693e0
RW
385(define-public libvirt
386 (package
387 (name "libvirt")
b225a3b8 388 (version "4.3.0")
309693e0
RW
389 (source (origin
390 (method url-fetch)
2e508b6d 391 (uri (string-append "https://libvirt.org/sources/libvirt-"
309693e0
RW
392 version ".tar.xz"))
393 (sha256
394 (base32
b225a3b8 395 "1dy243dqaj174hcka0my7q781wf0dvyi7f9328nwnplqicnf4cd5"))))
309693e0
RW
396 (build-system gnu-build-system)
397 (arguments
398 `(;; FAIL: virshtest
399 ;; FAIL: virfirewalltest
400 ;; FAIL: virkmodtest
401 ;; FAIL: virnetsockettest
402 ;; FAIL: networkxml2firewalltest
403 ;; FAIL: nwfilterebiptablestest
404 ;; FAIL: nwfilterxml2firewalltest
07378e31 405 ;; Time-out while running commandtest.
309693e0
RW
406 #:tests? #f
407 #:configure-flags
408 (list "--with-polkit"
a4b93921 409 "--sysconfdir=/etc"
309693e0
RW
410 "--localstatedir=/var")
411 #:phases
412 (modify-phases %standard-phases
413 (add-after 'unpack 'fix-tests
414 (lambda _
415 (substitute* '("tests/commandtest.c"
416 "gnulib/tests/test-posix_spawn1.c"
417 "gnulib/tests/test-posix_spawn2.c")
418 (("/bin/sh") (which "sh")))
419 #t))
a4b93921
SB
420 (replace 'install
421 ;; Since the sysconfdir and localstatedir should be /etc and /var
422 ;; at runtime, we must prevent writing to them at installation
423 ;; time.
424 (lambda _
07378e31
TGR
425 (invoke "make" "install"
426 "sysconfdir=/tmp/etc"
427 "localstatedir=/tmp/var")))
903e051a
CB
428 (add-after 'install 'wrap-libvirtd
429 (lambda* (#:key inputs outputs #:allow-other-keys)
430 (let ((out (assoc-ref outputs "out")))
431 (wrap-program (string-append out "/sbin/libvirtd")
432 `("PATH" = (,(string-append (assoc-ref inputs "iproute")
433 "/sbin")
434 ,(string-append (assoc-ref inputs "qemu")
435 "/bin"))))
436 #t))))))
309693e0
RW
437 (inputs
438 `(("libxml2" ,libxml2)
439 ("gnutls" ,gnutls)
440 ("dbus" ,dbus)
441 ("qemu" ,qemu)
309693e0
RW
442 ("libpcap" ,libpcap)
443 ("libnl" ,libnl)
444 ("libuuid" ,util-linux)
445 ("lvm2" ,lvm2) ; for libdevmapper
446 ("curl" ,curl)
447 ("openssl" ,openssl)
448 ("cyrus-sasl" ,cyrus-sasl)
309693e0 449 ("libyajl" ,libyajl)
8fc7bd23
SB
450 ("audit" ,audit)
451 ("dmidecode" ,dmidecode)
452 ("dnsmasq" ,dnsmasq)
453 ("ebtables" ,ebtables)
454 ("iproute" ,iproute)
455 ("iptables" ,iptables)))
309693e0 456 (native-inputs
2f110b32 457 `(("xsltproc" ,libxslt)
b8fb94d5
TGR
458 ("perl" ,perl)
459 ("pkg-config" ,pkg-config)
460 ("polkit" ,polkit)
35d56c1c 461 ("python" ,python)))
2e508b6d 462 (home-page "https://libvirt.org")
309693e0
RW
463 (synopsis "Simple API for virtualization")
464 (description "Libvirt is a C toolkit to interact with the virtualization
465capabilities of recent versions of Linux. The library aims at providing long
466term stable C API initially for the Xen paravirtualization but should be able
467to integrate other virtualization mechanisms if needed.")
b23b9667 468 (license license:lgpl2.1+)))
597ea122
RW
469
470(define-public libvirt-glib
471 (package
472 (name "libvirt-glib")
c3c03162 473 (version "1.0.0")
597ea122
RW
474 (source (origin
475 (method url-fetch)
476 (uri (string-append "ftp://libvirt.org/libvirt/glib/"
477 "libvirt-glib-" version ".tar.gz"))
478 (sha256
479 (base32
c3c03162 480 "0iwa5sdbii52pjpdm5j37f67sdmf0kpcky4liwhy1nf43k85i4fa"))))
597ea122
RW
481 (build-system gnu-build-system)
482 (arguments
483 `(#:phases
484 (modify-phases %standard-phases
485 (add-after 'unpack 'fix-tests
486 (lambda _
487 (substitute* "tests/test-events.c"
488 (("/bin/true") (which "true")))
489 #t)))))
490 (inputs
491 `(("libxml2" ,libxml2)
492 ("libvirt" ,libvirt)
493 ("gobject-introspection" ,gobject-introspection)
494 ("glib" ,glib)
495 ("openssl" ,openssl)
496 ("cyrus-sasl" ,cyrus-sasl)
497 ("lvm2" ,lvm2) ; for libdevmapper
498 ("libyajl" ,libyajl)))
499 (native-inputs
500 `(("pkg-config" ,pkg-config)
501 ("intltool" ,intltool)
502 ("glib" ,glib "bin")
503 ("vala" ,vala)))
b3fee5c1 504 (home-page "https://libvirt.org")
597ea122
RW
505 (synopsis "GLib wrapper around libvirt")
506 (description "libvirt-glib wraps the libvirt library to provide a
507high-level object-oriented API better suited for glib-based applications, via
508three libraries:
509
510@enumerate
511@item libvirt-glib - GLib main loop integration & misc helper APIs
512@item libvirt-gconfig - GObjects for manipulating libvirt XML documents
513@item libvirt-gobject - GObjects for managing libvirt objects
514@end enumerate
515")
b23b9667 516 (license license:lgpl2.1+)))
7cd2032f
RW
517
518(define-public python-libvirt
519 (package
520 (name "python-libvirt")
3cc7d542 521 (version "4.1.0")
7cd2032f
RW
522 (source (origin
523 (method url-fetch)
524 (uri (pypi-uri "libvirt-python" version))
525 (sha256
526 (base32
3cc7d542 527 "1ixqhxjkczl8vk9wjx4cknw4374cw5nnsacbd2s755kpd0ys7hny"))))
7cd2032f
RW
528 (build-system python-build-system)
529 (arguments
530 `(#:phases
531 (modify-phases %standard-phases
532 (add-after 'unpack 'patch-nosetests-path
533 (lambda* (#:key inputs #:allow-other-keys)
534 (substitute* "setup.py"
9271dfdd
SB
535 (("\"/usr/bin/nosetests\"")
536 (string-append "\"" (which "nosetests") "\""))
537 (("self\\.spawn\\(\\[sys\\.executable, nose\\]\\)")
538 (format #f "self.spawn([\"~a\", nose])" (which "bash"))))
7cd2032f
RW
539 #t)))))
540 (inputs
482d9591
HG
541 `(("libvirt" ,libvirt)))
542 (propagated-inputs
543 `(("python-lxml" ,python-lxml)))
7cd2032f
RW
544 (native-inputs
545 `(("pkg-config" ,pkg-config)
546 ("python-nose" ,python-nose)))
b3fee5c1 547 (home-page "https://libvirt.org")
7cd2032f
RW
548 (synopsis "Python bindings to libvirt")
549 (description "This package provides Python bindings to the libvirt
550virtualization library.")
b23b9667 551 (license license:lgpl2.1+)))
7cd2032f
RW
552
553(define-public python2-libvirt
554 (package-with-python2 python-libvirt))
2f82b53b
RW
555
556(define-public virt-manager
557 (package
558 (name "virt-manager")
21c566a3 559 (version "1.5.1")
2f82b53b
RW
560 (source (origin
561 (method url-fetch)
562 (uri (string-append "https://virt-manager.org/download/sources"
563 "/virt-manager/virt-manager-"
564 version ".tar.gz"))
565 (sha256
566 (base32
21c566a3 567 "1ardmd4sxdmd57y7qpka44gf09c1yq2g0xs074d3k1h925crv27f"))))
2f82b53b
RW
568 (build-system python-build-system)
569 (arguments
570 `(#:python ,python-2
5834a405 571 #:use-setuptools? #f ; Uses custom distutils 'install' command.
2f82b53b
RW
572 ;; Some of the tests seem to require network access to install virtual
573 ;; machines.
574 #:tests? #f
f023685d
AP
575 #:imported-modules ((guix build glib-or-gtk-build-system)
576 ,@%python-build-system-modules)
2f82b53b
RW
577 #:modules ((ice-9 match)
578 (srfi srfi-26)
579 (guix build python-build-system)
f023685d 580 ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
2f82b53b
RW
581 (guix build utils))
582 #:phases
583 (modify-phases %standard-phases
584 (add-after 'unpack 'fix-setup
585 (lambda* (#:key outputs #:allow-other-keys)
586 (substitute* "virtcli/cliconfig.py"
587 (("/usr") (assoc-ref outputs "out")))
588 #t))
4ad8fbd1
AP
589 (add-after 'unpack 'fix-default-uri
590 (lambda* (#:key inputs #:allow-other-keys)
591 ;; xen is not available for now - so only patch qemu
592 (substitute* "virtManager/connect.py"
593 (("/usr(/bin/qemu-system)" _ suffix)
594 (string-append (assoc-ref inputs "qemu") suffix)))
595 #t))
2f82b53b
RW
596 (add-before 'wrap 'wrap-with-GI_TYPELIB_PATH
597 (lambda* (#:key inputs outputs #:allow-other-keys)
598 (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
599 (bin-files (find-files bin ".*"))
600 (paths (map (match-lambda
601 ((output . directory)
602 (let* ((girepodir (string-append
603 directory
604 "/lib/girepository-1.0")))
605 (if (file-exists? girepodir)
606 girepodir #f))))
607 inputs)))
608 (for-each (lambda (file)
609 (format #t "wrapping ~a\n" file)
610 (wrap-program file
611 `("GI_TYPELIB_PATH" ":" prefix
612 ,(filter identity paths))))
613 bin-files))
f023685d
AP
614 #t))
615 (add-after 'install 'glib-or-gtk-compile-schemas
616 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
617 (add-after 'install 'glib-or-gtk-wrap
618 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
2f82b53b 619 (inputs
b1e9837a
AP
620 `(("dconf" ,dconf)
621 ("gtk+" ,gtk+)
45214efe 622 ("gtk-vnc" ,gtk-vnc)
2f82b53b
RW
623 ("libvirt" ,libvirt)
624 ("libvirt-glib" ,libvirt-glib)
625 ("libosinfo" ,libosinfo)
45214efe 626 ("vte" ,vte)
2f82b53b
RW
627 ("gobject-introspection" ,gobject-introspection)
628 ("python2-libvirt" ,python2-libvirt)
629 ("python2-requests" ,python2-requests)
630 ("python2-ipaddr" ,python2-ipaddr)
b764a9f5 631 ("python2-pycairo" ,python2-pycairo)
2f82b53b 632 ("python2-pygobject" ,python2-pygobject)
8da7f792
AP
633 ("python2-libxml2" ,python2-libxml2)
634 ("spice-gtk" ,spice-gtk)))
2f82b53b
RW
635 ;; virt-manager searches for qemu-img or kvm-img in the PATH.
636 (propagated-inputs
637 `(("qemu" ,qemu)))
638 (native-inputs
639 `(("glib" ,glib "bin") ; glib-compile-schemas.
e6efcd58 640 ("gtk+" ,gtk+ "bin") ; gtk-update-icon-cache
2f82b53b
RW
641 ("perl" ,perl) ; pod2man
642 ("intltool" ,intltool)))
643 (home-page "https://virt-manager.org/")
644 (synopsis "Manage virtual machines")
645 (description
646 "The virt-manager application is a desktop user interface for managing
647virtual machines through libvirt. It primarily targets KVM VMs, but also
648manages Xen and LXC (Linux containers). It presents a summary view of running
649domains, their live performance and resource utilization statistics.")
b23b9667 650 (license license:gpl2+)))
fe420383
RW
651
652(define-public criu
653 (package
654 (name "criu")
bd971438 655 (version "3.7")
fe420383
RW
656 (source (origin
657 (method url-fetch)
658 (uri (string-append "http://download.openvz.org/criu/criu-"
659 version ".tar.bz2"))
660 (sha256
661 (base32
bd971438 662 "0qrpz7pvnks34v7d8lb73flz3mb7qwnib94pdwaxh0mskn8470fq"))))
fe420383
RW
663 (build-system gnu-build-system)
664 (arguments
665 `(#:test-target "test"
666 #:tests? #f ; tests require mounting as root
667 #:make-flags
668 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
669 (string-append "LIBDIR=" (assoc-ref %outputs "out")
670 "/lib"))
671 #:phases
672 (modify-phases %standard-phases
673 (replace 'configure
674 (lambda* (#:key inputs #:allow-other-keys)
675 ;; The includes for libnl are located in a sub-directory.
676 (setenv "C_INCLUDE_PATH"
677 (string-append (assoc-ref inputs "libnl")
678 "/include/libnl3:"
679 (getenv "C_INCLUDE_PATH")))
680 ;; Prevent xmlto from failing the install phase.
681 (substitute* "Documentation/Makefile"
682 (("XMLTO.*:=.*")
683 (string-append "XMLTO:="
684 (assoc-ref inputs "xmlto")
685 "/bin/xmlto"
686 " --skip-validation "
687 " -x "
688 (assoc-ref inputs "docbook-xsl")
689 "/xml/xsl/docbook-xsl-"
690 ,(package-version docbook-xsl)
691 "/manpages/docbook.xsl")))
692 #t))
693 (add-before 'build 'fix-symlink
694 (lambda* (#:key inputs #:allow-other-keys)
695 ;; The file 'images/google/protobuf/descriptor.proto' points to
696 ;; /usr/include/..., which obviously does not exist.
697 (let* ((file "google/protobuf/descriptor.proto")
698 (target (string-append "images/" file))
699 (source (string-append (assoc-ref inputs "protobuf")
700 "/include/" file)))
701 (delete-file target)
702 (symlink source target)
703 #t)))
704 (add-after 'install 'wrap
705 (lambda* (#:key inputs outputs #:allow-other-keys)
706 ;; Make sure 'crit' runs with the correct PYTHONPATH.
707 (let* ((out (assoc-ref outputs "out"))
708 (path (string-append out
709 "/lib/python"
710 (string-take (string-take-right
711 (assoc-ref inputs "python") 5) 3)
712 "/site-packages:"
713 (getenv "PYTHONPATH"))))
714 (wrap-program (string-append out "/bin/crit")
715 `("PYTHONPATH" ":" prefix (,path))))
716 #t)))))
717 (inputs
718 `(("protobuf" ,protobuf)
719 ("python" ,python-2)
720 ("python2-protobuf" ,python2-protobuf)
721 ("python2-ipaddr" ,python2-ipaddr)
722 ("iproute" ,iproute)
723 ("libaio" ,libaio)
724 ("libcap" ,libcap)
725 ("libnet" ,libnet)
726 ("libnl" ,libnl)))
727 (native-inputs
728 `(("pkg-config" ,pkg-config)
3bf94bc8 729 ("perl" ,perl)
fe420383
RW
730 ("protobuf-c" ,protobuf-c)
731 ("asciidoc" ,asciidoc)
732 ("xmlto" ,xmlto)
733 ("docbook-xml" ,docbook-xml)
734 ("docbook-xsl" ,docbook-xsl)))
735 (home-page "https://criu.org")
736 (synopsis "Checkpoint and restore in user space")
737 (description "Using this tool, you can freeze a running application (or
738part of it) and checkpoint it to a hard drive as a collection of files. You
739can then use the files to restore and run the application from the point it
740was frozen at. The distinctive feature of the CRIU project is that it is
741mainly implemented in user space.")
742 ;; The project is licensed under GPLv2; files in the lib/ directory are
743 ;; LGPLv2.1.
b23b9667 744 (license (list license:gpl2 license:lgpl2.1))))
f46a3523
RH
745
746(define-public qmpbackup
747 (package
748 (name "qmpbackup")
749 (version "0.2")
750 (source (origin
751 (method url-fetch)
752 (uri (string-append "https://github.com/abbbi/qmpbackup/archive/"
753 version ".tar.gz"))
754 (sha256
755 (base32
756 "10k9mnb1yrg4gw1rvz4kw4dxc4aajl8gnjrpm3axqkg63qmxj3qn"))
757 (file-name (string-append name "-" version ".tar.gz"))))
758 (build-system python-build-system)
759 (arguments
760 `(#:python ,python-2))
761 (home-page "https://github.com/abbbi/qmpbackup")
762 (synopsis "Backup and restore QEMU machines")
763 (description "qmpbackup is designed to create and restore full and
764incremental backups of running QEMU virtual machines via QMP, the QEMU
765Machine Protocol.")
b23b9667 766 (license license:gpl3+)))
fb9472a3
RH
767
768(define-public lookingglass
769 (package
770 (name "lookingglass")
71d4ba52 771 (version "a11")
fb9472a3
RH
772 (source
773 (origin
774 (method url-fetch)
775 (uri (string-append "https://github.com/gnif/LookingGlass/archive/"
776 version ".tar.gz"))
777 (file-name (string-append name "-" version))
778 (sha256
779 (base32
71d4ba52 780 "11qwyp332l66sqksqa0z9439yi4accmbq7wjc6kikc5fimdh9wk5"))))
fb9472a3
RH
781 (build-system gnu-build-system)
782 (inputs `(("fontconfig" ,fontconfig)
783 ("glu" ,glu)
784 ("mesa" ,mesa)
785 ("openssl" ,openssl)
786 ("sdl2" ,sdl2)
787 ("sdl2-ttf" ,sdl2-ttf)
788 ("spice-protocol" ,spice-protocol)))
71d4ba52
RH
789 (native-inputs `(("libconfig" ,libconfig)
790 ("nettle" ,nettle)
791 ("pkg-config" ,pkg-config)))
fb9472a3
RH
792 (arguments
793 `(#:tests? #f ;; No tests are available.
71d4ba52 794 #:make-flags '("CC=gcc")
fb9472a3
RH
795 #:phases (modify-phases %standard-phases
796 (replace 'configure
797 (lambda* (#:key outputs #:allow-other-keys)
798 (chdir "client")
799 #t))
800 (replace 'install
801 (lambda* (#:key outputs #:allow-other-keys)
802 (install-file "bin/looking-glass-client"
803 (string-append (assoc-ref outputs "out")
804 "/bin"))
805 #t)))))
806 (home-page "https://looking-glass.hostfission.com")
807 (synopsis "KVM Frame Relay (KVMFR) implementation")
808 (description "Looking Glass allows the use of a KVM (Kernel-based Virtual
809Machine) configured for VGA PCI Pass-through without an attached physical
810monitor, keyboard or mouse. It displays the VM's rendered contents on your main
811monitor/GPU.")
25504aaf
EF
812 ;; This package requires SSE instructions.
813 (supported-systems '("i686-linux" "x86_64-linux"))
b23b9667 814 (license license:gpl2+)))
de7f03ce
SB
815
816(define-public runc
817 (package
818 (name "runc")
819 (version "1.0.0-rc5")
820 (source (origin
821 (method url-fetch)
822 (uri (string-append
823 "https://github.com/opencontainers/runc/releases/"
824 "download/v" version "/runc.tar.xz"))
825 (sha256
826 (base32
827 "081avdzwnqpk368wbaihlzsypaxpj42d7699h7jgp0fks14x4103"))))
828 (build-system go-build-system)
829 (arguments
830 '(#:import-path "github.com/opencontainers/runc"
831 #:install-source? #f
03e45891
SB
832 ;; XXX: 20/139 tests fail due to missing /var, cgroups and apparmor in
833 ;; the build environment.
834 #:tests? #f
de7f03ce
SB
835 #:phases
836 (modify-phases %standard-phases
837 (replace 'unpack
838 (lambda* (#:key source import-path #:allow-other-keys)
839 ;; Unpack the tarball into 'runc' instead of 'runc-1.0.0-rc5'.
840 (let ((dest (string-append "src/" import-path)))
841 (mkdir-p dest)
842 (invoke "tar" "-C" (string-append "src/" import-path)
843 "--strip-components=1"
844 "-xvf" source))))
845 (replace 'build
846 (lambda* (#:key import-path #:allow-other-keys)
847 (chdir (string-append "src/" import-path))
848 ;; XXX: requires 'go-md2man'.
849 ;; (invoke "make" "man")
850 (invoke "make")))
851 ;; (replace 'check
852 ;; (lambda _
853 ;; (invoke "make" "localunittest")))
854 (replace 'install
855 (lambda* (#:key outputs #:allow-other-keys)
856 (let ((out (assoc-ref outputs "out")))
857 (invoke "make" "install" "install-bash"
858 (string-append "PREFIX=" out))))))))
859 (native-inputs
860 `(("pkg-config" ,pkg-config)))
861 (inputs
862 `(("libseccomp" ,libseccomp)))
863 (synopsis "Open container initiative runtime")
864 (home-page "https://www.opencontainers.org/")
865 (description
866 "@command{runc} is a command line client for running applications
867packaged according to the
868@uref{https://github.com/opencontainers/runtime-spec/blob/master/spec.md, Open
869Container Initiative (OCI) format} and is a compliant implementation of the
870Open Container Initiative specification.")
b23b9667 871 (license license:asl2.0)))
efdaf8de
SB
872
873(define-public umoci
874 (package
875 (name "umoci")
c924fe38 876 (version "0.4.2")
efdaf8de
SB
877 (source (origin
878 (method url-fetch)
879 (uri (string-append
880 "https://github.com/openSUSE/umoci/releases/download/v"
881 version "/umoci.tar.xz"))
882 (file-name (string-append "umoci-" version ".tar.xz"))
883 (sha256
884 (base32
c924fe38 885 "1rq5jxcss9cmy05x9b2kh9ld57ribi8hgnx2w67jpmf343b83m4q"))))
efdaf8de
SB
886 (build-system go-build-system)
887 (arguments
888 '(#:import-path "github.com/openSUSE/umoci"
889 #:install-source? #f
890 #:phases
891 (modify-phases %standard-phases
892 (replace 'unpack
893 (lambda* (#:key source import-path #:allow-other-keys)
894 ;; Unpack the tarball into 'umoci' instead of "runc-${version}".
895 (let ((dest (string-append "src/" import-path)))
896 (mkdir-p dest)
897 (invoke "tar" "-C" (string-append "src/" import-path)
898 "--strip-components=1"
899 "-xvf" source))))
900 (replace 'build
901 (lambda* (#:key import-path #:allow-other-keys)
902 (chdir (string-append "src/" import-path))
903 ;; TODO: build manpages with 'go-md2man'.
904 (invoke "make" "SHELL=bash")))
905 (replace 'install
906 (lambda* (#:key outputs #:allow-other-keys)
907 (let* ((out (assoc-ref outputs "out"))
908 (bindir (string-append out "/bin")))
909 (install-file "umoci" bindir)
910 #t))))))
911 (home-page "https://umo.ci/")
912 (synopsis "Tool for modifying Open Container images")
913 (description
914 "@command{umoci} is a tool that allows for high-level modification of an
915Open Container Initiative (OCI) image layout and its tagged images.")
b23b9667 916 (license license:asl2.0)))
7714a069
SB
917
918(define-public skopeo
919 (package
920 (name "skopeo")
921 (version "0.1.28")
922 (source (origin
923 (method git-fetch)
924 (uri (git-reference
925 (url "https://github.com/projectatomic/skopeo")
926 (commit (string-append "v" version))))
927 (file-name (git-file-name name version))
928 (sha256
929 (base32
930 "068nwrr3nr27alravcq1sxyhdd5jjr24213vdgn1dqva3885gbi0"))))
931 (build-system go-build-system)
932 (native-inputs
933 `(("pkg-config" ,pkg-config)))
934 (inputs
935 `(("btrfs-progs" ,btrfs-progs)
936 ("eudev" ,eudev)
937 ("libassuan" ,libassuan)
938 ("libselinux" ,libselinux)
939 ("libostree" ,libostree)
940 ("lvm2" ,lvm2)
941 ("glib" ,glib)
942 ("gpgme" ,gpgme)))
943 (arguments
944 '(#:import-path "github.com/projectatomic/skopeo"
945 #:install-source? #f
946 #:phases
947 (modify-phases %standard-phases
948 (replace 'build
949 (lambda* (#:key import-path #:allow-other-keys)
950 (chdir (string-append "src/" import-path))
951 ;; TODO: build manpages with 'go-md2man'.
952 (invoke "make" "binary-local")))
953 (replace 'install
954 (lambda* (#:key outputs #:allow-other-keys)
955 (let ((out (assoc-ref outputs "out")))
956 (invoke "make" "install-binary" "install-completions"
957 (string-append "PREFIX=" out))))))))
958 (home-page "https://github.com/projectatomic/skopeo")
959 (synopsis "Interact with container images and container image registries")
960 (description
961 "@command{skopeo} is a command line utility providing various operations
962with container images and container image registries. It can:
963@enumerate
964
965@item Copy container images between various containers image stores,
966converting them as necessary.
967
968@item Convert a Docker schema 2 or schema 1 container image to an OCI image.
969
970@item Inspect a repository on a container registry without needlessly pulling
971the image.
972
973@item Sign and verify container images.
974
975@item Delete container images from a remote container registry.
976
977@end enumerate")
b23b9667 978 (license license:asl2.0)))
5e95181b
EF
979
980(define-public python-vagrant
981 (package
982 (name "python-vagrant")
983 (version "0.5.15")
984 (source
985 (origin
986 (method url-fetch)
987 (uri (pypi-uri "python-vagrant" version))
988 (sha256
989 (base32
990 "1ikrh6canhcxg5y7pzmkcnnydikppv7s6sm9prfx90nk0ac8m6mg"))))
991 (build-system python-build-system)
992 (arguments
993 '(#:tests? #f)) ; tests involve running vagrant.
994 (home-page "https://github.com/todddeluca/python-vagrant")
995 (synopsis "Python bindings for Vagrant")
996 (description
997 "Python-vagrant is a Python module that provides a thin wrapper around the
998@code{vagrant} command line executable, allowing programmatic control of Vagrant
999virtual machines.")
1000 (license license:expat)))