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