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