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