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