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