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