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