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