gnu: qemu: Fix CVE-2021-20203.
[jackhill/guix/guix.git] / gnu / packages / virtualization.scm
CommitLineData
b15fcf9e 1;;; GNU Guix --- Functional package management for GNU
4fc21327 2;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2020 Ludovic Courtès <ludo@gnu.org>
ecfe88b7 3;;; Copyright © 2015, 2016, 2017, 2018 Mark H Weaver <mhw@netris.org>
355892e1 4;;; Copyright © 2016, 2017, 2018. 2019, 2020 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>
9c769ace 9;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
0def9120 10;;; Copyright © 2018 Danny Milosavljevic <dannym@scratchpost.org>
de7f03ce 11;;; Copyright © 2018 Sou Bunnbu <iyzsong@member.fsf.org>
f6e55da0 12;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
17043677 13;;; Copyright © 2019 Guy Fleury Iteriteka <hoonandon@gmail.com>
f468df9f 14;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
e9126381 15;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
08cf730a 16;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
35c43fcd 17;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
d5d80a62 18;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
dd8e4411 19;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
b15fcf9e
LC
20;;;
21;;; This file is part of GNU Guix.
22;;;
23;;; GNU Guix is free software; you can redistribute it and/or modify it
24;;; under the terms of the GNU General Public License as published by
25;;; the Free Software Foundation; either version 3 of the License, or (at
26;;; your option) any later version.
27;;;
28;;; GNU Guix is distributed in the hope that it will be useful, but
29;;; WITHOUT ANY WARRANTY; without even the implied warranty of
30;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31;;; GNU General Public License for more details.
32;;;
33;;; You should have received a copy of the GNU General Public License
34;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
35
59132b80 36(define-module (gnu packages virtualization)
161ed547 37 #:use-module (gnu packages)
309693e0 38 #:use-module (gnu packages admin)
35e8900d 39 #:use-module (gnu packages assembly)
efcada41 40 #:use-module (gnu packages attr)
309693e0 41 #:use-module (gnu packages autotools)
e9126381 42 #:use-module (gnu packages backup)
72a91d74 43 #:use-module (gnu packages base)
ecfe88b7 44 #:use-module (gnu packages bison)
a0f6c3b3 45 #:use-module (gnu packages check)
35e8900d 46 #:use-module (gnu packages cmake)
b15fcf9e 47 #:use-module (gnu packages compression)
35e8900d 48 #:use-module (gnu packages cross-base)
309693e0
RW
49 #:use-module (gnu packages curl)
50 #:use-module (gnu packages cyrus-sasl)
7b572c5f 51 #:use-module (gnu packages debian)
309693e0 52 #:use-module (gnu packages disk)
8fc7bd23 53 #:use-module (gnu packages dns)
fe420383
RW
54 #:use-module (gnu packages docbook)
55 #:use-module (gnu packages documentation)
35e8900d
DM
56 #:use-module (gnu packages figlet)
57 #:use-module (gnu packages firmware)
ecfe88b7 58 #:use-module (gnu packages flex)
fb9472a3 59 #:use-module (gnu packages fontutils)
16a47f23 60 #:use-module (gnu packages freedesktop)
90a8ef8c 61 #:use-module (gnu packages gettext)
efcada41
DC
62 #:use-module (gnu packages gl)
63 #:use-module (gnu packages glib)
a0f6c3b3 64 #:use-module (gnu packages gnome)
7714a069 65 #:use-module (gnu packages gnupg)
de7f03ce 66 #:use-module (gnu packages golang)
72a91d74 67 #:use-module (gnu packages graphviz)
a0f6c3b3 68 #:use-module (gnu packages gtk)
72a91d74
MB
69 #:use-module (gnu packages haskell)
70 #:use-module (gnu packages haskell-apps)
71 #:use-module (gnu packages haskell-check)
72 #:use-module (gnu packages haskell-crypto)
73 #:use-module (gnu packages haskell-web)
74 #:use-module (gnu packages haskell-xyz)
e55354b8 75 #:use-module (gnu packages image)
5d1601ea 76 #:use-module (gnu packages libbsd)
fb9d7865 77 #:use-module (gnu packages libusb)
efcada41 78 #:use-module (gnu packages linux)
72a91d74 79 #:use-module (gnu packages m4)
efcada41 80 #:use-module (gnu packages ncurses)
71d4ba52 81 #:use-module (gnu packages nettle)
fe420383 82 #:use-module (gnu packages networking)
308af634 83 #:use-module (gnu packages onc-rpc)
7714a069 84 #:use-module (gnu packages package-management)
06da1a6b 85 #:use-module (gnu packages perl)
efcada41 86 #:use-module (gnu packages pkg-config)
309693e0 87 #:use-module (gnu packages polkit)
fe420383 88 #:use-module (gnu packages protobuf)
efcada41 89 #:use-module (gnu packages python)
dbcd2050 90 #:use-module (gnu packages python-build)
dd8e4411 91 #:use-module (gnu packages python-check)
72a91d74 92 #:use-module (gnu packages python-crypto)
589e3f4e 93 #:use-module (gnu packages python-web)
44d10b1f 94 #:use-module (gnu packages python-xyz)
28e3569f 95 #:use-module (gnu packages pulseaudio)
5d4a8f9b 96 #:use-module (gnu packages selinux)
efcada41 97 #:use-module (gnu packages sdl)
0411aca8 98 #:use-module (gnu packages sphinx)
38b9ce44 99 #:use-module (gnu packages spice)
72a91d74 100 #:use-module (gnu packages ssh)
efcada41 101 #:use-module (gnu packages texinfo)
71d4ba52 102 #:use-module (gnu packages textutils)
309693e0
RW
103 #:use-module (gnu packages tls)
104 #:use-module (gnu packages web)
35e8900d 105 #:use-module (gnu packages wget)
efcada41 106 #:use-module (gnu packages xdisorg)
309693e0 107 #:use-module (gnu packages xml)
8981465b 108 #:use-module (gnu packages xorg)
6da90719 109 #:use-module (guix build-system cmake)
efcada41 110 #:use-module (guix build-system gnu)
de7f03ce 111 #:use-module (guix build-system go)
cfd9913f 112 #:use-module (guix build-system meson)
7cd2032f 113 #:use-module (guix build-system python)
a838fa28 114 #:use-module (guix build-system trivial)
efcada41 115 #:use-module (guix download)
7714a069 116 #:use-module (guix git-download)
b23b9667 117 #:use-module ((guix licenses) #:prefix license:)
efcada41
DC
118 #:use-module (guix packages)
119 #:use-module (guix utils)
355892e1
EF
120 #:use-module (srfi srfi-1)
121 #:use-module (ice-9 match))
b15fcf9e 122
ce0be567 123(define (qemu-patch commit file-name sha256-bv)
e38a71ee
LC
124 "Return an origin for COMMIT."
125 (origin
126 (method url-fetch)
127 (uri (string-append
128 "http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h="
129 commit))
ce0be567 130 (hash (content-hash sha256-bv sha256))
e38a71ee
LC
131 (file-name file-name)))
132
06da1a6b 133(define-public qemu
b15fcf9e 134 (package
06da1a6b 135 (name "qemu")
d5d80a62 136 (version "5.1.0")
b15fcf9e 137 (source (origin
22909138
MC
138 (method url-fetch)
139 (uri (string-append "https://download.qemu.org/qemu-"
140 version ".tar.xz"))
795db9d2
S
141 (sha256
142 (base32
143 "1rd41wwlvp0vpialjp2czs6i3lsc338xc72l3zkbb7ixjfslw5y9"))
e05c0b33
LLB
144 (patches (search-patches "qemu-build-info-manual.patch"
145 "qemu-CVE-2021-20203.patch"))
795db9d2
S
146 (modules '((guix build utils)))
147 (snippet
148 '(begin
149 ;; Fix a bug in the do_ioctl_ifconf() function of qemu to
150 ;; make ioctl(…, SIOCGIFCONF, …) work for emulated 64 bit
151 ;; architectures. The size of struct ifreq is handled
152 ;; incorrectly.
153 ;; https://lists.nongnu.org/archive/html/qemu-devel/2021-01/msg01545.html
154 (substitute* '("linux-user/syscall.c")
155 (("^([[:blank:]]*)const argtype ifreq_arg_type.*$" line indent)
156 (string-append line indent
157 "const argtype ifreq_max_type[] = { MK_STRUCT(STRUCT_ifmap_ifreq) };\n"))
158 (("^([[:blank:]]*)target_ifreq_size[[:blank:]]=.*$" _ indent)
159 (string-append indent "target_ifreq_size = thunk_type_size(ifreq_max_type, 0);")))
160 #t))))
161 (outputs '("out" "doc")) ;4.7 MiB of HTML docs
162 (build-system gnu-build-system)
163 (arguments
710fd17a 164 `(;; FIXME: Disable tests on i686 to work around
4fc21327
LC
165 ;; <https://bugs.gnu.org/40527>.
166 #:tests? ,(or (%current-target-system)
167 (not (string=? "i686-linux" (%current-system))))
168
0e5d0f66 169 #:configure-flags (list "--enable-usb-redir" "--enable-opengl"
0411aca8 170 "--enable-docs"
0e5d0f66
RH
171 (string-append "--smbd="
172 (assoc-ref %outputs "out")
28e3569f
OP
173 "/libexec/samba-wrapper")
174 "--audio-drv-list=alsa,pa,sdl")
a1570c89
MB
175 ;; Make build and test output verbose to facilitate investigation upon failure.
176 #:make-flags '("V=1")
08cf730a
MO
177 #:modules ((srfi srfi-1)
178 (ice-9 match)
179 ,@%gnu-build-system-modules)
05051e8b
LC
180 #:phases
181 (modify-phases %standard-phases
08cf730a
MO
182 (add-after 'set-paths 'hide-glibc
183 (lambda* (#:key inputs #:allow-other-keys)
184 ;; Work around https://issues.guix.info/issue/36882. We need to
185 ;; remove glibc from C_INCLUDE_PATH so that the one hardcoded in GCC,
186 ;; at the bottom of GCC include search-path is used.
187 (let* ((filters '("libc"))
188 (input-directories
189 (filter-map (lambda (input)
190 (match input
191 ((name . dir)
192 (and (not (member name filters))
193 dir))))
194 inputs)))
195 (set-path-environment-variable "C_INCLUDE_PATH"
196 '("include")
197 input-directories)
198 #t)))
1b0cda6b
TGR
199 (add-after 'unpack 'extend-test-time-outs
200 (lambda _
201 ;; These tests can time out on heavily-loaded and/or slow storage.
202 (substitute* (cons* "tests/qemu-iotests/common.qemu"
203 (find-files "tests/qemu-iotests" "^[0-9]+$"))
204 (("QEMU_COMM_TIMEOUT=[0-9]+" match)
b070e3f8 205 (string-append match "9")))))
afeed71a
MC
206 (add-after 'unpack 'disable-unusable-tests
207 (lambda _
208 (substitute* "tests/Makefile.include"
209 ;; Comment out the test-qga test, which needs /sys and
210 ;; fails within the build environment.
211 (("check-unit-.* tests/test-qga" all)
212 (string-append "# " all))
213 ;; Comment out the test-char test, which needs networking and
214 ;; fails within the build environment.
215 (("check-unit-.* tests/test-char" all)
216 (string-append "# " all)))
217 (substitute* "tests/qtest/Makefile.include"
218 ;; Disable the following test, which triggers a crash on some
219 ;; x86 CPUs (see https://issues.guix.info/43048 and
220 ;; https://bugs.launchpad.net/qemu/+bug/1896263).
221 (("check-qtest-i386-y \\+= bios-tables-test" all)
222 (string-append "# " all)))
223 #t))
35c43fcd
MB
224 (add-after 'patch-source-shebangs 'patch-/bin/sh-references
225 (lambda _
226 ;; Ensure the executables created by these source files reference
227 ;; /bin/sh from the store so they work inside the build container.
228 (substitute* '("block/cloop.c" "migration/exec.c"
229 "net/tap.c" "tests/qtest/libqtest.c")
230 (("/bin/sh") (which "sh")))
231 #t))
05051e8b
LC
232 (replace 'configure
233 (lambda* (#:key inputs outputs (configure-flags '())
22909138 234 #:allow-other-keys)
05051e8b
LC
235 ;; The `configure' script doesn't understand some of the
236 ;; GNU options. Thus, add a new phase that's compatible.
237 (let ((out (assoc-ref outputs "out")))
238 (setenv "SHELL" (which "bash"))
b15fcf9e 239
05051e8b 240 ;; While we're at it, patch for tests.
35c43fcd
MB
241 (substitute* "tests/qemu-iotests/check"
242 (("#!/usr/bin/env python3")
243 (string-append "#!" (which "python3"))))
244
245 ;; Ensure config.status gets the correct shebang off the bat.
246 ;; The build system gets confused if we change it later and
247 ;; attempts to re-run the whole configury, and fails.
248 (substitute* "configure"
249 (("#!/bin/sh")
250 (string-append "#!" (which "sh"))))
50731c51 251
05051e8b
LC
252 ;; The binaries need to be linked against -lrt.
253 (setenv "LDFLAGS" "-lrt")
642d2db5
TGR
254 (apply invoke
255 `("./configure"
256 ,(string-append "--cc=" (which "gcc"))
257 ;; Some architectures insist on using HOST_CC
258 ,(string-append "--host-cc=" (which "gcc"))
259 "--disable-debug-info" ; save build space
260 "--enable-virtfs" ; just to be sure
261 ,(string-append "--prefix=" out)
262 ,(string-append "--sysconfdir=/etc")
263 ,@configure-flags)))))
0e5d0f66
RH
264 ;; Create a wrapper for Samba. This allows QEMU to use Samba without
265 ;; pulling it in as an input. Note that you need to explicitly install
266 ;; Samba in your Guix profile for Samba support.
38197bb5 267 (add-after 'install 'create-samba-wrapper
0e5d0f66 268 (lambda* (#:key inputs outputs #:allow-other-keys)
4d82e8e5 269 (let* ((out (assoc-ref outputs "out"))
0e5d0f66
RH
270 (libexec (string-append out "/libexec")))
271 (call-with-output-file "samba-wrapper"
272 (lambda (port)
273 (format port "#!/bin/sh
274exec smbd $@")))
275 (chmod "samba-wrapper" #o755)
276 (install-file "samba-wrapper" libexec))
4d82e8e5
MC
277 #t))
278 (add-after 'install 'move-html-doc
279 (lambda* (#:key inputs outputs #:allow-other-keys)
280 (let* ((out (assoc-ref outputs "out"))
281 (doc (assoc-ref outputs "doc"))
282 (qemu-doc (string-append doc "/share/doc/qemu-" ,version)))
283 (mkdir-p qemu-doc)
284 (rename-file (string-append out "/share/doc/qemu")
285 (string-append qemu-doc "/html")))
05051e8b 286 #t)))))
b15fcf9e 287 (inputs ; TODO: Add optional inputs.
2f042822
DC
288 `(("alsa-lib" ,alsa-lib)
289 ("attr" ,attr)
b15fcf9e 290 ("glib" ,glib)
90a8ef8c 291 ("gtk+" ,gtk+)
fa65e84a 292 ("libaio" ,libaio)
2f042822 293 ("libattr" ,attr)
a06051e1 294 ("libcacard" ,libcacard) ; smartcard support
35c43fcd 295 ("libcap-ng" ,libcap-ng) ; virtfs support requires libcap-ng & libattr
9a187b39
AP
296 ("libdrm" ,libdrm)
297 ("libepoxy" ,libepoxy)
513885b5 298 ("libjpeg" ,libjpeg-turbo)
2f042822 299 ("libpng" ,libpng)
34a28c13 300 ("libseccomp" ,libseccomp)
2f042822
DC
301 ("libusb" ,libusb) ;USB pass-through support
302 ("mesa" ,mesa)
303 ("ncurses" ,ncurses)
304 ;; ("pciutils" ,pciutils)
2b2fdd45 305 ("pixman" ,pixman)
28e3569f 306 ("pulseaudio" ,pulseaudio)
27b52c1f 307 ("sdl2" ,sdl2)
38b9ce44 308 ("spice" ,spice)
b376ec57 309 ("usbredir" ,usbredir)
b15fcf9e 310 ("util-linux" ,util-linux)
1e2640ba 311 ("vde2" ,vde2)
38b9ce44 312 ("virglrenderer" ,virglrenderer)
2f042822 313 ("zlib" ,zlib)))
90a8ef8c
RH
314 (native-inputs `(("gettext" ,gettext-minimal)
315 ("glib:bin" ,glib "bin") ; gtester, etc.
2f042822 316 ("perl" ,perl)
ecfe88b7
MW
317 ("flex" ,flex)
318 ("bison" ,bison)
2f042822 319 ("pkg-config" ,pkg-config)
27b52c1f 320 ("python-wrapper" ,python-wrapper)
0411aca8 321 ("python-sphinx" ,python-sphinx)
2f042822 322 ("texinfo" ,texinfo)))
ce9fbae1 323 (home-page "https://www.qemu.org")
06da1a6b 324 (synopsis "Machine emulator and virtualizer")
72b9eebf 325 (description
50731c51 326 "QEMU is a generic machine emulator and virtualizer.
72b9eebf
LC
327
328When used as a machine emulator, QEMU can run OSes and programs made for one
50731c51
LC
329machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
330using dynamic translation, it achieves very good performance.
72b9eebf
LC
331
332When used as a virtualizer, QEMU achieves near native performances by
333executing the guest code directly on the host CPU. QEMU supports
334virtualization when executing under the Xen hypervisor or using
335the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
50731c51
LC
336server and embedded PowerPC, and S390 guests.")
337
338 ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
b23b9667 339 (license license:gpl2)
f47638a3
LC
340
341 ;; Several tests fail on MIPS; see <http://hydra.gnu.org/build/117914>.
654de94e
JN
342 (supported-systems (fold delete %supported-systems
343 '("mips64el-linux" "i586-gnu")))))
50731c51 344
06da1a6b 345(define-public qemu-minimal
355892e1 346 ;; QEMU without GUI support, only supporting the host's architecture
06da1a6b
LC
347 (package (inherit qemu)
348 (name "qemu-minimal")
355892e1
EF
349 (synopsis
350 "Machine emulator and virtualizer (without GUI) for the host architecture")
06da1a6b 351 (arguments
b376ec57
AP
352 (substitute-keyword-arguments (package-arguments qemu)
353 ((#:configure-flags _ '(list))
355892e1 354 ;; Restrict to the host's architecture.
a31ea858
EF
355 (let ((system (or (%current-target-system)
356 (%current-system))))
357 (cond
358 ((string-prefix? "i686" system)
359 '(list "--target-list=i386-softmmu"))
360 ((string-prefix? "xasdf86_64" system)
361 '(list "--target-list=i386-softmmu,x86_64-softmmu"))
362 ((string-prefix? "mips64" system)
363 '(list (string-append "--target-list=mips-softmmu,mipsel-softmmu,"
364 "mips64-softmmu,mips64el-softmmu")))
365 ((string-prefix? "mips" system)
366 '(list "--target-list=mips-softmmu,mipsel-softmmu"))
367 ((string-prefix? "aarch64" system)
368 '(list "--target-list=arm-softmmu,aarch64-softmmu"))
369 ((string-prefix? "arm" system)
370 '(list "--target-list=arm-softmmu"))
371 ((string-prefix? "alpha" system)
372 '(list "--target-list=alpha-softmmu"))
373 ((string-prefix? "powerpc64" system)
374 '(list "--target-list=ppc-softmmu,ppc64-softmmu"))
375 ((string-prefix? "powerpc" system)
376 '(list "--target-list=ppc-softmmu"))
377 ((string-prefix? "s390" system)
378 '(list "--target-list=s390x-softmmu"))
379 ((string-prefix? "riscv" system)
380 '(list "--target-list=riscv32-softmmu,riscv64-softmmu"))
381 (else ; An empty list actually builds all the targets.
382 ''()))))))
06da1a6b
LC
383
384 ;; Remove dependencies on optional libraries, notably GUI libraries.
90a8ef8c
RH
385 (native-inputs (fold alist-delete (package-native-inputs qemu)
386 '("gettext")))
06da1a6b 387 (inputs (fold alist-delete (package-inputs qemu)
90a8ef8c 388 '("libusb" "mesa" "sdl2" "spice" "virglrenderer" "gtk+"
a414d6ac
CB
389 "usbredir" "libdrm" "libepoxy" "pulseaudio" "vde2"
390 "libcacard")))))
309693e0 391
72a91d74
MB
392(define (system->qemu-target system)
393 (cond
394 ((string-prefix? "i686" system)
395 "qemu-system-i386")
396 ((string-prefix? "arm" system)
397 "qemu-system-arm")
398 (else
399 (string-append "qemu-system-" (match (string-split system #\-)
400 ((arch kernel) arch)
401 (_ system))))))
402
403(define-public ganeti
404 (package
405 (name "ganeti")
406 ;; Note: we use a pre-release for Python 3 compatibility as well as many
407 ;; other fixes.
408 (version "3.0.0beta1-24-g024cc9fa2")
409 (source (origin
410 (method git-fetch)
411 (uri (git-reference
412 (url "https://github.com/ganeti/ganeti")
413 (commit (string-append "v" version))))
414 (sha256
415 (base32 "1ll34qd2mifni3bhg7cnir3xfnkafig8ch33qndqwrsby0y5ssia"))
416 (file-name (git-file-name name version))
417 (patches (search-patches "ganeti-shepherd-support.patch"
418 "ganeti-shepherd-master-failover.patch"
419 "ganeti-deterministic-manual.patch"
420 "ganeti-drbd-compat.patch"
421 "ganeti-os-disk-size.patch"
422 "ganeti-haskell-pythondir.patch"
423 "ganeti-disable-version-symlinks.patch"
424 "ganeti-preserve-PYTHONPATH.patch"))))
425 (build-system gnu-build-system)
426 (arguments
427 `(#:imported-modules (,@%gnu-build-system-modules
428 (guix build haskell-build-system)
429 (guix build python-build-system))
430 #:modules (,@%gnu-build-system-modules
431 ((guix build haskell-build-system) #:prefix haskell:)
432 ((guix build python-build-system) #:select (python-version))
433 (ice-9 rdelim))
434
435 ;; The default test target includes a lot of checks that are only really
436 ;; relevant for developers such as NEWS file checking, line lengths, etc.
437 ;; We are only interested in the "py-tests" and "hs-tests" targets: this
438 ;; is the closest we've got even though it includes a little more.
439 #:test-target "check-TESTS"
440
441 #:configure-flags
442 (list "--localstatedir=/var"
443 "--sharedstatedir=/var"
444 "--sysconfdir=/etc"
445 "--enable-haskell-tests"
446
447 ;; By default, the build system installs everything to versioned
448 ;; directories such as $libdir/3.0 and relies on a $libdir/default
449 ;; symlink pointed from /etc/ganeti/{lib,share} to actually function.
450 ;; This is done to accommodate installing multiple versions in
451 ;; parallel, but is of little use to us as Guix users can just
452 ;; roll back and forth. Thus, disable it for simplicity.
453 "--disable-version-links"
454
455 ;; Ganeti can optionally take control over SSH host keys and
456 ;; distribute them to nodes as they are added, and also rotate keys
457 ;; with 'gnt-cluster renew-crypto --new-ssh-keys'. Thus it needs to
458 ;; know how to restart the SSH daemon.
459 "--with-sshd-restart-command='herd restart ssh-daemon'"
460
461 ;; Look for OS definitions in this directory by default. It can
462 ;; be changed in the cluster configuration.
463 "--with-os-search-path=/run/current-system/profile/share/ganeti/os"
464
465 ;; The default QEMU executable to use. We don't use the package
466 ;; here because this entry is stored in the cluster configuration.
467 (string-append "--with-kvm-path=/run/current-system/profile/bin/"
468 ,(system->qemu-target (%current-system))))
469 #:phases
470 (modify-phases %standard-phases
471 (add-after 'unpack 'create-vcs-version
472 (lambda _
473 ;; If we are building from a git checkout, we need to create a
474 ;; 'vcs-version' file manually because the build system does
475 ;; not have access to the git repository information.
476 (unless (file-exists? "vcs-version")
477 (call-with-output-file "vcs-version"
478 (lambda (port)
479 (format port "v~a~%" ,version))))
480 #t))
481 (add-after 'unpack 'patch-absolute-file-names
482 (lambda _
483 (substitute* '("lib/utils/process.py"
484 "lib/utils/text.py"
485 "src/Ganeti/Constants.hs"
486 "src/Ganeti/HTools/CLI.hs"
487 "test/py/ganeti.config_unittest.py"
488 "test/py/ganeti.hooks_unittest.py"
489 "test/py/ganeti.utils.process_unittest.py"
490 "test/py/ganeti.utils.text_unittest.py"
491 "test/py/ganeti.utils.wrapper_unittest.py")
492 (("/bin/sh") (which "sh"))
493 (("/bin/bash") (which "bash"))
494 (("/usr/bin/env") (which "env"))
495 (("/bin/true") (which "true")))
496
497 ;; This script is called by the node daemon at startup to perform
498 ;; sanity checks on the cluster IP addresses, and it is also used
499 ;; in a master-failover scenario. Add absolute references to
500 ;; avoid propagating these executables.
501 (substitute* "tools/master-ip-setup"
502 (("arping") (which "arping"))
503 (("ndisc6") (which "ndisc6"))
504 (("fping") (which "fping"))
505 (("grep") (which "grep"))
506 (("ip addr") (string-append (which "ip") " addr")))
507 #t))
508 (add-after 'unpack 'override-builtin-PATH
509 (lambda _
510 ;; Ganeti runs OS install scripts and similar with a built-in
511 ;; hard coded PATH. Patch so it works on Guix System.
512 (substitute* "src/Ganeti/Constants.hs"
513 (("/sbin:/bin:/usr/sbin:/usr/bin")
514 "/run/setuid-programs:/run/current-system/profile/sbin:\
515/run/current-system/profile/bin"))
516 #t))
517 (add-after 'bootstrap 'patch-sphinx-version-detection
518 (lambda _
519 ;; The build system runs 'sphinx-build --version' to verify that
520 ;; the Sphinx is recent enough, but does not expect the
521 ;; .sphinx-build-real executable name created by the Sphinx wrapper.
522 (substitute* "configure"
523 (("\\$SPHINX --version 2>&1")
524 "$SPHINX --version 2>&1 | sed 's/.sphinx-build-real/sphinx-build/g'"))
525 #t))
526
527 ;; The build system invokes Cabal and GHC, which do not work with
528 ;; GHC_PACKAGE_PATH: <https://github.com/haskell/cabal/issues/3728>.
529 ;; Tweak the build system to do roughly what haskell-build-system does.
530 (add-before 'configure 'configure-haskell
531 (assoc-ref haskell:%standard-phases 'setup-compiler))
532 (add-after 'configure 'do-not-use-GHC_PACKAGE_PATH
533 (lambda _
534 (unsetenv "GHC_PACKAGE_PATH")
535 (substitute* "Makefile"
536 (("\\$\\(CABAL\\)")
537 "$(CABAL) --package-db=../package.conf.d")
538 (("\\$\\(GHC\\)")
539 "$(GHC) -package-db=../package.conf.d"))
540 #t))
856def7b
TS
541 (add-after 'configure 'make-ghc-use-shared-libraries
542 (lambda _
543 (substitute* "Makefile"
544 (("HFLAGS =") "HFLAGS = -dynamic -fPIC"))
545 #t))
72a91d74
MB
546 (add-after 'configure 'fix-installation-directories
547 (lambda _
548 (substitute* "Makefile"
549 ;; Do not attempt to create /var during install.
550 (("\\$\\(DESTDIR\\)\\$\\{localstatedir\\}")
551 "$(DESTDIR)${prefix}${localstatedir}")
552 ;; Similarly, do not attempt to install the sample ifup scripts
553 ;; to /etc/ganeti.
554 (("\\$\\(DESTDIR\\)\\$\\(ifupdir\\)")
555 "$(DESTDIR)${prefix}$(ifupdir)"))
556 #t))
557 (add-before 'build 'adjust-tests
558 (lambda _
559 ;; Disable tests that can not run. Do it early to prevent
560 ;; touching the Makefile later and triggering a needless rebuild.
561 (substitute* "Makefile"
562 ;; These tests expect the presence of a 'root' user (via
563 ;; ganeti/runtime.py), which fails in the build environment.
564 (("test/py/ganeti\\.asyncnotifier_unittest\\.py") "")
565 (("test/py/ganeti\\.backend_unittest\\.py") "")
566 (("test/py/ganeti\\.daemon_unittest\\.py") "")
567 (("test/py/ganeti\\.tools\\.ensure_dirs_unittest\\.py") "")
568 (("test/py/ganeti\\.utils\\.io_unittest-runasroot\\.py") "")
569 ;; Disable the bash_completion test, as it requires the full
570 ;; bash instead of bash-minimal.
571 (("test/py/bash_completion\\.bash")
572 "")
573 ;; This test requires networking.
574 (("test/py/import-export_unittest\\.bash")
575 ""))
576
577 ;; Many of the Makefile targets reset PYTHONPATH before running
578 ;; the Python interpreter, which does not work very well for us.
579 (substitute* "Makefile"
580 (("PYTHONPATH=")
581 (string-append "PYTHONPATH=" (getenv "PYTHONPATH") ":")))
582 #t))
583 (add-after 'build 'build-bash-completions
584 (lambda _
585 (let ((orig-pythonpath (getenv "PYTHONPATH")))
586 (setenv "PYTHONPATH" (string-append ".:" orig-pythonpath))
587 (invoke "./autotools/build-bash-completion")
588 (setenv "PYTHONPATH" orig-pythonpath)
589 #t)))
590 (add-before 'check 'pre-check
591 (lambda* (#:key inputs #:allow-other-keys)
592 ;; Set TZDIR so that time zones are found.
593 (setenv "TZDIR" (string-append (assoc-ref inputs "tzdata")
594 "/share/zoneinfo"))
595
596 ;; This test checks whether PYTHONPATH is untouched, and extends
597 ;; it to include test directories if so. Add an else branch for
598 ;; our modified PYTHONPATH, in order to prevent a confusing test
599 ;; failure where expired certificates are not cleaned because
600 ;; check-cert-expired is silently crashing.
601 (substitute* "test/py/ganeti-cleaner_unittest.bash"
602 (("then export PYTHONPATH=(.*)" all testpath)
603 (string-append all "else export PYTHONPATH="
604 (getenv "PYTHONPATH") ":" testpath "\n")))
605
606 (substitute* "test/py/ganeti.utils.process_unittest.py"
607 ;; This test attempts to run an executable with
608 ;; RunCmd(..., reset_env=True), which fails because the default
609 ;; PATH from Constants.hs does not exist in the build container.
610 ((".*def testResetEnv.*" all)
611 (string-append " @unittest.skipIf(True, "
612 "\"cannot reset env in the build container\")\n"
613 all))
614
615 ;; XXX: Somehow this test fails in the build container, but
616 ;; works in 'guix environment -C', even without /bin/sh?
617 ((".*def testPidFile.*" all)
618 (string-append " @unittest.skipIf(True, "
619 "\"testPidFile fails in the build container\")\n"
620 all)))
621
622 ;; XXX: Why are these links not added automatically.
623 (with-directory-excursion "test/hs"
624 (for-each (lambda (file)
625 (symlink "../../src/htools" file))
626 '("hspace" "hscan" "hinfo" "hbal" "hroller"
627 "hcheck" "hail" "hsqueeze")))
628 #t))
629 (add-after 'install 'install-bash-completions
630 (lambda* (#:key outputs #:allow-other-keys)
631 (let* ((out (assoc-ref outputs "out"))
632 (compdir (string-append out "/etc/bash_completion.d")))
633 (mkdir-p compdir)
634 (copy-file "doc/examples/bash_completion"
635 (string-append compdir "/ganeti"))
636 ;; The one file contains completions for many different
637 ;; executables. Create symlinks for found completions.
638 (with-directory-excursion compdir
639 (for-each
640 (lambda (prog) (symlink "ganeti" prog))
641 (call-with-input-file "ganeti"
642 (lambda (port)
643 (let loop ((line (read-line port))
644 (progs '()))
645 (if (eof-object? line)
646 progs
647 (if (string-prefix? "complete" line)
648 (loop (read-line port)
649 ;; Extract "prog" from lines of the form:
650 ;; "complete -F _prog -o filenames prog".
651 ;; Note that 'burnin' is listed with the
652 ;; absolute file name, which is why we
653 ;; run everything through 'basename'.
654 (cons (basename (car (reverse (string-split
655 line #\ ))))
656 progs))
657 (loop (read-line port) progs))))))))
658 #t)))
659 ;; Wrap all executables with PYTHONPATH. We can't borrow the phase
660 ;; from python-build-system because we also need to wrap the scripts
661 ;; in $out/lib/ganeti such as "node-daemon-setup".
662 (add-after 'install 'wrap
663 (lambda* (#:key inputs outputs #:allow-other-keys)
664 (let* ((out (assoc-ref outputs "out"))
665 (sbin (string-append out "/sbin"))
666 (lib (string-append out "/lib"))
667 (python (assoc-ref inputs "python"))
668 (major+minor (python-version python))
669 (PYTHONPATH (string-append lib "/python" major+minor
670 "/site-packages:"
671 (getenv "PYTHONPATH"))))
672 (define (shell-script? file)
673 (call-with-ascii-input-file file
674 (lambda (port)
675 (let ((shebang (false-if-exception (read-line port))))
676 (and shebang
677 (string-prefix? "#!" shebang)
678 (or (string-contains shebang "/bin/bash")
679 (string-contains shebang "/bin/sh")))))))
680
681 (define (wrap? file)
682 ;; Do not wrap shell scripts because some are meant to be
683 ;; sourced, which breaks if they are wrapped. We do wrap
684 ;; the Haskell executables because some call out to Python
685 ;; directly.
686 (and (executable-file? file)
687 (not (symbolic-link? file))
688 (not (shell-script? file))))
689
690 (for-each (lambda (file)
691 (wrap-program file
692 `("PYTHONPATH" ":" prefix (,PYTHONPATH))))
693 (filter wrap?
694 (append (find-files (string-append lib "/ganeti"))
695 (find-files sbin))))
696 #t))))))
697 (native-inputs
698 `(("haskell" ,ghc)
699 ("cabal" ,cabal-install)
700 ("m4" ,m4)
701
702 ;; These inputs are necessary to bootstrap the package, because we
703 ;; have patched the build system.
704 ("autoconf" ,autoconf)
705 ("automake" ,automake)
706
707 ;; For the documentation.
708 ("python-docutils" ,python-docutils)
709 ("sphinx" ,python-sphinx)
88533283 710 ("pandoc" ,pandoc)
72a91d74
MB
711 ("dot" ,graphviz)
712
713 ;; Test dependencies.
714 ("fakeroot" ,fakeroot)
715 ("ghc-temporary" ,ghc-temporary)
716 ("ghc-test-framework" ,ghc-test-framework)
717 ("ghc-test-framework-hunit" ,ghc-test-framework-hunit)
718 ("ghc-test-framework-quickcheck2" ,ghc-test-framework-quickcheck2)
719 ("python-mock" ,python-mock)
720 ("python-pyyaml" ,python-pyyaml)
721 ("openssh" ,openssh)
722 ("procps" ,procps)
723 ("shelltestrunner" ,shelltestrunner)
724 ("tzdata" ,tzdata-for-tests)))
725 (inputs
726 `(("arping" ,iputils) ;must be the iputils version
727 ("curl" ,curl)
728 ("fping" ,fping)
729 ("iproute2" ,iproute)
730 ("ndisc6" ,ndisc6)
731 ("socat" ,socat)
732 ("qemu" ,qemu-minimal) ;for qemu-img
733 ("ghc-attoparsec" ,ghc-attoparsec)
734 ("ghc-base64-bytestring" ,ghc-base64-bytestring)
735 ("ghc-cryptonite" ,ghc-cryptonite)
736 ("ghc-curl" ,ghc-curl)
737 ("ghc-hinotify" ,ghc-hinotify)
738 ("ghc-hslogger" ,ghc-hslogger)
739 ("ghc-json" ,ghc-json)
740 ("ghc-lens" ,ghc-lens)
741 ("ghc-lifted-base" ,ghc-lifted-base)
742 ("ghc-network" ,ghc-network)
743 ("ghc-old-time" ,ghc-old-time)
744 ("ghc-psqueue" ,ghc-psqueue)
745 ("ghc-regex-pcre" ,ghc-regex-pcre)
746 ("ghc-utf8-string" ,ghc-utf8-string)
747 ("ghc-zlib" ,ghc-zlib)
748
749 ;; For the optional metadata daemon.
750 ("ghc-snap-core" ,ghc-snap-core)
751 ("ghc-snap-server" ,ghc-snap-server)
752
753 ("python" ,python)
754 ("python-pyopenssl" ,python-pyopenssl)
755 ("python-simplejson" ,python-simplejson)
756 ("python-pyparsing" ,python-pyparsing)
757 ("python-pyinotify" ,python-pyinotify)
758 ("python-pycurl" ,python-pycurl)
759 ("python-bitarray" ,python-bitarray)
760 ("python-paramiko" ,python-paramiko)
761 ("python-psutil" ,python-psutil)))
762 (home-page "http://www.ganeti.org/")
763 (synopsis "Cluster-based virtual machine management system")
764 (description
765 "Ganeti is a virtual machine management tool built on top of existing
766virtualization technologies such as Xen or KVM. Ganeti controls:
767
768@itemize @bullet
769@item Disk creation management;
770@item Operating system installation for instances (in co-operation with
771OS-specific install scripts); and
772@item Startup, shutdown, and failover between physical systems.
773@end itemize
774
775Ganeti is designed to facilitate cluster management of virtual servers and
776to provide fast and simple recovery after physical failures, using
777commodity hardware.")
778 (license license:bsd-2)))
779
ecd5db37
MB
780(define-public ganeti-instance-guix
781 (package
782 (name "ganeti-instance-guix")
783 (version "0.6")
784 (home-page "https://github.com/mbakke/ganeti-instance-guix")
785 (source (origin
786 (method git-fetch)
787 (uri (git-reference (url home-page) (commit version)))
788 (file-name (git-file-name name version))
789 (sha256
790 (base32
791 "0aa08irpcpns6mhjgsplc5f0p8ab1qcr9ah1gj5z66kxgqyflzrp"))))
792 (build-system gnu-build-system)
793 (arguments
794 '(#:configure-flags '("--sysconfdir=/etc" "--localstatedir=/var")))
795 (native-inputs
796 `(("autoconf" ,autoconf)
797 ("automake" ,automake)))
798 (inputs
799 `(("util-linux" ,util-linux)
800 ("qemu-img" ,qemu-minimal)))
801 (synopsis "Guix OS integration for Ganeti")
802 (description
803 "This package provides a guest OS definition for Ganeti that uses
804Guix to build virtual machines.")
805 (license license:gpl3+)))
806
7b572c5f
MB
807(define-public ganeti-instance-debootstrap
808 (package
809 (name "ganeti-instance-debootstrap")
810 ;; We need two commits on top of the latest release for compatibility
811 ;; with newer sfdisk, as well as gnt-network integration.
812 (version "0.16-2-ge145396")
813 (home-page "https://github.com/ganeti/instance-debootstrap")
814 (source (origin
815 (method git-fetch)
816 (uri (git-reference (url home-page) (commit version)))
7d49e189 817 (file-name (git-file-name name version))
7b572c5f
MB
818 (sha256
819 (base32
820 "0f2isw9d8lawzj21rrq1q9xhq8xfa65rqbhqmrn59z201x9q1336"))))
821 (build-system gnu-build-system)
822 (arguments
823 '(#:configure-flags '("--sysconfdir=/etc" "--localstatedir=/var")
824 #:phases (modify-phases %standard-phases
825 (add-after 'unpack 'add-absolute-references
826 (lambda _
827 (substitute* "common.sh.in"
828 (("/sbin/blkid") (which "blkid"))
829 (("kpartx -")
830 (string-append (which "kpartx") " -")))
831 (substitute* "import"
832 (("restore -r")
833 (string-append (which "restore") " -r")))
834 (substitute* "export"
835 (("dump -0")
836 (string-append (which "dump") " -0")))
837 (substitute* "create"
838 (("debootstrap") (which "debootstrap"))
839 (("`which run-parts`") (which "run-parts"))
840 ;; Here we actually need to hard code /bin/passwd
841 ;; because it's called via chroot, which fails if
842 ;; "/bin" is not in PATH.
843 (("passwd") "/bin/passwd"))
844 #t))
845 (add-after 'unpack 'set-dpkg-arch
846 (lambda* (#:key system #:allow-other-keys)
847 ;; The create script passes --arch to debootstrap,
848 ;; and defaults to `dpkg --print-architecture` when
849 ;; ARCH is not set in variant.conf. Hard code the
850 ;; build-time architecture to avoid the dpkg dependency.
851 (let ((dpkg-arch
852 (cond ((string-prefix? "x86_64" system)
853 "amd64")
854 ((string-prefix? "i686" system)
855 "i386")
856 ((string-prefix? "aarch64" system)
857 "arm64")
858 (else (car (string-split system #\-))))))
859 (substitute* "create"
860 (("`dpkg --print-architecture`")
861 dpkg-arch))
862 #t)))
863 (add-after 'configure 'adjust-Makefile
864 (lambda _
865 ;; Do not attempt to create /etc/ganeti/instance-debootstrap
866 ;; and /etc/default/ganeti-instance-debootstrap during install.
867 ;; They are created by the Ganeti service.
868 (substitute* "Makefile"
869 (("\\$\\(variantsdir\\)")
870 "$(prefix)/etc/ganeti/instance-debootstrap/variants")
871 (("\\$\\(defaultsdir\\)")
872 "$(prefix)/etc/default/ganeti-instance-debootstrap"))
873 #t))
874 (add-after 'install 'make-variants.list-symlink
875 (lambda* (#:key outputs #:allow-other-keys)
876 ;; The Ganeti OS API mandates a variants.list file that
877 ;; describes all supported "variants" of this OS.
878 ;; Guix generates this file, so make the original file
879 ;; a symlink to it.
880 (with-directory-excursion (string-append
881 (assoc-ref outputs "out")
882 "/share/ganeti/os/debootstrap")
883 (delete-file "variants.list")
884 (symlink "/etc/ganeti/instance-debootstrap/variants/variants.list"
885 "variants.list"))
886 #t)))))
887 (native-inputs
888 `(("autoconf" ,autoconf)
889 ("automake" ,automake)))
890 (inputs
891 `(("debianutils" ,debianutils)
892 ("debootstrap" ,debootstrap)
893 ("dump" ,dump)
894 ("kpartx" ,multipath-tools)
895 ("util-linux" ,util-linux)))
896 (synopsis "Debian OS integration for Ganeti")
897 (description
898 "This package provides a guest OS definition for Ganeti. It installs
899Debian or a derivative using @command{debootstrap}.")
900 (license license:gpl2+)))
901
a0f6c3b3
RW
902(define-public libosinfo
903 (package
904 (name "libosinfo")
cfd9913f 905 (version "1.7.1")
a0f6c3b3
RW
906 (source
907 (origin
908 (method url-fetch)
d701f8bd 909 (uri (string-append "https://releases.pagure.org/libosinfo/libosinfo-"
cfd9913f 910 version ".tar.xz"))
a0f6c3b3
RW
911 (sha256
912 (base32
cfd9913f
CB
913 "1s97sv24bybggjx6hgqba2qdqz3ivfpd4cmkh4zm5y59sim109mv"))))
914 (build-system meson-build-system)
a0f6c3b3 915 (arguments
d701f8bd 916 `(#:configure-flags
cfd9913f 917 (list (string-append "-Dwith-usb-ids-path="
d701f8bd 918 (assoc-ref %build-inputs "usb.ids"))
cfd9913f 919 (string-append "-Dwith-pci-ids-path="
da6f9ace
BW
920 (assoc-ref %build-inputs "pci.ids")))
921 #:phases
922 (modify-phases %standard-phases
923 (add-after 'unpack 'patch-osinfo-path
924 (lambda* (#:key inputs #:allow-other-keys)
925 (substitute* "osinfo/osinfo_loader.c"
926 (("path = DATA_DIR.*")
927 (string-append "path = \"" (assoc-ref inputs "osinfo-db")
928 "/share/osinfo\";")))
929 #t)))))
a0f6c3b3
RW
930 (inputs
931 `(("libsoup" ,libsoup)
932 ("libxml2" ,libxml2)
933 ("libxslt" ,libxslt)
da6f9ace 934 ("osinfo-db" ,osinfo-db)))
a0f6c3b3 935 (native-inputs
d1e766e5 936 `(("glib" ,glib "bin") ; glib-mkenums, etc.
da6f9ace 937 ("gobject-introspection" ,gobject-introspection)
a0f6c3b3
RW
938 ("gtk-doc" ,gtk-doc)
939 ("vala" ,vala)
940 ("intltool" ,intltool)
941 ("pkg-config" ,pkg-config)
942 ("pci.ids"
943 ,(origin
944 (method url-fetch)
d701f8bd 945 (uri "https://github.com/pciutils/pciids/raw/ad02084f0bc143e3c15e31a6152a3dfb1d7a3156/pci.ids")
a0f6c3b3
RW
946 (sha256
947 (base32
d701f8bd 948 "0kfhpj5rnh24hz2714qhfmxk281vwc2w50sm73ggw5d15af7zfsw"))))
a0f6c3b3
RW
949 ("usb.ids"
950 ,(origin
951 (method url-fetch)
0d73f148 952 (uri "https://svn.code.sf.net/p/linux-usb/repo/trunk/htdocs/usb.ids?r=2681")
b02733d4 953 (file-name "usb.ids")
a0f6c3b3
RW
954 (sha256
955 (base32
0d73f148 956 "1m6yhvz5k8aqzxgk7xj3jkk8frl1hbv0h3vgj4wbnvnx79qnvz3r"))))))
a0f6c3b3
RW
957 (home-page "https://libosinfo.org/")
958 (synopsis "Operating system information database")
959 (description "libosinfo is a GObject based library API for managing
960information about operating systems, hypervisors and the (virtual) hardware
961devices they can support. It includes a database containing device metadata
962and provides APIs to match/identify optimal devices for deploying an operating
963system on a hypervisor. Via GObject Introspection, the API is available in
964all common programming languages. Vala bindings are also provided.")
965 ;; The library files are released under LGPLv2.1 or later; the source
966 ;; files in the "tools" directory are released under GPLv2+.
b23b9667 967 (license (list license:lgpl2.1+ license:gpl2+))))
a0f6c3b3 968
5d4a8f9b
SB
969(define-public lxc
970 (package
971 (name "lxc")
8eb5f097 972 (version "4.0.6")
5d4a8f9b
SB
973 (source (origin
974 (method url-fetch)
975 (uri (string-append
976 "https://linuxcontainers.org/downloads/lxc/lxc-"
977 version ".tar.gz"))
978 (sha256
979 (base32
8eb5f097 980 "0qz4l7mlhq7hx53q606qgvkyzyr01glsw290v8ppzvxn1fydlrci"))))
5d4a8f9b
SB
981 (build-system gnu-build-system)
982 (native-inputs
983 `(("pkg-config" ,pkg-config)))
984 (inputs
985 `(("gnutls" ,gnutls)
986 ("libcap" ,libcap)
987 ("libseccomp" ,libseccomp)
988 ("libselinux" ,libselinux)))
989 (arguments
2e625ef7
TGR
990 `(#:configure-flags
991 (list (string-append "--docdir=" (assoc-ref %outputs "out")
992 "/share/doc/" ,name "-" ,version)
993 "--sysconfdir=/etc"
994 "--localstatedir=/var")
5d4a8f9b
SB
995 #:phases
996 (modify-phases %standard-phases
997 (replace 'install
998 (lambda* (#:key outputs #:allow-other-keys)
999 (let* ((out (assoc-ref outputs "out"))
1000 (bashcompdir (string-append out "/etc/bash_completion.d")))
d6870d10 1001 (invoke "make" "install"
5d4a8f9b
SB
1002 (string-append "bashcompdir=" bashcompdir)
1003 ;; Don't install files into /var and /etc.
1004 "LXCPATH=/tmp/var/lib/lxc"
1005 "localstatedir=/tmp/var"
1006 "sysconfdir=/tmp/etc"
d6870d10 1007 "sysconfigdir=/tmp/etc/default")))))))
5d4a8f9b
SB
1008 (synopsis "Linux container tools")
1009 (home-page "https://linuxcontainers.org/")
1010 (description
1011 "LXC is a userspace interface for the Linux kernel containment features.
1012Through a powerful API and simple tools, it lets Linux users easily create and
1013manage system or application containers.")
b23b9667 1014 (license license:lgpl2.1+)))
5d4a8f9b 1015
309693e0
RW
1016(define-public libvirt
1017 (package
1018 (name "libvirt")
aa1f0896 1019 (version "5.8.0")
41097b2d
TGR
1020 (source
1021 (origin
1022 (method url-fetch)
1023 (uri (string-append "https://libvirt.org/sources/libvirt-"
1024 version ".tar.xz"))
1025 (sha256
aa1f0896
MÁAV
1026 (base32 "0m8cqaqflvys5kaqpvb0qr4k365j09jc5xk6x70yvg8qkcl2hcz2"))
1027 (patches
1028 (search-patches "libvirt-create-machine-cgroup.patch"))))
309693e0
RW
1029 (build-system gnu-build-system)
1030 (arguments
bd9eb384 1031 `(#:configure-flags
ef640db2
SB
1032 (list "--with-qemu"
1033 "--with-qemu-user=nobody"
1034 "--with-qemu-group=kvm"
1035 "--with-polkit"
175047cd
TGR
1036 (string-append "--docdir=" (assoc-ref %outputs "out") "/share/doc/"
1037 ,name "-" ,version)
a4b93921 1038 "--sysconfdir=/etc"
309693e0
RW
1039 "--localstatedir=/var")
1040 #:phases
1041 (modify-phases %standard-phases
bd9eb384
TGR
1042 (add-before 'configure 'fix-BOURNE_SHELL-definition
1043 ;; BOURNE_SHELL is hard-#defined to ‘/bin/sh’, causing test failures.
309693e0 1044 (lambda _
bd9eb384 1045 (substitute* "config.h.in"
309693e0
RW
1046 (("/bin/sh") (which "sh")))
1047 #t))
308af634
MB
1048 (add-before 'configure 'patch-libtirpc-file-names
1049 (lambda* (#:key inputs #:allow-other-keys)
1050 ;; libvirt uses an m4 macro instead of pkg-config to determine where
1051 ;; the RPC headers are located. Tell it to look in the right place.
1052 (substitute* "configure"
1053 (("/usr/include/tirpc") ;defined in m4/virt-xdr.m4
1054 (string-append (assoc-ref inputs "libtirpc")
1055 "/include/tirpc")))
1056 #t))
bd9eb384
TGR
1057 (add-before 'configure 'disable-broken-tests
1058 (lambda _
1059 (let ((tests (list "commandtest" ; hangs idly
b905ebed
JK
1060 "qemuxml2argvtest" ; fails
1061 "qemuhotplugtest" ; fails
bd9eb384
TGR
1062 "virnetsockettest" ; tries to network
1063 "virshtest"))) ; fails
1064 (substitute* "tests/Makefile.in"
1065 (((format #f "(~a)\\$\\(EXEEXT\\)" (string-join tests "|")))
1066 ""))
1067 #t)))
a4b93921
SB
1068 (replace 'install
1069 ;; Since the sysconfdir and localstatedir should be /etc and /var
1070 ;; at runtime, we must prevent writing to them at installation
1071 ;; time.
7aee2f57
TGR
1072 (lambda* (#:key make-flags #:allow-other-keys)
1073 (apply invoke "make" "install"
1074 "sysconfdir=/tmp/etc"
1075 "localstatedir=/tmp/var"
ef640db2 1076 make-flags))))))
309693e0
RW
1077 (inputs
1078 `(("libxml2" ,libxml2)
8981465b
RH
1079 ("eudev" ,eudev)
1080 ("libpciaccess" ,libpciaccess)
309693e0
RW
1081 ("gnutls" ,gnutls)
1082 ("dbus" ,dbus)
309693e0
RW
1083 ("libpcap" ,libpcap)
1084 ("libnl" ,libnl)
308af634 1085 ("libtirpc" ,libtirpc) ;for <rpc/rpc.h>
bb93042c 1086 ("libuuid" ,util-linux "lib")
308af634 1087 ("lvm2" ,lvm2) ;for libdevmapper
309693e0
RW
1088 ("curl" ,curl)
1089 ("openssl" ,openssl)
1090 ("cyrus-sasl" ,cyrus-sasl)
309693e0 1091 ("libyajl" ,libyajl)
8fc7bd23
SB
1092 ("audit" ,audit)
1093 ("dmidecode" ,dmidecode)
1094 ("dnsmasq" ,dnsmasq)
1095 ("ebtables" ,ebtables)
1096 ("iproute" ,iproute)
1097 ("iptables" ,iptables)))
309693e0 1098 (native-inputs
2f110b32 1099 `(("xsltproc" ,libxslt)
b8fb94d5
TGR
1100 ("perl" ,perl)
1101 ("pkg-config" ,pkg-config)
1102 ("polkit" ,polkit)
aa1f0896 1103 ("python" ,python-wrapper)))
2e508b6d 1104 (home-page "https://libvirt.org")
309693e0
RW
1105 (synopsis "Simple API for virtualization")
1106 (description "Libvirt is a C toolkit to interact with the virtualization
1107capabilities of recent versions of Linux. The library aims at providing long
1108term stable C API initially for the Xen paravirtualization but should be able
1109to integrate other virtualization mechanisms if needed.")
b23b9667 1110 (license license:lgpl2.1+)))
597ea122
RW
1111
1112(define-public libvirt-glib
1113 (package
1114 (name "libvirt-glib")
a9838ee0 1115 (version "3.0.0")
597ea122
RW
1116 (source (origin
1117 (method url-fetch)
1118 (uri (string-append "ftp://libvirt.org/libvirt/glib/"
1119 "libvirt-glib-" version ".tar.gz"))
1120 (sha256
1121 (base32
a9838ee0 1122 "1zpbv4ninc57c9rw4zmmkvvqn7154iv1qfr20kyxn8xplalqrzvz"))))
597ea122 1123 (build-system gnu-build-system)
597ea122 1124 (inputs
7e2c050a 1125 `(("openssl" ,openssl)
597ea122 1126 ("cyrus-sasl" ,cyrus-sasl)
7e2c050a 1127 ("lvm2" ,lvm2) ; for libdevmapper
597ea122
RW
1128 ("libyajl" ,libyajl)))
1129 (native-inputs
1130 `(("pkg-config" ,pkg-config)
1131 ("intltool" ,intltool)
1132 ("glib" ,glib "bin")
1133 ("vala" ,vala)))
7e2c050a
TGR
1134 (propagated-inputs
1135 ;; ‘Required:’ by the installed .pc files.
1136 `(("glib" ,glib)
1137 ("libvirt" ,libvirt)
1138 ("libxml2" ,libxml2)
1139 ("gobject-introspection" ,gobject-introspection)))
b3fee5c1 1140 (home-page "https://libvirt.org")
597ea122
RW
1141 (synopsis "GLib wrapper around libvirt")
1142 (description "libvirt-glib wraps the libvirt library to provide a
1143high-level object-oriented API better suited for glib-based applications, via
1144three libraries:
1145
1146@enumerate
1147@item libvirt-glib - GLib main loop integration & misc helper APIs
1148@item libvirt-gconfig - GObjects for manipulating libvirt XML documents
1149@item libvirt-gobject - GObjects for managing libvirt objects
1150@end enumerate
1151")
b23b9667 1152 (license license:lgpl2.1+)))
7cd2032f
RW
1153
1154(define-public python-libvirt
1155 (package
1156 (name "python-libvirt")
0e00c1c4 1157 (version "5.8.0")
cb94ae38
TGR
1158 (source
1159 (origin
1160 (method url-fetch)
cb94ae38
TGR
1161 (uri (string-append "https://libvirt.org/sources/python/libvirt-python-"
1162 version ".tar.gz"))
1163 (sha256
0e00c1c4 1164 (base32 "0kyz3lx49d8p75mvbzinxc1zgs8g7adn77y9bm15b8b4ad9zl5s6"))))
7cd2032f
RW
1165 (build-system python-build-system)
1166 (arguments
1167 `(#:phases
1168 (modify-phases %standard-phases
1169 (add-after 'unpack 'patch-nosetests-path
1170 (lambda* (#:key inputs #:allow-other-keys)
1171 (substitute* "setup.py"
9271dfdd
SB
1172 (("\"/usr/bin/nosetests\"")
1173 (string-append "\"" (which "nosetests") "\""))
1174 (("self\\.spawn\\(\\[sys\\.executable, nose\\]\\)")
1175 (format #f "self.spawn([\"~a\", nose])" (which "bash"))))
7cd2032f
RW
1176 #t)))))
1177 (inputs
482d9591
HG
1178 `(("libvirt" ,libvirt)))
1179 (propagated-inputs
1180 `(("python-lxml" ,python-lxml)))
7cd2032f
RW
1181 (native-inputs
1182 `(("pkg-config" ,pkg-config)
1183 ("python-nose" ,python-nose)))
b3fee5c1 1184 (home-page "https://libvirt.org")
7cd2032f
RW
1185 (synopsis "Python bindings to libvirt")
1186 (description "This package provides Python bindings to the libvirt
1187virtualization library.")
b23b9667 1188 (license license:lgpl2.1+)))
7cd2032f
RW
1189
1190(define-public python2-libvirt
1191 (package-with-python2 python-libvirt))
2f82b53b
RW
1192
1193(define-public virt-manager
1194 (package
1195 (name "virt-manager")
845bf4f4 1196 (version "2.2.1")
2f82b53b
RW
1197 (source (origin
1198 (method url-fetch)
1199 (uri (string-append "https://virt-manager.org/download/sources"
1200 "/virt-manager/virt-manager-"
1201 version ".tar.gz"))
1202 (sha256
1203 (base32
845bf4f4 1204 "06ws0agxlip6p6n3n43knsnjyd91gqhh2dadgc33wl9lx1k8vn6g"))))
2f82b53b
RW
1205 (build-system python-build-system)
1206 (arguments
af7014a1 1207 `(#:use-setuptools? #f ; uses custom distutils 'install' command
20f524a4
CB
1208 #:test-target "test_ui"
1209 #:tests? #f ; TODO The tests currently fail
1210 ; RuntimeError: Loop condition wasn't
1211 ; met
f023685d
AP
1212 #:imported-modules ((guix build glib-or-gtk-build-system)
1213 ,@%python-build-system-modules)
2f82b53b
RW
1214 #:modules ((ice-9 match)
1215 (srfi srfi-26)
1216 (guix build python-build-system)
f023685d 1217 ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
2f82b53b
RW
1218 (guix build utils))
1219 #:phases
1220 (modify-phases %standard-phases
1221 (add-after 'unpack 'fix-setup
1222 (lambda* (#:key outputs #:allow-other-keys)
845bf4f4 1223 (substitute* "virtinst/buildconfig.py"
2f82b53b
RW
1224 (("/usr") (assoc-ref outputs "out")))
1225 #t))
845bf4f4
MÁAV
1226 (add-after 'unpack 'fix-qemu-img-reference
1227 (lambda* (#:key inputs #:allow-other-keys)
1228 (substitute* "virtconv/formats.py"
b905ebed
JK
1229 (("/usr(/bin/qemu-img)" _ suffix)
1230 (string-append (assoc-ref inputs "qemu") suffix)))
845bf4f4 1231 #t))
4ad8fbd1
AP
1232 (add-after 'unpack 'fix-default-uri
1233 (lambda* (#:key inputs #:allow-other-keys)
af7014a1 1234 ;; Xen is not available for now - so only patch qemu.
845bf4f4 1235 (substitute* "virtManager/createconn.py"
4ad8fbd1
AP
1236 (("/usr(/bin/qemu-system)" _ suffix)
1237 (string-append (assoc-ref inputs "qemu") suffix)))
1238 #t))
2f82b53b
RW
1239 (add-before 'wrap 'wrap-with-GI_TYPELIB_PATH
1240 (lambda* (#:key inputs outputs #:allow-other-keys)
1241 (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
1242 (bin-files (find-files bin ".*"))
1243 (paths (map (match-lambda
1244 ((output . directory)
1245 (let* ((girepodir (string-append
1246 directory
1247 "/lib/girepository-1.0")))
1248 (if (file-exists? girepodir)
1249 girepodir #f))))
1250 inputs)))
1251 (for-each (lambda (file)
1252 (format #t "wrapping ~a\n" file)
1253 (wrap-program file
1254 `("GI_TYPELIB_PATH" ":" prefix
1255 ,(filter identity paths))))
1256 bin-files))
f023685d 1257 #t))
20f524a4
CB
1258 (replace 'check
1259 (lambda* (#:key tests? #:allow-other-keys)
1260 (when tests?
1261 (setenv "HOME" "/tmp")
1262 (system "Xvfb :1 &")
1263 (setenv "DISPLAY" ":1")
1264 ;; Dogtail requires that Assistive Technology support be enabled
1265 (setenv "GTK_MODULES" "gail:atk-bridge")
1266 (invoke "dbus-run-session" "--" "python" "setup.py" "test_ui"))
1267 #t))
f023685d
AP
1268 (add-after 'install 'glib-or-gtk-compile-schemas
1269 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
1270 (add-after 'install 'glib-or-gtk-wrap
1271 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
2f82b53b 1272 (inputs
b1e9837a
AP
1273 `(("dconf" ,dconf)
1274 ("gtk+" ,gtk+)
45214efe 1275 ("gtk-vnc" ,gtk-vnc)
845bf4f4 1276 ("gtksourceview" ,gtksourceview)
2f82b53b
RW
1277 ("libvirt" ,libvirt)
1278 ("libvirt-glib" ,libvirt-glib)
1279 ("libosinfo" ,libosinfo)
45214efe 1280 ("vte" ,vte)
f8be7664
RH
1281 ("python-libvirt" ,python-libvirt)
1282 ("python-requests" ,python-requests)
f8be7664
RH
1283 ("python-pycairo" ,python-pycairo)
1284 ("python-pygobject" ,python-pygobject)
1285 ("python-libxml2" ,python-libxml2)
8da7f792 1286 ("spice-gtk" ,spice-gtk)))
2f82b53b
RW
1287 ;; virt-manager searches for qemu-img or kvm-img in the PATH.
1288 (propagated-inputs
1289 `(("qemu" ,qemu)))
1290 (native-inputs
af7014a1 1291 `(("glib" ,glib "bin") ; glib-compile-schemas
f468df9f 1292 ("gobject-introspection" ,gobject-introspection)
e6efcd58 1293 ("gtk+" ,gtk+ "bin") ; gtk-update-icon-cache
2f82b53b 1294 ("perl" ,perl) ; pod2man
20f524a4
CB
1295 ("intltool" ,intltool)
1296 ;; The following are required for running the tests
1297 ;; ("python-dogtail" ,python-dogtail)
1298 ;; ("xvfb" ,xorg-server-for-tests)
1299 ;; ("dbus" ,dbus)
1300 ;; ("at-spi2-core" ,at-spi2-core)
1301 ;; ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
1302 ))
2f82b53b
RW
1303 (home-page "https://virt-manager.org/")
1304 (synopsis "Manage virtual machines")
1305 (description
1306 "The virt-manager application is a desktop user interface for managing
1307virtual machines through libvirt. It primarily targets KVM VMs, but also
1308manages Xen and LXC (Linux containers). It presents a summary view of running
1309domains, their live performance and resource utilization statistics.")
b23b9667 1310 (license license:gpl2+)))
fe420383
RW
1311
1312(define-public criu
1313 (package
1314 (name "criu")
0a46a1e9 1315 (version "3.15")
fe420383
RW
1316 (source (origin
1317 (method url-fetch)
1ee8b719 1318 (uri (string-append "https://download.openvz.org/criu/criu-"
fe420383
RW
1319 version ".tar.bz2"))
1320 (sha256
1321 (base32
0a46a1e9 1322 "09d0j24x0cyc7wkgi7cnxqgfjk7kbdlm79zxpj8d356sa3rw2z24"))))
fe420383
RW
1323 (build-system gnu-build-system)
1324 (arguments
1325 `(#:test-target "test"
1326 #:tests? #f ; tests require mounting as root
1327 #:make-flags
1328 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1329 (string-append "LIBDIR=" (assoc-ref %outputs "out")
5d1601ea 1330 "/lib")
1331 (string-append "ASCIIDOC=" (assoc-ref %build-inputs "asciidoc")
1332 "/bin/asciidoc")
1333 (string-append "XMLTO=" (assoc-ref %build-inputs "xmlto")
1334 "/bin/xmlto"))
fe420383
RW
1335 #:phases
1336 (modify-phases %standard-phases
1337 (replace 'configure
1338 (lambda* (#:key inputs #:allow-other-keys)
1339 ;; The includes for libnl are located in a sub-directory.
1340 (setenv "C_INCLUDE_PATH"
1341 (string-append (assoc-ref inputs "libnl")
ab2a1aed 1342 "/include/libnl3:"
41cb710f 1343 (or (getenv "C_INCLUDE_PATH") "")))
5d1601ea 1344 #t))
1345 (add-after 'configure 'fix-documentation
1346 (lambda* (#:key inputs outputs #:allow-other-keys)
fe420383 1347 (substitute* "Documentation/Makefile"
5d1601ea 1348 (("-m custom.xsl")
1349 (string-append
1350 "-m custom.xsl --skip-validation -x "
1351 (assoc-ref inputs "docbook-xsl") "/xml/xsl/"
1352 ,(package-name docbook-xsl) "-"
1353 ,(package-version docbook-xsl)
1354 "/manpages/docbook.xsl")))
580f33e1
EF
1355 #t))
1356 (add-after 'unpack 'hardcode-variables
1357 (lambda* (#:key inputs #:allow-other-keys)
1358 ;; Hardcode arm version detection
1359 (substitute* "Makefile"
1360 (("ARMV.*:=.*") "ARMV := 7\n"))
1361 ;; We are currently using python-2
1362 (substitute* "crit/Makefile"
1363 (("\\$\\(PYTHON\\)") "python2"))
1364 (substitute* "lib/Makefile"
1365 (("\\$\\(PYTHON\\)")
1366 (string-append (assoc-ref inputs "python")
1367 "/bin/python")))
fe420383
RW
1368 #t))
1369 (add-before 'build 'fix-symlink
1370 (lambda* (#:key inputs #:allow-other-keys)
1371 ;; The file 'images/google/protobuf/descriptor.proto' points to
1372 ;; /usr/include/..., which obviously does not exist.
1373 (let* ((file "google/protobuf/descriptor.proto")
1374 (target (string-append "images/" file))
1375 (source (string-append (assoc-ref inputs "protobuf")
1376 "/include/" file)))
1377 (delete-file target)
1378 (symlink source target)
1379 #t)))
1380 (add-after 'install 'wrap
1381 (lambda* (#:key inputs outputs #:allow-other-keys)
1382 ;; Make sure 'crit' runs with the correct PYTHONPATH.
1383 (let* ((out (assoc-ref outputs "out"))
1384 (path (string-append out
1385 "/lib/python"
1386 (string-take (string-take-right
1387 (assoc-ref inputs "python") 5) 3)
1388 "/site-packages:"
1389 (getenv "PYTHONPATH"))))
1390 (wrap-program (string-append out "/bin/crit")
1391 `("PYTHONPATH" ":" prefix (,path))))
1392 #t)))))
1393 (inputs
1394 `(("protobuf" ,protobuf)
1395 ("python" ,python-2)
1396 ("python2-protobuf" ,python2-protobuf)
1397 ("python2-ipaddr" ,python2-ipaddr)
1398 ("iproute" ,iproute)
1399 ("libaio" ,libaio)
1400 ("libcap" ,libcap)
1401 ("libnet" ,libnet)
5d1601ea 1402 ("libnl" ,libnl)
bb223220
TGR
1403 ("libbsd" ,libbsd)
1404 ("nftables" ,nftables)))
fe420383
RW
1405 (native-inputs
1406 `(("pkg-config" ,pkg-config)
3bf94bc8 1407 ("perl" ,perl)
fe420383
RW
1408 ("protobuf-c" ,protobuf-c)
1409 ("asciidoc" ,asciidoc)
1410 ("xmlto" ,xmlto)
1411 ("docbook-xml" ,docbook-xml)
1412 ("docbook-xsl" ,docbook-xsl)))
1413 (home-page "https://criu.org")
1414 (synopsis "Checkpoint and restore in user space")
1415 (description "Using this tool, you can freeze a running application (or
1416part of it) and checkpoint it to a hard drive as a collection of files. You
1417can then use the files to restore and run the application from the point it
1418was frozen at. The distinctive feature of the CRIU project is that it is
1419mainly implemented in user space.")
1420 ;; The project is licensed under GPLv2; files in the lib/ directory are
1421 ;; LGPLv2.1.
b23b9667 1422 (license (list license:gpl2 license:lgpl2.1))))
f46a3523
RH
1423
1424(define-public qmpbackup
1425 (package
1426 (name "qmpbackup")
1427 (version "0.2")
1428 (source (origin
7be834d5
EF
1429 (method git-fetch)
1430 (uri (git-reference
b0e7b699 1431 (url "https://github.com/abbbi/qmpbackup")
7be834d5
EF
1432 (commit version)))
1433 (file-name (git-file-name name version))
f46a3523
RH
1434 (sha256
1435 (base32
7be834d5 1436 "0swhp5byz44brhyis1a39p11fyn9q84xz5q6v2fah29r7d71kmmx"))))
f46a3523
RH
1437 (build-system python-build-system)
1438 (arguments
1439 `(#:python ,python-2))
1440 (home-page "https://github.com/abbbi/qmpbackup")
1441 (synopsis "Backup and restore QEMU machines")
1442 (description "qmpbackup is designed to create and restore full and
1443incremental backups of running QEMU virtual machines via QMP, the QEMU
1444Machine Protocol.")
b23b9667 1445 (license license:gpl3+)))
fb9472a3 1446
c9d2d310
RH
1447(define-public looking-glass-client
1448 (let ((commit "182c4752d57690da7f99d5e788de9b8baea33895"))
16a47f23 1449 (package
c9d2d310 1450 (name "looking-glass-client")
16a47f23
RH
1451 (version (string-append "a12-" (string-take commit 7)))
1452 (source
1453 (origin
1454 (method git-fetch)
1455 (uri (git-reference (url "https://github.com/gnif/LookingGlass")
1456 (commit commit)))
1457 (file-name (git-file-name name version))
1458 (sha256
1459 (base32
43beec19
MB
1460 "02bq46ndmzq9cihazzn7xq1x7q5nzm7iw4l9lqzihxcxp9famkhw"))
1461 (modules '((guix build utils)))
1462 (snippet
1463 '(begin
1464 ;; Do not create binaries optimized for the CPU of the build machine,
1465 ;; for reproducibility and compatibility. TODO: in the next version
1466 ;; of looking glass, this is exposed as a CMake configure option.
1467 (substitute* "client/CMakeLists.txt"
1468 (("-march=native")
1469 ""))
1470 #t))))
16a47f23
RH
1471 (build-system cmake-build-system)
1472 (inputs `(("fontconfig" ,fontconfig)
1473 ("glu" ,glu)
1474 ("mesa" ,mesa)
1475 ("openssl" ,openssl)
1476 ("sdl2" ,sdl2)
1477 ("sdl2-ttf" ,sdl2-ttf)
1478 ("spice-protocol" ,spice-protocol)
1479 ("wayland" ,wayland)))
1480 (native-inputs `(("libconfig" ,libconfig)
1481 ("nettle" ,nettle)
1482 ("pkg-config" ,pkg-config)))
1483 (arguments
1484 `(#:tests? #f ;; No tests are available.
1485 #:make-flags '("CC=gcc")
1486 #:phases (modify-phases %standard-phases
1487 (add-before 'configure 'chdir-to-client
1488 (lambda* (#:key outputs #:allow-other-keys)
1489 (chdir "client")
1490 #t))
a5ef1bcd
MB
1491 (add-after 'chdir-to-client 'add-missing-include
1492 (lambda _
1493 ;; Mimic upstream commit b9797529893, required since the
1494 ;; update to Mesa 19.2.
1495 (substitute* "renderers/egl/shader.h"
1496 (("#include <stdbool\\.h>")
1497 "#include <stdbool.h>\n#include <stddef.h>"))
1498 #t))
16a47f23
RH
1499 (replace 'install
1500 (lambda* (#:key outputs #:allow-other-keys)
1501 (install-file "looking-glass-client"
1502 (string-append (assoc-ref outputs "out")
1503 "/bin"))
a5ef1bcd 1504 #t)))))
16a47f23
RH
1505 (home-page "https://looking-glass.hostfission.com")
1506 (synopsis "KVM Frame Relay (KVMFR) implementation")
1507 (description "Looking Glass allows the use of a KVM (Kernel-based Virtual
fb9472a3
RH
1508Machine) configured for VGA PCI Pass-through without an attached physical
1509monitor, keyboard or mouse. It displays the VM's rendered contents on your main
1510monitor/GPU.")
16a47f23
RH
1511 ;; This package requires SSE instructions.
1512 (supported-systems '("i686-linux" "x86_64-linux"))
1513 (license license:gpl2+))))
de7f03ce
SB
1514
1515(define-public runc
1516 (package
1517 (name "runc")
ce4593ec 1518 (version "1.0.0-rc6")
de7f03ce
SB
1519 (source (origin
1520 (method url-fetch)
1521 (uri (string-append
1522 "https://github.com/opencontainers/runc/releases/"
1523 "download/v" version "/runc.tar.xz"))
ce4593ec
LF
1524 (file-name (string-append name "-" version ".tar.xz"))
1525 (patches (search-patches "runc-CVE-2019-5736.patch"))
de7f03ce
SB
1526 (sha256
1527 (base32
ce4593ec 1528 "1c7832dq70slkjh8qp2civ1wxhhdd2hrx84pq7db1mmqc9fdr3cc"))))
de7f03ce
SB
1529 (build-system go-build-system)
1530 (arguments
1531 '(#:import-path "github.com/opencontainers/runc"
1532 #:install-source? #f
03e45891
SB
1533 ;; XXX: 20/139 tests fail due to missing /var, cgroups and apparmor in
1534 ;; the build environment.
1535 #:tests? #f
de7f03ce
SB
1536 #:phases
1537 (modify-phases %standard-phases
1538 (replace 'unpack
1539 (lambda* (#:key source import-path #:allow-other-keys)
1540 ;; Unpack the tarball into 'runc' instead of 'runc-1.0.0-rc5'.
1541 (let ((dest (string-append "src/" import-path)))
1542 (mkdir-p dest)
1543 (invoke "tar" "-C" (string-append "src/" import-path)
1544 "--strip-components=1"
1545 "-xvf" source))))
1546 (replace 'build
1547 (lambda* (#:key import-path #:allow-other-keys)
e39e8d97
LC
1548 (with-directory-excursion (string-append "src/" import-path)
1549 ;; XXX: requires 'go-md2man'.
1550 ;; (invoke "make" "man")
1551 (invoke "make"))))
de7f03ce
SB
1552 ;; (replace 'check
1553 ;; (lambda _
1554 ;; (invoke "make" "localunittest")))
1555 (replace 'install
e39e8d97
LC
1556 (lambda* (#:key import-path outputs #:allow-other-keys)
1557 (with-directory-excursion (string-append "src/" import-path)
1558 (let ((out (assoc-ref outputs "out")))
1559 (invoke "make" "install" "install-bash"
1560 (string-append "PREFIX=" out)))))))))
de7f03ce
SB
1561 (native-inputs
1562 `(("pkg-config" ,pkg-config)))
1563 (inputs
1564 `(("libseccomp" ,libseccomp)))
1565 (synopsis "Open container initiative runtime")
1566 (home-page "https://www.opencontainers.org/")
1567 (description
1568 "@command{runc} is a command line client for running applications
1569packaged according to the
1570@uref{https://github.com/opencontainers/runtime-spec/blob/master/spec.md, Open
1571Container Initiative (OCI) format} and is a compliant implementation of the
1572Open Container Initiative specification.")
b23b9667 1573 (license license:asl2.0)))
efdaf8de
SB
1574
1575(define-public umoci
1576 (package
1577 (name "umoci")
3468737c
TGR
1578 (version "0.4.6")
1579 (source
1580 (origin
1581 (method url-fetch)
1582 (uri (string-append
1583 "https://github.com/opencontainers/umoci/releases/download/v"
1584 version "/umoci.tar.xz"))
1585 (file-name (string-append "umoci-" version ".tar.xz"))
1586 (sha256
1587 (base32 "06q7xfwnqysc013hapx31jhlzmyg8qb467qfkynj673qc7p9bd6h"))))
efdaf8de
SB
1588 (build-system go-build-system)
1589 (arguments
3468737c 1590 '(#:import-path "github.com/opencontainers/umoci"
efdaf8de
SB
1591 #:install-source? #f
1592 #:phases
1593 (modify-phases %standard-phases
1594 (replace 'unpack
1595 (lambda* (#:key source import-path #:allow-other-keys)
1596 ;; Unpack the tarball into 'umoci' instead of "runc-${version}".
1597 (let ((dest (string-append "src/" import-path)))
1598 (mkdir-p dest)
1599 (invoke "tar" "-C" (string-append "src/" import-path)
1600 "--strip-components=1"
1601 "-xvf" source))))
1602 (replace 'build
1603 (lambda* (#:key import-path #:allow-other-keys)
e39e8d97
LC
1604 (with-directory-excursion (string-append "src/" import-path)
1605 ;; TODO: build manpages with 'go-md2man'.
1606 (invoke "make" "SHELL=bash"))))
efdaf8de 1607 (replace 'install
e39e8d97 1608 (lambda* (#:key import-path outputs #:allow-other-keys)
efdaf8de
SB
1609 (let* ((out (assoc-ref outputs "out"))
1610 (bindir (string-append out "/bin")))
e39e8d97
LC
1611 (install-file (string-append "src/" import-path "/umoci")
1612 bindir)
efdaf8de
SB
1613 #t))))))
1614 (home-page "https://umo.ci/")
1615 (synopsis "Tool for modifying Open Container images")
1616 (description
1617 "@command{umoci} is a tool that allows for high-level modification of an
1618Open Container Initiative (OCI) image layout and its tagged images.")
b23b9667 1619 (license license:asl2.0)))
7714a069
SB
1620
1621(define-public skopeo
1622 (package
1623 (name "skopeo")
01dec9ed 1624 (version "1.2.1")
7714a069
SB
1625 (source (origin
1626 (method git-fetch)
1627 (uri (git-reference
e65991a3 1628 (url "https://github.com/containers/skopeo")
7714a069
SB
1629 (commit (string-append "v" version))))
1630 (file-name (git-file-name name version))
1631 (sha256
1632 (base32
01dec9ed 1633 "1y9pmijazbgxzriymrm7zrifmkd1x1wad9b3zjcj7zwr6c999dhg"))))
7714a069
SB
1634 (build-system go-build-system)
1635 (native-inputs
b4578379
JL
1636 `(("pkg-config" ,pkg-config)
1637 ("go-github-com-go-md2man" ,go-github-com-go-md2man)))
7714a069
SB
1638 (inputs
1639 `(("btrfs-progs" ,btrfs-progs)
1640 ("eudev" ,eudev)
1641 ("libassuan" ,libassuan)
1642 ("libselinux" ,libselinux)
1643 ("libostree" ,libostree)
1644 ("lvm2" ,lvm2)
1645 ("glib" ,glib)
1646 ("gpgme" ,gpgme)))
1647 (arguments
e65991a3 1648 '(#:import-path "github.com/containers/skopeo"
7714a069 1649 #:install-source? #f
e39e8d97 1650 #:tests? #f ; The tests require Docker
7714a069
SB
1651 #:phases
1652 (modify-phases %standard-phases
1653 (replace 'build
1654 (lambda* (#:key import-path #:allow-other-keys)
e39e8d97 1655 (with-directory-excursion (string-append "src/" import-path)
e39e8d97 1656 (invoke "make" "bin/skopeo"))))
b4578379
JL
1657 (add-after 'build 'build-docs
1658 (lambda* (#:key import-path #:allow-other-keys)
1659 (with-directory-excursion (string-append "src/" import-path)
1660 (invoke "make" "docs"))))
7714a069 1661 (replace 'install
e39e8d97
LC
1662 (lambda* (#:key import-path outputs #:allow-other-keys)
1663 (with-directory-excursion (string-append "src/" import-path)
1664 (let ((out (assoc-ref outputs "out")))
b4578379
JL
1665 (install-file "default-policy.json"
1666 (string-append out "/etc/containers"))
1667 (invoke "make" "install-binary" "install-completions" "install-docs"
e39e8d97 1668 (string-append "PREFIX=" out)))))))))
e65991a3 1669 (home-page "https://github.com/containers/skopeo")
7714a069
SB
1670 (synopsis "Interact with container images and container image registries")
1671 (description
1672 "@command{skopeo} is a command line utility providing various operations
1673with container images and container image registries. It can:
1674@enumerate
1675
1676@item Copy container images between various containers image stores,
1677converting them as necessary.
1678
1679@item Convert a Docker schema 2 or schema 1 container image to an OCI image.
1680
1681@item Inspect a repository on a container registry without needlessly pulling
1682the image.
1683
1684@item Sign and verify container images.
1685
1686@item Delete container images from a remote container registry.
1687
1688@end enumerate")
b23b9667 1689 (license license:asl2.0)))
5e95181b
EF
1690
1691(define-public python-vagrant
1692 (package
1693 (name "python-vagrant")
1694 (version "0.5.15")
1695 (source
1696 (origin
1697 (method url-fetch)
1698 (uri (pypi-uri "python-vagrant" version))
1699 (sha256
1700 (base32
1701 "1ikrh6canhcxg5y7pzmkcnnydikppv7s6sm9prfx90nk0ac8m6mg"))))
1702 (build-system python-build-system)
1703 (arguments
1704 '(#:tests? #f)) ; tests involve running vagrant.
1705 (home-page "https://github.com/todddeluca/python-vagrant")
1706 (synopsis "Python bindings for Vagrant")
1707 (description
1708 "Python-vagrant is a Python module that provides a thin wrapper around the
1709@code{vagrant} command line executable, allowing programmatic control of Vagrant
1710virtual machines.")
1711 (license license:expat)))
f6e55da0
JL
1712
1713(define-public bubblewrap
1714 (package
1715 (name "bubblewrap")
40613055 1716 (version "0.4.1")
f6e55da0
JL
1717 (source (origin
1718 (method url-fetch)
546c9fa6 1719 (uri (string-append "https://github.com/containers/bubblewrap/"
f6e55da0
JL
1720 "releases/download/v" version "/bubblewrap-"
1721 version ".tar.xz"))
1722 (sha256
1723 (base32
40613055 1724 "00ycgi6q2yngh06bnz50wkvar6r2jnjf3j158grhi9k13jdrpimr"))))
f6e55da0
JL
1725 (build-system gnu-build-system)
1726 (arguments
1727 `(#:phases
1728 (modify-phases %standard-phases
1729 (add-after 'unpack 'fix-test
1730 (lambda* (#:key outputs #:allow-other-keys)
1731 ;; Tests try to access /var/tmp, which is not possible in our build
1732 ;; environment. Let's give them another directory.
1733 ;; /tmp gets overriden in some tests, so we need another directory.
1734 ;; the only possibility is the output directory.
1735 (let ((tmp-dir (string-append (assoc-ref outputs "out") "/tmp")))
1736 (mkdir-p tmp-dir)
1737 (substitute* "tests/test-run.sh"
1738 (("/var/tmp") tmp-dir)
1739 ;; Tests create a temporary python script, so fix its shebang.
1740 (("/usr/bin/env python") (which "python"))
1741 ;; Some tests try to access /usr, but that doesn't exist.
1742 ;; Give them /gnu instead.
1743 (("/usr") "/gnu")
2d03201a
MB
1744 (("--ro-bind /bin /bin") "--ro-bind /gnu /bin")
1745 (("--ro-bind /sbin /sbin") "--ro-bind /gnu /sbin")
1746 (("--ro-bind /lib /lib") "--ro-bind /gnu /lib")
f6e55da0
JL
1747 ((" */bin/bash") (which "bash"))
1748 (("/bin/sh") (which "sh"))
1749 (("findmnt") (which "findmnt"))))
1750 #t))
1751 ;; Remove the directory we gave to tests to have a clean package.
1752 (add-after 'check 'remove-tmp-dir
1753 (lambda* (#:key outputs #:allow-other-keys)
1754 (delete-file-recursively (string-append (assoc-ref outputs "out") "/tmp"))
1755 #t)))))
1756 (inputs
1757 `(("libcap" ,libcap)))
1758 (native-inputs
81678e5e 1759 `(("python" ,python-wrapper)
f6e55da0 1760 ("util-linux" ,util-linux)))
546c9fa6 1761 (home-page "https://github.com/containers/bubblewrap")
f6e55da0
JL
1762 (synopsis "Unprivileged sandboxing tool")
1763 (description "Bubblewrap is aimed at running applications in a sandbox,
7ecd1761
TGR
1764restricting their access to parts of the operating system or user data such as
1765the home directory. Bubblewrap always creates a new mount namespace, and the
1766user can specify exactly what parts of the file system should be made visible
ef1f1ca7 1767in the sandbox. These directories are mounted with the @code{nodev} option
7ecd1761 1768by default and can be made read-only.")
f6e55da0 1769 (license license:lgpl2.0+)))
17043677 1770
1771(define-public bochs
1772 (package
1773 (name "bochs")
f17bd3c6 1774 (version "2.6.11")
17043677 1775 (source
1776 (origin
1777 (method url-fetch)
1778 (uri (string-append "https://sourceforge.net/projects/bochs/files/bochs/"
1779 version "/bochs-" version ".tar.gz"))
1780 (sha256
f17bd3c6 1781 (base32 "0ql8q6y1k356li1g9gbvl21448mlxphxxi6kjb2b3pxvzd0pp2b3"))))
17043677 1782 (build-system gnu-build-system)
1783 (arguments
f17bd3c6 1784 `(#:tests? #f)) ; no tests exist
17043677 1785 (inputs
1786 `(("libxrandr" ,libxrandr)))
1787 (home-page "http://bochs.sourceforge.net/")
1788 (synopsis "Emulator for x86 PC")
1789 (description
1790 "Bochs is an emulator which can emulate Intel x86 CPU, common I/O
1791devices, and a custom BIOS. It can also be compiled to emulate many different
1792x86 CPUs, from early 386 to the most recent x86-64 Intel and AMD processors.
1793Bochs can run most Operating Systems inside the emulation including Linux,
1794DOS or Microsoft Windows.")
1795 (license license:lgpl2.0+)))
35e8900d 1796
35e8900d
DM
1797(define-public xen
1798 (package
1799 (name "xen")
809b0660 1800 (version "4.14.1")
35e8900d
DM
1801 (source (origin
1802 (method git-fetch)
1803 (uri (git-reference
1804 (url "git://xenbits.xenproject.org/xen.git")
1805 (commit (string-append "RELEASE-" version))))
1806 (file-name (git-file-name name version))
1807 (sha256
1808 (base32
809b0660 1809 "1r90rvypw76ya9clqw5p02gm1k8hxz73f7gr95ca778nnzvb7xjw"))))
35e8900d
DM
1810 (build-system gnu-build-system)
1811 (arguments
1812 `(#:configure-flags
1813 (list "--enable-rpath"
1814 "--disable-qemu-traditional" ; It tries to do "git clone"
1815 "--disable-rombios" ; would try to "git clone" via etherboot.
35e8900d
DM
1816 ;; TODO: Re-enable stubdom (it's "more secure" to use it).
1817 "--disable-stubdom" ; tries to "git clone" old patched newlib.
1818 (string-append "--with-initddir="
1819 (assoc-ref %outputs "out")
1820 "/etc/init.d")
1821 (string-append "--with-system-qemu="
1822 (assoc-ref %build-inputs "qemu")
1823 "/bin/qemu-system-i386")
1824 (string-append "--with-system-seabios="
1825 (assoc-ref %build-inputs "seabios")
1826 "/share/firmware/bios.bin")
1827 (string-append "--with-system-ovmf="
1828 (assoc-ref %build-inputs "ovmf")
1829 "/share/firmware/ovmf_ia32.bin"))
1830 #:make-flags (list "-j" "1"
1831 "XEN_BUILD_DATE=Thu Jan 1 01:00:01 CET 1970"
1832 "XEN_BUILD_TIME=01:00:01"
1833 "XEN_BUILD_HOST="
1834 "ETHERBOOT_NICS="
1835 "SMBIOS_REL_DATE=01/01/1970"
1836 "VGABIOS_REL_DATE=01 Jan 1970"
1837 ; QEMU_TRADITIONAL_LOC
1838 ; QEMU_UPSTREAM_LOC
1839 "SYSCONFIG_DIR=/tmp/etc/default"
1840 (string-append "BASH_COMPLETION_DIR="
1841 (assoc-ref %outputs "out")
1842 "/etc/bash_completion.d")
1843 (string-append "BOOT_DIR="
1844 (assoc-ref %outputs "out")
1845 "/boot")
1846 (string-append "DEBUG_DIR="
1847 (assoc-ref %outputs "out")
1848 "/lib/debug")
1849 (string-append "EFI_DIR="
1850 (assoc-ref %outputs "out")
1851 "/lib/efi") ; TODO lib64 ?
1852 "MINIOS_UPSTREAM_URL="
1853 ;(string-append "DISTDIR="
1854 ; (assoc-ref %outputs "out"))
1855)
1856 #:test-target "test"
1857 #:phases
1858 (modify-phases %standard-phases
1859 (add-after 'unpack 'unpack-mini-os
1860 (lambda* (#:key inputs #:allow-other-keys)
1861 (copy-recursively (assoc-ref inputs "mini-os") "extras/mini-os")
1862 #t))
1863 (add-after 'unpack-mini-os 'patch
1864 (lambda* (#:key inputs outputs #:allow-other-keys)
1865 (substitute* "tools/firmware/Rules.mk"
1866 (("override XEN_TARGET_ARCH = x86_32")
1867 (string-append "override XEN_TARGET_ARCH = x86_32
1868override CC = " (assoc-ref inputs "cross-gcc") "/bin/i686-linux-gnu-gcc"))
1869 (("^CFLAGS =$")
1870 (string-append "CFLAGS=-I" (assoc-ref inputs "cross-libc")
1871 "/include\n")))
1872 (substitute* "config/x86_32.mk"
1873 (("CFLAGS += -m32 -march=i686")
1874 (string-append "CFLAGS += -march=i686 -I"
1875 (assoc-ref inputs "cross-libc")
1876 "/include")))
35e8900d
DM
1877 ;; /var is not in /gnu/store , so don't try to create it.
1878 (substitute* '("tools/Makefile"
1879 "tools/xenstore/Makefile"
1880 "tools/xenpaging/Makefile")
1881 (("\\$\\(INSTALL_DIR\\) .*XEN_(DUMP|LOG|RUN|LIB|PAGING)_DIR.*")
1882 "\n")
1883 (("\\$\\(INSTALL_DIR\\) .*XEN_(RUN|LIB)_STORED.*")
1884 "\n"))
1885 ;; Prevent xen from creating /etc .
1886 (substitute* "tools/examples/Makefile"
1887 ((" install-readmes") "")
1888 ((" install-configs") ""))
1889 ;; Set rpath.
1890 (substitute* "tools/pygrub/setup.py"
1891 (("library_dirs =")
1892 ; TODO: extra_link_args = ['-Wl,-rpath=/opt/foo'],
1893 (string-append "runtime_library_dirs = ['"
1894 (assoc-ref outputs "out")
1895 "/lib'],\nlibrary_dirs =")))
1896 #t))
1897 (add-before 'configure 'patch-xen-script-directory
1898 (lambda* (#:key outputs #:allow-other-keys)
1899 (substitute* '("configure"
1900 "tools/configure"
1901 "docs/configure")
1902 (("XEN_SCRIPT_DIR=.*")
1903 (string-append "XEN_SCRIPT_DIR="
1904 (assoc-ref outputs "out")
1905 "/etc/xen/scripts")))
1906 #t))
1907 (add-before 'configure 'set-environment-up
1908 (lambda* (#:key make-flags #:allow-other-keys)
1909 (define (cross? x)
1910 (string-contains x "cross-i686-linux"))
1911 (define (filter-environment! filter-predicate
1912 environment-variable-names)
1913 (for-each
1914 (lambda (env-name)
1915 (let* ((env-value (getenv env-name))
1916 (search-path (search-path-as-string->list env-value))
1917 (new-search-path (filter filter-predicate
1918 search-path))
1919 (new-env-value (list->search-path-as-string
1920 new-search-path ":")))
1921 (setenv env-name new-env-value)))
1922 environment-variable-names))
1a8a6b7c
TGR
1923 (setenv "CROSS_C_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
1924 (setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
35e8900d
DM
1925 (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
1926 (filter-environment! cross?
1a8a6b7c 1927 '("CROSS_C_INCLUDE_PATH" "CROSS_CPLUS_INCLUDE_PATH"
35e8900d
DM
1928 "CROSS_LIBRARY_PATH"))
1929 (filter-environment! (lambda (e) (not (cross? e)))
1a8a6b7c 1930 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
35e8900d
DM
1931 "LIBRARY_PATH"))
1932 ;; Guix tries to be helpful and automatically adds
1933 ;; mini-os-git-checkout/include to the include path,
1934 ;; but actually we don't want it to be there (yet).
1935 (filter-environment! (lambda (e)
1936 (not
1937 (string-contains e
1938 "mini-os-git-checkout")))
1a8a6b7c 1939 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
35e8900d
DM
1940 "LIBRARY_PATH"))
1941 (setenv "EFI_VENDOR" "guix")
1942 #t))
1943 (replace 'build
1944 (lambda* (#:key make-flags #:allow-other-keys)
1945 (apply invoke "make" "world" make-flags))))))
1946 (inputs
1947 `(("acpica" ,acpica) ; TODO: patch iasl invocation.
1948 ("bridge-utils" ,bridge-utils) ; TODO: patch invocations.
1949 ("glib" ,glib)
1950 ("iproute" ,iproute) ; TODO: patch invocations.
1951 ("libaio" ,libaio)
1952 ("libx11" ,libx11)
1953 ("libyajl" ,libyajl)
1954 ("ncurses" ,ncurses)
1955 ("openssl" ,openssl)
1956 ("ovmf" ,ovmf)
1957 ("pixman" ,pixman)
1958 ("qemu" ,qemu-minimal)
1959 ("seabios" ,seabios)
bb93042c 1960 ("util-linux" ,util-linux "lib") ; uuid
35e8900d
DM
1961 ; TODO: ocaml-findlib, ocaml-nox.
1962 ("xz" ,xz) ; for liblzma
1963 ("zlib" ,zlib)))
1964 (native-inputs
1965 `(("dev86" ,dev86)
1966 ("bison" ,bison)
c69959f0 1967 ("cmake" ,cmake-minimal)
35e8900d
DM
1968 ("figlet" ,figlet)
1969 ("flex" ,flex)
1970 ("gettext" ,gettext-minimal)
1971 ("libnl" ,libnl)
1972 ("mini-os"
1973 ,(origin
1974 (method git-fetch)
1975 (uri (git-reference
1976 (url "http://xenbits.xen.org/git-http/mini-os.git")
1977 (commit (string-append "xen-RELEASE-" version))))
1978 (sha256
1979 (base32
1980 "1i8pcl19n60i2m9vlg79q3nknpj209c9ic5x10wxaicx45kc107f"))
1981 (file-name "mini-os-git-checkout")))
1982 ("perl" ,perl)
1983 ; TODO: markdown
1984 ("pkg-config" ,pkg-config)
1985 ("python" ,python-2)
1986 ("wget" ,wget)
1987 ("cross-gcc" ,(cross-gcc "i686-linux-gnu"
1988 #:xbinutils (cross-binutils "i686-linux-gnu")
1989 #:libc (cross-libc "i686-linux-gnu")))
1990 ("cross-libc" ,(cross-libc "i686-linux-gnu")) ; header files
1991 ("cross-libc-static" ,(cross-libc "i686-linux-gnu") "static")))
1992 (home-page "https://xenproject.org/")
1993 (synopsis "Xen Virtual Machine Monitor")
1994 (description "This package provides the Xen Virtual Machine Monitor
1995which is a hypervisor.")
1996 ;; TODO: Some files are licensed differently. List those.
1997 (license license:gpl2)
1998 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))))
e9126381
BW
1999
2000(define-public osinfo-db-tools
2001 (package
2002 (name "osinfo-db-tools")
5c8a59e6 2003 (version "1.8.0")
e9126381
BW
2004 (source (origin
2005 (method url-fetch)
2006 (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-tools-"
2007 version ".tar.xz"))
2008
2009 (sha256
2010 (base32
5c8a59e6 2011 "038q3gzdbkfkhpicj0755mw1q4gbvn57pslpw8n2dp3lds9im0g9"))))
e9126381
BW
2012 (build-system meson-build-system)
2013 (inputs
2014 `(("libsoup" ,libsoup)
2015 ("libxml2" ,libxml2)
2016 ("libxslt" ,libxslt)
2017 ("json-glib" ,json-glib)
2018 ("libarchive" ,libarchive)))
2019 (native-inputs
2020 `(("perl" ,perl)
2021 ("gobject-introspection" ,gobject-introspection)
2022 ("gettext" ,gettext-minimal)
2023 ("pkg-config" ,pkg-config)
2024 ;; Tests
2025 ("python" ,python)
2026 ("pytest" ,python-pytest)
2027 ("requests" ,python-requests)))
2028 (home-page "https://gitlab.com/libosinfo/osinfo-db-tools")
2029 (synopsis "Tools for managing the osinfo database")
2030 (description "This package contains a set of tools to assist
2031administrators and developers in managing the database.")
2032 (license license:lgpl2.0+)))
a838fa28
BW
2033
2034(define-public osinfo-db
2035 (package
2036 (name "osinfo-db")
9c769ace 2037 (version "20201218")
a838fa28
BW
2038 (source (origin
2039 (method url-fetch)
2040 (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-"
2041 version ".tar.xz"))
2042 (sha256
2043 (base32
9c769ace 2044 "0ydbindwgw7kg861rqii5036gq0dbbbmv35dzrmmv937ddfsxwh0"))))
a838fa28
BW
2045 (build-system trivial-build-system)
2046 (arguments
2047 `(#:modules ((guix build utils))
2048 #:builder
2049 (begin
2050 (use-modules (guix build utils))
2051 (let* ((out (assoc-ref %outputs "out"))
2052 (osinfo-dir (string-append out "/share/osinfo"))
2053 (source (assoc-ref %build-inputs "source"))
2054 (osinfo-db-import
2055 (string-append (assoc-ref %build-inputs "osinfo-db-tools")
2056 "/bin/osinfo-db-import")))
2057 (mkdir-p osinfo-dir)
2058 (invoke osinfo-db-import "--dir" osinfo-dir source)
2059 #t))))
2060 (native-inputs
2061 `(("intltool" ,intltool)
2062 ("osinfo-db-tools" ,osinfo-db-tools)))
2063 (home-page "https://gitlab.com/libosinfo/osinfo-db")
2064 (synopsis "Database of information about operating systems")
2065 (description "Osinfo-db provides the database files for use with the
2066libosinfo library. It provides information about guest operating systems for
2067use with virtualization provisioning tools")
2068 (license license:lgpl2.0+)))
dd8e4411
BG
2069
2070(define-public python-transient
2071 (package
2072 (name "python-transient")
1db54324 2073 (version "0.12")
dd8e4411
BG
2074 (source
2075 (origin
2076 (method url-fetch)
2077 (uri (pypi-uri "transient" version))
2078 (sha256
2079 (base32
1db54324 2080 "148yiqrmcscsi6787y0f27i1y9cf0gcw3mqfv5frhpmsmv62mv5z"))))
dd8e4411
BG
2081 (build-system python-build-system)
2082 (arguments
2083 `(#:tests? #f ; Requires behave
2084 #:phases (modify-phases %standard-phases
2085 (add-after 'unpack 'fix-dependencies
2086 (lambda _
2087 (substitute* "setup.py"
2088 (("==")
2089 ">="))
2090 #t)))))
2091 (propagated-inputs
2092 `(("python-beautifultable" ,python-beautifultable)
2093 ("python-click" ,python-click)
2094 ("python-importlib-resources"
2095 ,python-importlib-resources)
2096 ("python-lark-parser" ,python-lark-parser)
2097 ("python-marshmallow" ,python-marshmallow)
2098 ("python-progressbar2" ,python-progressbar2)
2099 ("python-requests" ,python-requests)
2100 ("python-toml" ,python-toml)))
2101 (native-inputs
2102 `(("python-black" ,python-black)
2103 ("python-mypy" ,python-mypy)
2104 ("python-pyhamcrest" ,python-pyhamcrest)
2105 ("python-twine" ,python-twine)))
2106 (home-page
2107 "https://github.com/ALSchwalm/transient")
2108 (synopsis
2109 "QEMU Wrapper written in Python")
2110 (description
2111 "@code{transient} is a wrapper for QEMU allowing the creation of virtual
2112machines with shared folder, ssh, and disk creation support.")
2113 (license license:expat)))