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