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 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, 2018, 2019, 2020 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 Brice Waegeneire <brice@waegenei.re>
16 ;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
17 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
19 ;;; This file is part of GNU Guix.
21 ;;; GNU Guix is free software; you can redistribute it and/or modify it
22 ;;; under the terms of the GNU General Public License as published by
23 ;;; the Free Software Foundation; either version 3 of the License, or (at
24 ;;; your option) any later version.
26 ;;; GNU Guix is distributed in the hope that it will be useful, but
27 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
28 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 ;;; GNU General Public License for more details.
31 ;;; You should have received a copy of the GNU General Public License
32 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
34 (define-module (gnu packages virtualization)
35 #:use-module (gnu packages)
36 #:use-module (gnu packages admin)
37 #:use-module (gnu packages assembly)
38 #:use-module (gnu packages attr)
39 #:use-module (gnu packages autotools)
40 #:use-module (gnu packages backup)
41 #:use-module (gnu packages base)
42 #:use-module (gnu packages bison)
43 #:use-module (gnu packages check)
44 #:use-module (gnu packages cmake)
45 #:use-module (gnu packages compression)
46 #:use-module (gnu packages cross-base)
47 #:use-module (gnu packages curl)
48 #:use-module (gnu packages cyrus-sasl)
49 #:use-module (gnu packages disk)
50 #:use-module (gnu packages dns)
51 #:use-module (gnu packages docbook)
52 #:use-module (gnu packages documentation)
53 #:use-module (gnu packages figlet)
54 #:use-module (gnu packages firmware)
55 #:use-module (gnu packages flex)
56 #:use-module (gnu packages fontutils)
57 #:use-module (gnu packages freedesktop)
58 #:use-module (gnu packages gettext)
59 #:use-module (gnu packages gl)
60 #:use-module (gnu packages glib)
61 #:use-module (gnu packages gnome)
62 #:use-module (gnu packages gnupg)
63 #:use-module (gnu packages golang)
64 #:use-module (gnu packages graphviz)
65 #:use-module (gnu packages gtk)
66 #:use-module (gnu packages haskell)
67 #:use-module (gnu packages haskell-apps)
68 #:use-module (gnu packages haskell-check)
69 #:use-module (gnu packages haskell-crypto)
70 #:use-module (gnu packages haskell-web)
71 #:use-module (gnu packages haskell-xyz)
72 #:use-module (gnu packages image)
73 #:use-module (gnu packages libbsd)
74 #:use-module (gnu packages libusb)
75 #:use-module (gnu packages linux)
76 #:use-module (gnu packages m4)
77 #:use-module (gnu packages ncurses)
78 #:use-module (gnu packages nettle)
79 #:use-module (gnu packages networking)
80 #:use-module (gnu packages onc-rpc)
81 #:use-module (gnu packages package-management)
82 #:use-module (gnu packages perl)
83 #:use-module (gnu packages pkg-config)
84 #:use-module (gnu packages polkit)
85 #:use-module (gnu packages protobuf)
86 #:use-module (gnu packages python)
87 #:use-module (gnu packages python-crypto)
88 #:use-module (gnu packages python-web)
89 #:use-module (gnu packages python-xyz)
90 #:use-module (gnu packages pulseaudio)
91 #:use-module (gnu packages selinux)
92 #:use-module (gnu packages sdl)
93 #:use-module (gnu packages sphinx)
94 #:use-module (gnu packages spice)
95 #:use-module (gnu packages ssh)
96 #:use-module (gnu packages texinfo)
97 #:use-module (gnu packages textutils)
98 #:use-module (gnu packages tls)
99 #:use-module (gnu packages web)
100 #:use-module (gnu packages wget)
101 #:use-module (gnu packages xdisorg)
102 #:use-module (gnu packages xml)
103 #:use-module (gnu packages xorg)
104 #:use-module (guix build-system cmake)
105 #:use-module (guix build-system gnu)
106 #:use-module (guix build-system go)
107 #:use-module (guix build-system meson)
108 #:use-module (guix build-system python)
109 #:use-module (guix build-system trivial)
110 #:use-module (guix download)
111 #:use-module (guix git-download)
112 #:use-module ((guix licenses) #:prefix license:)
113 #:use-module (guix packages)
114 #:use-module (guix utils)
115 #:use-module (srfi srfi-1)
116 #:use-module (ice-9 match))
118 (define (qemu-patch commit file-name sha256-bv)
119 "Return an origin for COMMIT."
123 "http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h="
125 (hash (content-hash sha256-bv sha256))
126 (file-name file-name)))
134 (uri (string-append "https://download.qemu.org/qemu-"
138 "1dlcwyshdp94fwd30pddxf9bn2q8dfw5jsvry2gvdj551wmaj4rg"))))
139 (build-system gnu-build-system)
141 `(;; Running tests in parallel can occasionally lead to failures, like:
142 ;; boot_sector_test: assertion failed (signature == SIGNATURE): (0x00000000 == 0x0000dead)
145 ;; FIXME: Disable tests on i686 to work around
146 ;; <https://bugs.gnu.org/40527>.
147 #:tests? ,(or (%current-target-system)
148 (not (string=? "i686-linux" (%current-system))))
150 #:configure-flags (list "--enable-usb-redir" "--enable-opengl"
152 (string-append "--smbd="
153 (assoc-ref %outputs "out")
154 "/libexec/samba-wrapper")
155 "--audio-drv-list=alsa,pa,sdl")
156 ;; Make build and test output verbose to facilitate investigation upon failure.
157 #:make-flags '("V=1")
158 #:modules ((srfi srfi-1)
160 ,@%gnu-build-system-modules)
162 (modify-phases %standard-phases
163 (add-after 'set-paths 'hide-glibc
164 (lambda* (#:key inputs #:allow-other-keys)
165 ;; Work around https://issues.guix.info/issue/36882. We need to
166 ;; remove glibc from C_INCLUDE_PATH so that the one hardcoded in GCC,
167 ;; at the bottom of GCC include search-path is used.
168 (let* ((filters '("libc"))
170 (filter-map (lambda (input)
173 (and (not (member name filters))
176 (set-path-environment-variable "C_INCLUDE_PATH"
180 (add-after 'patch-source-shebangs 'patch-/bin/sh-references
182 ;; Ensure the executables created by these source files reference
183 ;; /bin/sh from the store so they work inside the build container.
184 (substitute* '("block/cloop.c" "migration/exec.c"
185 "net/tap.c" "tests/qtest/libqtest.c")
186 (("/bin/sh") (which "sh")))
189 (lambda* (#:key inputs outputs (configure-flags '())
191 ;; The `configure' script doesn't understand some of the
192 ;; GNU options. Thus, add a new phase that's compatible.
193 (let ((out (assoc-ref outputs "out")))
194 (setenv "SHELL" (which "bash"))
196 ;; While we're at it, patch for tests.
197 (substitute* "tests/qemu-iotests/check"
198 (("#!/usr/bin/env python3")
199 (string-append "#!" (which "python3"))))
201 ;; Ensure config.status gets the correct shebang off the bat.
202 ;; The build system gets confused if we change it later and
203 ;; attempts to re-run the whole configury, and fails.
204 (substitute* "configure"
206 (string-append "#!" (which "sh"))))
208 ;; The binaries need to be linked against -lrt.
209 (setenv "LDFLAGS" "-lrt")
212 ,(string-append "--cc=" (which "gcc"))
213 ;; Some architectures insist on using HOST_CC
214 ,(string-append "--host-cc=" (which "gcc"))
215 "--disable-debug-info" ; save build space
216 "--enable-virtfs" ; just to be sure
217 ,(string-append "--prefix=" out)
218 ,(string-append "--sysconfdir=/etc")
219 ,@configure-flags)))))
220 (add-after 'install 'install-info
221 (lambda* (#:key inputs outputs #:allow-other-keys)
222 ;; Install the Info manual, unless Texinfo is missing.
223 (when (assoc-ref inputs "texinfo")
224 (let* ((out (assoc-ref outputs "out"))
225 (dir (string-append out "/share/info")))
226 (invoke "make" "info")
227 (for-each (lambda (info)
228 (install-file info dir))
229 (find-files "." "\\.info"))))
231 ;; Create a wrapper for Samba. This allows QEMU to use Samba without
232 ;; pulling it in as an input. Note that you need to explicitly install
233 ;; Samba in your Guix profile for Samba support.
234 (add-after 'install-info 'create-samba-wrapper
235 (lambda* (#:key inputs outputs #:allow-other-keys)
236 (let* ((out (assoc-ref %outputs "out"))
237 (libexec (string-append out "/libexec")))
238 (call-with-output-file "samba-wrapper"
240 (format port "#!/bin/sh
242 (chmod "samba-wrapper" #o755)
243 (install-file "samba-wrapper" libexec))
245 (add-before 'check 'disable-unusable-tests
246 (lambda* (#:key inputs outputs #:allow-other-keys)
247 (substitute* "tests/Makefile.include"
248 ;; Comment out the test-qga test, which needs /sys and
249 ;; fails within the build environment.
250 (("check-unit-.* tests/test-qga" all)
251 (string-append "# " all)))
252 (substitute* "tests/Makefile.include"
253 ;; Comment out the test-char test, which needs networking and
254 ;; fails within the build environment.
255 (("check-unit-.* tests/test-char" all)
256 (string-append "# " all)))
258 (inputs ; TODO: Add optional inputs.
259 `(("alsa-lib" ,alsa-lib)
265 ("libcacard" ,libcacard) ; smartcard support
266 ("libcap-ng" ,libcap-ng) ; virtfs support requires libcap-ng & libattr
268 ("libepoxy" ,libepoxy)
269 ("libjpeg" ,libjpeg-turbo)
271 ("libseccomp" ,libseccomp)
272 ("libusb" ,libusb) ;USB pass-through support
275 ;; ("pciutils" ,pciutils)
277 ("pulseaudio" ,pulseaudio)
280 ("usbredir" ,usbredir)
281 ("util-linux" ,util-linux)
283 ("virglrenderer" ,virglrenderer)
285 (native-inputs `(("gettext" ,gettext-minimal)
286 ("glib:bin" ,glib "bin") ; gtester, etc.
290 ("pkg-config" ,pkg-config)
291 ("python-wrapper" ,python-wrapper)
292 ("python-sphinx" ,python-sphinx)
293 ("texinfo" ,texinfo)))
294 (home-page "https://www.qemu.org")
295 (synopsis "Machine emulator and virtualizer")
297 "QEMU is a generic machine emulator and virtualizer.
299 When used as a machine emulator, QEMU can run OSes and programs made for one
300 machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
301 using dynamic translation, it achieves very good performance.
303 When used as a virtualizer, QEMU achieves near native performances by
304 executing the guest code directly on the host CPU. QEMU supports
305 virtualization when executing under the Xen hypervisor or using
306 the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
307 server and embedded PowerPC, and S390 guests.")
309 ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
310 (license license:gpl2)
312 ;; Several tests fail on MIPS; see <http://hydra.gnu.org/build/117914>.
313 (supported-systems (fold delete %supported-systems
314 '("mips64el-linux" "i586-gnu")))))
316 (define-public qemu-minimal
317 ;; QEMU without GUI support, only supporting the host's architecture
318 (package (inherit qemu)
319 (name "qemu-minimal")
321 "Machine emulator and virtualizer (without GUI) for the host architecture")
323 (substitute-keyword-arguments (package-arguments qemu)
324 ((#:configure-flags _ '(list))
325 ;; Restrict to the host's architecture.
326 (match (car (string-split (or (%current-target-system)
330 '(list "--target-list=i386-softmmu"))
332 '(list "--target-list=i386-softmmu,x86_64-softmmu"))
334 '(list (string-append "--target-list=mips-softmmu,mipsel-softmmu,"
335 "mips64-softmmu,mips64el-softmmu")))
337 '(list "--target-list=mips-softmmu,mipsel-softmmu"))
339 '(list "--target-list=arm-softmmu,aarch64-softmmu"))
341 '(list "--target-list=arm-softmmu"))
343 '(list "--target-list=alpha-softmmu"))
345 '(list "--target-list=ppc-softmmu,ppc64-softmmu"))
347 '(list "--target-list=ppc-softmmu"))
349 '(list "--target-list=s390x-softmmu"))
351 '(list "--target-list=riscv32-softmmu,riscv64-softmmu"))
352 (else ; An empty list actually builds all the targets.
355 ;; Remove dependencies on optional libraries, notably GUI libraries.
356 (native-inputs (fold alist-delete (package-native-inputs qemu)
358 (inputs (fold alist-delete (package-inputs qemu)
359 '("libusb" "mesa" "sdl2" "spice" "virglrenderer" "gtk+"
360 "usbredir" "libdrm" "libepoxy" "pulseaudio" "vde2"
363 (define (system->qemu-target system)
365 ((string-prefix? "i686" system)
367 ((string-prefix? "arm" system)
370 (string-append "qemu-system-" (match (string-split system #\-)
374 (define-public ganeti
377 ;; Note: we use a pre-release for Python 3 compatibility as well as many
379 (version "3.0.0beta1-24-g024cc9fa2")
383 (url "https://github.com/ganeti/ganeti")
384 (commit (string-append "v" version))))
386 (base32 "1ll34qd2mifni3bhg7cnir3xfnkafig8ch33qndqwrsby0y5ssia"))
387 (file-name (git-file-name name version))
388 (patches (search-patches "ganeti-shepherd-support.patch"
389 "ganeti-shepherd-master-failover.patch"
390 "ganeti-deterministic-manual.patch"
391 "ganeti-drbd-compat.patch"
392 "ganeti-os-disk-size.patch"
393 "ganeti-haskell-pythondir.patch"
394 "ganeti-disable-version-symlinks.patch"
395 "ganeti-preserve-PYTHONPATH.patch"))))
396 (build-system gnu-build-system)
398 `(#:imported-modules (,@%gnu-build-system-modules
399 (guix build haskell-build-system)
400 (guix build python-build-system))
401 #:modules (,@%gnu-build-system-modules
402 ((guix build haskell-build-system) #:prefix haskell:)
403 ((guix build python-build-system) #:select (python-version))
406 ;; The default test target includes a lot of checks that are only really
407 ;; relevant for developers such as NEWS file checking, line lengths, etc.
408 ;; We are only interested in the "py-tests" and "hs-tests" targets: this
409 ;; is the closest we've got even though it includes a little more.
410 #:test-target "check-TESTS"
413 (list "--localstatedir=/var"
414 "--sharedstatedir=/var"
416 "--enable-haskell-tests"
418 ;; By default, the build system installs everything to versioned
419 ;; directories such as $libdir/3.0 and relies on a $libdir/default
420 ;; symlink pointed from /etc/ganeti/{lib,share} to actually function.
421 ;; This is done to accommodate installing multiple versions in
422 ;; parallel, but is of little use to us as Guix users can just
423 ;; roll back and forth. Thus, disable it for simplicity.
424 "--disable-version-links"
426 ;; Ganeti can optionally take control over SSH host keys and
427 ;; distribute them to nodes as they are added, and also rotate keys
428 ;; with 'gnt-cluster renew-crypto --new-ssh-keys'. Thus it needs to
429 ;; know how to restart the SSH daemon.
430 "--with-sshd-restart-command='herd restart ssh-daemon'"
432 ;; Look for OS definitions in this directory by default. It can
433 ;; be changed in the cluster configuration.
434 "--with-os-search-path=/run/current-system/profile/share/ganeti/os"
436 ;; The default QEMU executable to use. We don't use the package
437 ;; here because this entry is stored in the cluster configuration.
438 (string-append "--with-kvm-path=/run/current-system/profile/bin/"
439 ,(system->qemu-target (%current-system))))
441 (modify-phases %standard-phases
442 (add-after 'unpack 'create-vcs-version
444 ;; If we are building from a git checkout, we need to create a
445 ;; 'vcs-version' file manually because the build system does
446 ;; not have access to the git repository information.
447 (unless (file-exists? "vcs-version")
448 (call-with-output-file "vcs-version"
450 (format port "v~a~%" ,version))))
452 (add-after 'unpack 'patch-absolute-file-names
454 (substitute* '("lib/utils/process.py"
456 "src/Ganeti/Constants.hs"
457 "src/Ganeti/HTools/CLI.hs"
458 "test/py/ganeti.config_unittest.py"
459 "test/py/ganeti.hooks_unittest.py"
460 "test/py/ganeti.utils.process_unittest.py"
461 "test/py/ganeti.utils.text_unittest.py"
462 "test/py/ganeti.utils.wrapper_unittest.py")
463 (("/bin/sh") (which "sh"))
464 (("/bin/bash") (which "bash"))
465 (("/usr/bin/env") (which "env"))
466 (("/bin/true") (which "true")))
468 ;; This script is called by the node daemon at startup to perform
469 ;; sanity checks on the cluster IP addresses, and it is also used
470 ;; in a master-failover scenario. Add absolute references to
471 ;; avoid propagating these executables.
472 (substitute* "tools/master-ip-setup"
473 (("arping") (which "arping"))
474 (("ndisc6") (which "ndisc6"))
475 (("fping") (which "fping"))
476 (("grep") (which "grep"))
477 (("ip addr") (string-append (which "ip") " addr")))
479 (add-after 'unpack 'override-builtin-PATH
481 ;; Ganeti runs OS install scripts and similar with a built-in
482 ;; hard coded PATH. Patch so it works on Guix System.
483 (substitute* "src/Ganeti/Constants.hs"
484 (("/sbin:/bin:/usr/sbin:/usr/bin")
485 "/run/setuid-programs:/run/current-system/profile/sbin:\
486 /run/current-system/profile/bin"))
488 (add-after 'bootstrap 'patch-sphinx-version-detection
490 ;; The build system runs 'sphinx-build --version' to verify that
491 ;; the Sphinx is recent enough, but does not expect the
492 ;; .sphinx-build-real executable name created by the Sphinx wrapper.
493 (substitute* "configure"
494 (("\\$SPHINX --version 2>&1")
495 "$SPHINX --version 2>&1 | sed 's/.sphinx-build-real/sphinx-build/g'"))
498 ;; The build system invokes Cabal and GHC, which do not work with
499 ;; GHC_PACKAGE_PATH: <https://github.com/haskell/cabal/issues/3728>.
500 ;; Tweak the build system to do roughly what haskell-build-system does.
501 (add-before 'configure 'configure-haskell
502 (assoc-ref haskell:%standard-phases 'setup-compiler))
503 (add-after 'configure 'do-not-use-GHC_PACKAGE_PATH
505 (unsetenv "GHC_PACKAGE_PATH")
506 (substitute* "Makefile"
508 "$(CABAL) --package-db=../package.conf.d")
510 "$(GHC) -package-db=../package.conf.d"))
513 (add-after 'configure 'fix-installation-directories
515 (substitute* "Makefile"
516 ;; Do not attempt to create /var during install.
517 (("\\$\\(DESTDIR\\)\\$\\{localstatedir\\}")
518 "$(DESTDIR)${prefix}${localstatedir}")
519 ;; Similarly, do not attempt to install the sample ifup scripts
521 (("\\$\\(DESTDIR\\)\\$\\(ifupdir\\)")
522 "$(DESTDIR)${prefix}$(ifupdir)"))
524 (add-before 'build 'adjust-tests
526 ;; Disable tests that can not run. Do it early to prevent
527 ;; touching the Makefile later and triggering a needless rebuild.
528 (substitute* "Makefile"
529 ;; These tests expect the presence of a 'root' user (via
530 ;; ganeti/runtime.py), which fails in the build environment.
531 (("test/py/ganeti\\.asyncnotifier_unittest\\.py") "")
532 (("test/py/ganeti\\.backend_unittest\\.py") "")
533 (("test/py/ganeti\\.daemon_unittest\\.py") "")
534 (("test/py/ganeti\\.tools\\.ensure_dirs_unittest\\.py") "")
535 (("test/py/ganeti\\.utils\\.io_unittest-runasroot\\.py") "")
536 ;; Disable the bash_completion test, as it requires the full
537 ;; bash instead of bash-minimal.
538 (("test/py/bash_completion\\.bash")
540 ;; This test requires networking.
541 (("test/py/import-export_unittest\\.bash")
544 ;; Many of the Makefile targets reset PYTHONPATH before running
545 ;; the Python interpreter, which does not work very well for us.
546 (substitute* "Makefile"
548 (string-append "PYTHONPATH=" (getenv "PYTHONPATH") ":")))
550 (add-after 'build 'build-bash-completions
552 (let ((orig-pythonpath (getenv "PYTHONPATH")))
553 (setenv "PYTHONPATH" (string-append ".:" orig-pythonpath))
554 (invoke "./autotools/build-bash-completion")
555 (setenv "PYTHONPATH" orig-pythonpath)
557 (add-before 'check 'pre-check
558 (lambda* (#:key inputs #:allow-other-keys)
559 ;; Set TZDIR so that time zones are found.
560 (setenv "TZDIR" (string-append (assoc-ref inputs "tzdata")
563 ;; This test checks whether PYTHONPATH is untouched, and extends
564 ;; it to include test directories if so. Add an else branch for
565 ;; our modified PYTHONPATH, in order to prevent a confusing test
566 ;; failure where expired certificates are not cleaned because
567 ;; check-cert-expired is silently crashing.
568 (substitute* "test/py/ganeti-cleaner_unittest.bash"
569 (("then export PYTHONPATH=(.*)" all testpath)
570 (string-append all "else export PYTHONPATH="
571 (getenv "PYTHONPATH") ":" testpath "\n")))
573 (substitute* "test/py/ganeti.utils.process_unittest.py"
574 ;; This test attempts to run an executable with
575 ;; RunCmd(..., reset_env=True), which fails because the default
576 ;; PATH from Constants.hs does not exist in the build container.
577 ((".*def testResetEnv.*" all)
578 (string-append " @unittest.skipIf(True, "
579 "\"cannot reset env in the build container\")\n"
582 ;; XXX: Somehow this test fails in the build container, but
583 ;; works in 'guix environment -C', even without /bin/sh?
584 ((".*def testPidFile.*" all)
585 (string-append " @unittest.skipIf(True, "
586 "\"testPidFile fails in the build container\")\n"
589 ;; XXX: Why are these links not added automatically.
590 (with-directory-excursion "test/hs"
591 (for-each (lambda (file)
592 (symlink "../../src/htools" file))
593 '("hspace" "hscan" "hinfo" "hbal" "hroller"
594 "hcheck" "hail" "hsqueeze")))
596 (add-after 'install 'install-bash-completions
597 (lambda* (#:key outputs #:allow-other-keys)
598 (let* ((out (assoc-ref outputs "out"))
599 (compdir (string-append out "/etc/bash_completion.d")))
601 (copy-file "doc/examples/bash_completion"
602 (string-append compdir "/ganeti"))
603 ;; The one file contains completions for many different
604 ;; executables. Create symlinks for found completions.
605 (with-directory-excursion compdir
607 (lambda (prog) (symlink "ganeti" prog))
608 (call-with-input-file "ganeti"
610 (let loop ((line (read-line port))
612 (if (eof-object? line)
614 (if (string-prefix? "complete" line)
615 (loop (read-line port)
616 ;; Extract "prog" from lines of the form:
617 ;; "complete -F _prog -o filenames prog".
618 ;; Note that 'burnin' is listed with the
619 ;; absolute file name, which is why we
620 ;; run everything through 'basename'.
621 (cons (basename (car (reverse (string-split
624 (loop (read-line port) progs))))))))
626 ;; Wrap all executables with PYTHONPATH. We can't borrow the phase
627 ;; from python-build-system because we also need to wrap the scripts
628 ;; in $out/lib/ganeti such as "node-daemon-setup".
629 (add-after 'install 'wrap
630 (lambda* (#:key inputs outputs #:allow-other-keys)
631 (let* ((out (assoc-ref outputs "out"))
632 (sbin (string-append out "/sbin"))
633 (lib (string-append out "/lib"))
634 (python (assoc-ref inputs "python"))
635 (major+minor (python-version python))
636 (PYTHONPATH (string-append lib "/python" major+minor
638 (getenv "PYTHONPATH"))))
639 (define (shell-script? file)
640 (call-with-ascii-input-file file
642 (let ((shebang (false-if-exception (read-line port))))
644 (string-prefix? "#!" shebang)
645 (or (string-contains shebang "/bin/bash")
646 (string-contains shebang "/bin/sh")))))))
649 ;; Do not wrap shell scripts because some are meant to be
650 ;; sourced, which breaks if they are wrapped. We do wrap
651 ;; the Haskell executables because some call out to Python
653 (and (executable-file? file)
654 (not (symbolic-link? file))
655 (not (shell-script? file))))
657 (for-each (lambda (file)
659 `("PYTHONPATH" ":" prefix (,PYTHONPATH))))
661 (append (find-files (string-append lib "/ganeti"))
666 ("cabal" ,cabal-install)
669 ;; These inputs are necessary to bootstrap the package, because we
670 ;; have patched the build system.
671 ("autoconf" ,autoconf)
672 ("automake" ,automake)
674 ;; For the documentation.
675 ("python-docutils" ,python-docutils)
676 ("sphinx" ,python-sphinx)
677 ("pandoc" ,ghc-pandoc)
680 ;; Test dependencies.
681 ("fakeroot" ,fakeroot)
682 ("ghc-temporary" ,ghc-temporary)
683 ("ghc-test-framework" ,ghc-test-framework)
684 ("ghc-test-framework-hunit" ,ghc-test-framework-hunit)
685 ("ghc-test-framework-quickcheck2" ,ghc-test-framework-quickcheck2)
686 ("python-mock" ,python-mock)
687 ("python-pyyaml" ,python-pyyaml)
690 ("shelltestrunner" ,shelltestrunner)
691 ("tzdata" ,tzdata-for-tests)))
693 `(("arping" ,iputils) ;must be the iputils version
696 ("iproute2" ,iproute)
699 ("qemu" ,qemu-minimal) ;for qemu-img
700 ("ghc-attoparsec" ,ghc-attoparsec)
701 ("ghc-base64-bytestring" ,ghc-base64-bytestring)
702 ("ghc-cryptonite" ,ghc-cryptonite)
703 ("ghc-curl" ,ghc-curl)
704 ("ghc-hinotify" ,ghc-hinotify)
705 ("ghc-hslogger" ,ghc-hslogger)
706 ("ghc-json" ,ghc-json)
707 ("ghc-lens" ,ghc-lens)
708 ("ghc-lifted-base" ,ghc-lifted-base)
709 ("ghc-network" ,ghc-network)
710 ("ghc-old-time" ,ghc-old-time)
711 ("ghc-psqueue" ,ghc-psqueue)
712 ("ghc-regex-pcre" ,ghc-regex-pcre)
713 ("ghc-utf8-string" ,ghc-utf8-string)
714 ("ghc-zlib" ,ghc-zlib)
716 ;; For the optional metadata daemon.
717 ("ghc-snap-core" ,ghc-snap-core)
718 ("ghc-snap-server" ,ghc-snap-server)
721 ("python-pyopenssl" ,python-pyopenssl)
722 ("python-simplejson" ,python-simplejson)
723 ("python-pyparsing" ,python-pyparsing)
724 ("python-pyinotify" ,python-pyinotify)
725 ("python-pycurl" ,python-pycurl)
726 ("python-bitarray" ,python-bitarray)
727 ("python-paramiko" ,python-paramiko)
728 ("python-psutil" ,python-psutil)))
729 (home-page "http://www.ganeti.org/")
730 (synopsis "Cluster-based virtual machine management system")
732 "Ganeti is a virtual machine management tool built on top of existing
733 virtualization technologies such as Xen or KVM. Ganeti controls:
736 @item Disk creation management;
737 @item Operating system installation for instances (in co-operation with
738 OS-specific install scripts); and
739 @item Startup, shutdown, and failover between physical systems.
742 Ganeti is designed to facilitate cluster management of virtual servers and
743 to provide fast and simple recovery after physical failures, using
744 commodity hardware.")
745 (license license:bsd-2)))
747 (define-public libosinfo
754 (uri (string-append "https://releases.pagure.org/libosinfo/libosinfo-"
758 "1s97sv24bybggjx6hgqba2qdqz3ivfpd4cmkh4zm5y59sim109mv"))))
759 (build-system meson-build-system)
762 (list (string-append "-Dwith-usb-ids-path="
763 (assoc-ref %build-inputs "usb.ids"))
764 (string-append "-Dwith-pci-ids-path="
765 (assoc-ref %build-inputs "pci.ids")))
767 (modify-phases %standard-phases
768 (add-after 'unpack 'patch-osinfo-path
769 (lambda* (#:key inputs #:allow-other-keys)
770 (substitute* "osinfo/osinfo_loader.c"
771 (("path = DATA_DIR.*")
772 (string-append "path = \"" (assoc-ref inputs "osinfo-db")
773 "/share/osinfo\";")))
776 `(("libsoup" ,libsoup)
779 ("osinfo-db" ,osinfo-db)))
781 `(("glib" ,glib "bin") ; glib-mkenums, etc.
782 ("gobject-introspection" ,gobject-introspection)
785 ("intltool" ,intltool)
786 ("pkg-config" ,pkg-config)
790 (uri "https://github.com/pciutils/pciids/raw/ad02084f0bc143e3c15e31a6152a3dfb1d7a3156/pci.ids")
793 "0kfhpj5rnh24hz2714qhfmxk281vwc2w50sm73ggw5d15af7zfsw"))))
797 (uri "https://svn.code.sf.net/p/linux-usb/repo/trunk/htdocs/usb.ids?r=2681")
798 (file-name "usb.ids")
801 "1m6yhvz5k8aqzxgk7xj3jkk8frl1hbv0h3vgj4wbnvnx79qnvz3r"))))))
802 (home-page "https://libosinfo.org/")
803 (synopsis "Operating system information database")
804 (description "libosinfo is a GObject based library API for managing
805 information about operating systems, hypervisors and the (virtual) hardware
806 devices they can support. It includes a database containing device metadata
807 and provides APIs to match/identify optimal devices for deploying an operating
808 system on a hypervisor. Via GObject Introspection, the API is available in
809 all common programming languages. Vala bindings are also provided.")
810 ;; The library files are released under LGPLv2.1 or later; the source
811 ;; files in the "tools" directory are released under GPLv2+.
812 (license (list license:lgpl2.1+ license:gpl2+))))
821 "https://linuxcontainers.org/downloads/lxc/lxc-"
825 "1igxqgx8q9cp15mcp1y8j564bl85ijw04jcmgb1s5bmfbg1751sd"))))
826 (build-system gnu-build-system)
828 `(("pkg-config" ,pkg-config)))
832 ("libseccomp" ,libseccomp)
833 ("libselinux" ,libselinux)))
836 (list (string-append "--docdir=" (assoc-ref %outputs "out")
837 "/share/doc/" ,name "-" ,version)
839 "--localstatedir=/var")
841 (modify-phases %standard-phases
843 (lambda* (#:key outputs #:allow-other-keys)
844 (let* ((out (assoc-ref outputs "out"))
845 (bashcompdir (string-append out "/etc/bash_completion.d")))
846 (invoke "make" "install"
847 (string-append "bashcompdir=" bashcompdir)
848 ;; Don't install files into /var and /etc.
849 "LXCPATH=/tmp/var/lib/lxc"
850 "localstatedir=/tmp/var"
851 "sysconfdir=/tmp/etc"
852 "sysconfigdir=/tmp/etc/default")))))))
853 (synopsis "Linux container tools")
854 (home-page "https://linuxcontainers.org/")
856 "LXC is a userspace interface for the Linux kernel containment features.
857 Through a powerful API and simple tools, it lets Linux users easily create and
858 manage system or application containers.")
859 (license license:lgpl2.1+)))
861 (define-public libvirt
868 (uri (string-append "https://libvirt.org/sources/libvirt-"
871 (base32 "0m8cqaqflvys5kaqpvb0qr4k365j09jc5xk6x70yvg8qkcl2hcz2"))
873 (search-patches "libvirt-create-machine-cgroup.patch"))))
874 (build-system gnu-build-system)
878 "--with-qemu-user=nobody"
879 "--with-qemu-group=kvm"
881 (string-append "--docdir=" (assoc-ref %outputs "out") "/share/doc/"
884 "--localstatedir=/var")
886 (modify-phases %standard-phases
887 (add-before 'configure 'fix-BOURNE_SHELL-definition
888 ;; BOURNE_SHELL is hard-#defined to ‘/bin/sh’, causing test failures.
890 (substitute* "config.h.in"
891 (("/bin/sh") (which "sh")))
893 (add-before 'configure 'patch-libtirpc-file-names
894 (lambda* (#:key inputs #:allow-other-keys)
895 ;; libvirt uses an m4 macro instead of pkg-config to determine where
896 ;; the RPC headers are located. Tell it to look in the right place.
897 (substitute* "configure"
898 (("/usr/include/tirpc") ;defined in m4/virt-xdr.m4
899 (string-append (assoc-ref inputs "libtirpc")
902 (add-before 'configure 'disable-broken-tests
904 (let ((tests (list "commandtest" ; hangs idly
905 "qemuxml2argvtest" ; fails
906 "qemuhotplugtest" ; fails
907 "virnetsockettest" ; tries to network
908 "virshtest"))) ; fails
909 (substitute* "tests/Makefile.in"
910 (((format #f "(~a)\\$\\(EXEEXT\\)" (string-join tests "|")))
914 ;; Since the sysconfdir and localstatedir should be /etc and /var
915 ;; at runtime, we must prevent writing to them at installation
917 (lambda* (#:key make-flags #:allow-other-keys)
918 (apply invoke "make" "install"
919 "sysconfdir=/tmp/etc"
920 "localstatedir=/tmp/var"
923 `(("libxml2" ,libxml2)
925 ("libpciaccess" ,libpciaccess)
930 ("libtirpc" ,libtirpc) ;for <rpc/rpc.h>
931 ("libuuid" ,util-linux "lib")
932 ("lvm2" ,lvm2) ;for libdevmapper
935 ("cyrus-sasl" ,cyrus-sasl)
938 ("dmidecode" ,dmidecode)
940 ("ebtables" ,ebtables)
942 ("iptables" ,iptables)))
944 `(("xsltproc" ,libxslt)
946 ("pkg-config" ,pkg-config)
948 ("python" ,python-wrapper)))
949 (home-page "https://libvirt.org")
950 (synopsis "Simple API for virtualization")
951 (description "Libvirt is a C toolkit to interact with the virtualization
952 capabilities of recent versions of Linux. The library aims at providing long
953 term stable C API initially for the Xen paravirtualization but should be able
954 to integrate other virtualization mechanisms if needed.")
955 (license license:lgpl2.1+)))
957 (define-public libvirt-glib
959 (name "libvirt-glib")
963 (uri (string-append "ftp://libvirt.org/libvirt/glib/"
964 "libvirt-glib-" version ".tar.gz"))
967 "1zpbv4ninc57c9rw4zmmkvvqn7154iv1qfr20kyxn8xplalqrzvz"))))
968 (build-system gnu-build-system)
970 `(("openssl" ,openssl)
971 ("cyrus-sasl" ,cyrus-sasl)
972 ("lvm2" ,lvm2) ; for libdevmapper
973 ("libyajl" ,libyajl)))
975 `(("pkg-config" ,pkg-config)
976 ("intltool" ,intltool)
980 ;; ‘Required:’ by the installed .pc files.
984 ("gobject-introspection" ,gobject-introspection)))
985 (home-page "https://libvirt.org")
986 (synopsis "GLib wrapper around libvirt")
987 (description "libvirt-glib wraps the libvirt library to provide a
988 high-level object-oriented API better suited for glib-based applications, via
992 @item libvirt-glib - GLib main loop integration & misc helper APIs
993 @item libvirt-gconfig - GObjects for manipulating libvirt XML documents
994 @item libvirt-gobject - GObjects for managing libvirt objects
997 (license license:lgpl2.1+)))
999 (define-public python-libvirt
1001 (name "python-libvirt")
1006 (uri (string-append "https://libvirt.org/sources/python/libvirt-python-"
1009 (base32 "0kyz3lx49d8p75mvbzinxc1zgs8g7adn77y9bm15b8b4ad9zl5s6"))))
1010 (build-system python-build-system)
1013 (modify-phases %standard-phases
1014 (add-after 'unpack 'patch-nosetests-path
1015 (lambda* (#:key inputs #:allow-other-keys)
1016 (substitute* "setup.py"
1017 (("\"/usr/bin/nosetests\"")
1018 (string-append "\"" (which "nosetests") "\""))
1019 (("self\\.spawn\\(\\[sys\\.executable, nose\\]\\)")
1020 (format #f "self.spawn([\"~a\", nose])" (which "bash"))))
1023 `(("libvirt" ,libvirt)))
1025 `(("python-lxml" ,python-lxml)))
1027 `(("pkg-config" ,pkg-config)
1028 ("python-nose" ,python-nose)))
1029 (home-page "https://libvirt.org")
1030 (synopsis "Python bindings to libvirt")
1031 (description "This package provides Python bindings to the libvirt
1032 virtualization library.")
1033 (license license:lgpl2.1+)))
1035 (define-public python2-libvirt
1036 (package-with-python2 python-libvirt))
1038 (define-public virt-manager
1040 (name "virt-manager")
1044 (uri (string-append "https://virt-manager.org/download/sources"
1045 "/virt-manager/virt-manager-"
1049 "06ws0agxlip6p6n3n43knsnjyd91gqhh2dadgc33wl9lx1k8vn6g"))))
1050 (build-system python-build-system)
1052 `(#:use-setuptools? #f ; uses custom distutils 'install' command
1053 #:test-target "test_ui"
1054 #:tests? #f ; TODO The tests currently fail
1055 ; RuntimeError: Loop condition wasn't
1057 #:imported-modules ((guix build glib-or-gtk-build-system)
1058 ,@%python-build-system-modules)
1059 #:modules ((ice-9 match)
1061 (guix build python-build-system)
1062 ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
1065 (modify-phases %standard-phases
1066 (add-after 'unpack 'fix-setup
1067 (lambda* (#:key outputs #:allow-other-keys)
1068 (substitute* "virtinst/buildconfig.py"
1069 (("/usr") (assoc-ref outputs "out")))
1071 (add-after 'unpack 'fix-qemu-img-reference
1072 (lambda* (#:key inputs #:allow-other-keys)
1073 (substitute* "virtconv/formats.py"
1074 (("/usr(/bin/qemu-img)" _ suffix)
1075 (string-append (assoc-ref inputs "qemu") suffix)))
1077 (add-after 'unpack 'fix-default-uri
1078 (lambda* (#:key inputs #:allow-other-keys)
1079 ;; Xen is not available for now - so only patch qemu.
1080 (substitute* "virtManager/createconn.py"
1081 (("/usr(/bin/qemu-system)" _ suffix)
1082 (string-append (assoc-ref inputs "qemu") suffix)))
1084 (add-before 'wrap 'wrap-with-GI_TYPELIB_PATH
1085 (lambda* (#:key inputs outputs #:allow-other-keys)
1086 (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
1087 (bin-files (find-files bin ".*"))
1088 (paths (map (match-lambda
1089 ((output . directory)
1090 (let* ((girepodir (string-append
1092 "/lib/girepository-1.0")))
1093 (if (file-exists? girepodir)
1096 (for-each (lambda (file)
1097 (format #t "wrapping ~a\n" file)
1099 `("GI_TYPELIB_PATH" ":" prefix
1100 ,(filter identity paths))))
1104 (lambda* (#:key tests? #:allow-other-keys)
1106 (setenv "HOME" "/tmp")
1107 (system "Xvfb :1 &")
1108 (setenv "DISPLAY" ":1")
1109 ;; Dogtail requires that Assistive Technology support be enabled
1110 (setenv "GTK_MODULES" "gail:atk-bridge")
1111 (invoke "dbus-run-session" "--" "python" "setup.py" "test_ui"))
1113 (add-after 'install 'glib-or-gtk-compile-schemas
1114 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
1115 (add-after 'install 'glib-or-gtk-wrap
1116 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
1120 ("gtk-vnc" ,gtk-vnc)
1121 ("gtksourceview" ,gtksourceview)
1122 ("libvirt" ,libvirt)
1123 ("libvirt-glib" ,libvirt-glib)
1124 ("libosinfo" ,libosinfo)
1126 ("python-libvirt" ,python-libvirt)
1127 ("python-requests" ,python-requests)
1128 ("python-pycairo" ,python-pycairo)
1129 ("python-pygobject" ,python-pygobject)
1130 ("python-libxml2" ,python-libxml2)
1131 ("spice-gtk" ,spice-gtk)))
1132 ;; virt-manager searches for qemu-img or kvm-img in the PATH.
1136 `(("glib" ,glib "bin") ; glib-compile-schemas
1137 ("gobject-introspection" ,gobject-introspection)
1138 ("gtk+" ,gtk+ "bin") ; gtk-update-icon-cache
1139 ("perl" ,perl) ; pod2man
1140 ("intltool" ,intltool)
1141 ;; The following are required for running the tests
1142 ;; ("python-dogtail" ,python-dogtail)
1143 ;; ("xvfb" ,xorg-server-for-tests)
1145 ;; ("at-spi2-core" ,at-spi2-core)
1146 ;; ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
1148 (home-page "https://virt-manager.org/")
1149 (synopsis "Manage virtual machines")
1151 "The virt-manager application is a desktop user interface for managing
1152 virtual machines through libvirt. It primarily targets KVM VMs, but also
1153 manages Xen and LXC (Linux containers). It presents a summary view of running
1154 domains, their live performance and resource utilization statistics.")
1155 (license license:gpl2+)))
1163 (uri (string-append "https://download.openvz.org/criu/criu-"
1164 version ".tar.bz2"))
1167 "1jrr3v99g18gc0hriz0avq6ccdvyya0j6wwz888sdsc4icc30gzn"))))
1168 (build-system gnu-build-system)
1170 `(#:test-target "test"
1171 #:tests? #f ; tests require mounting as root
1173 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1174 (string-append "LIBDIR=" (assoc-ref %outputs "out")
1176 (string-append "ASCIIDOC=" (assoc-ref %build-inputs "asciidoc")
1178 (string-append "XMLTO=" (assoc-ref %build-inputs "xmlto")
1181 (modify-phases %standard-phases
1183 (lambda* (#:key inputs #:allow-other-keys)
1184 ;; The includes for libnl are located in a sub-directory.
1185 (setenv "C_INCLUDE_PATH"
1186 (string-append (assoc-ref inputs "libnl")
1188 (or (getenv "C_INCLUDE_PATH") "")))
1190 (add-after 'configure 'fix-documentation
1191 (lambda* (#:key inputs outputs #:allow-other-keys)
1192 (substitute* "Documentation/Makefile"
1195 "-m custom.xsl --skip-validation -x "
1196 (assoc-ref inputs "docbook-xsl") "/xml/xsl/"
1197 ,(package-name docbook-xsl) "-"
1198 ,(package-version docbook-xsl)
1199 "/manpages/docbook.xsl")))
1201 (add-after 'unpack 'hardcode-variables
1202 (lambda* (#:key inputs #:allow-other-keys)
1203 ;; Hardcode arm version detection
1204 (substitute* "Makefile"
1205 (("ARMV.*:=.*") "ARMV := 7\n"))
1206 ;; We are currently using python-2
1207 (substitute* "crit/Makefile"
1208 (("\\$\\(PYTHON\\)") "python2"))
1209 (substitute* "lib/Makefile"
1210 (("\\$\\(PYTHON\\)")
1211 (string-append (assoc-ref inputs "python")
1214 (add-before 'build 'fix-symlink
1215 (lambda* (#:key inputs #:allow-other-keys)
1216 ;; The file 'images/google/protobuf/descriptor.proto' points to
1217 ;; /usr/include/..., which obviously does not exist.
1218 (let* ((file "google/protobuf/descriptor.proto")
1219 (target (string-append "images/" file))
1220 (source (string-append (assoc-ref inputs "protobuf")
1222 (delete-file target)
1223 (symlink source target)
1225 (add-after 'install 'wrap
1226 (lambda* (#:key inputs outputs #:allow-other-keys)
1227 ;; Make sure 'crit' runs with the correct PYTHONPATH.
1228 (let* ((out (assoc-ref outputs "out"))
1229 (path (string-append out
1231 (string-take (string-take-right
1232 (assoc-ref inputs "python") 5) 3)
1234 (getenv "PYTHONPATH"))))
1235 (wrap-program (string-append out "/bin/crit")
1236 `("PYTHONPATH" ":" prefix (,path))))
1239 `(("protobuf" ,protobuf)
1240 ("python" ,python-2)
1241 ("python2-protobuf" ,python2-protobuf)
1242 ("python2-ipaddr" ,python2-ipaddr)
1243 ("iproute" ,iproute)
1248 ("libbsd" ,libbsd)))
1250 `(("pkg-config" ,pkg-config)
1252 ("protobuf-c" ,protobuf-c)
1253 ("asciidoc" ,asciidoc)
1255 ("docbook-xml" ,docbook-xml)
1256 ("docbook-xsl" ,docbook-xsl)))
1257 (home-page "https://criu.org")
1258 (synopsis "Checkpoint and restore in user space")
1259 (description "Using this tool, you can freeze a running application (or
1260 part of it) and checkpoint it to a hard drive as a collection of files. You
1261 can then use the files to restore and run the application from the point it
1262 was frozen at. The distinctive feature of the CRIU project is that it is
1263 mainly implemented in user space.")
1264 ;; The project is licensed under GPLv2; files in the lib/ directory are
1266 (license (list license:gpl2 license:lgpl2.1))))
1268 (define-public qmpbackup
1275 (url "https://github.com/abbbi/qmpbackup")
1277 (file-name (git-file-name name version))
1280 "0swhp5byz44brhyis1a39p11fyn9q84xz5q6v2fah29r7d71kmmx"))))
1281 (build-system python-build-system)
1283 `(#:python ,python-2))
1284 (home-page "https://github.com/abbbi/qmpbackup")
1285 (synopsis "Backup and restore QEMU machines")
1286 (description "qmpbackup is designed to create and restore full and
1287 incremental backups of running QEMU virtual machines via QMP, the QEMU
1289 (license license:gpl3+)))
1291 (define-public looking-glass-client
1292 (let ((commit "182c4752d57690da7f99d5e788de9b8baea33895"))
1294 (name "looking-glass-client")
1295 (version (string-append "a12-" (string-take commit 7)))
1299 (uri (git-reference (url "https://github.com/gnif/LookingGlass")
1301 (file-name (git-file-name name version))
1304 "02bq46ndmzq9cihazzn7xq1x7q5nzm7iw4l9lqzihxcxp9famkhw"))
1305 (modules '((guix build utils)))
1308 ;; Do not create binaries optimized for the CPU of the build machine,
1309 ;; for reproducibility and compatibility. TODO: in the next version
1310 ;; of looking glass, this is exposed as a CMake configure option.
1311 (substitute* "client/CMakeLists.txt"
1315 (build-system cmake-build-system)
1316 (inputs `(("fontconfig" ,fontconfig)
1319 ("openssl" ,openssl)
1321 ("sdl2-ttf" ,sdl2-ttf)
1322 ("spice-protocol" ,spice-protocol)
1323 ("wayland" ,wayland)))
1324 (native-inputs `(("libconfig" ,libconfig)
1326 ("pkg-config" ,pkg-config)))
1328 `(#:tests? #f ;; No tests are available.
1329 #:make-flags '("CC=gcc")
1330 #:phases (modify-phases %standard-phases
1331 (add-before 'configure 'chdir-to-client
1332 (lambda* (#:key outputs #:allow-other-keys)
1335 (add-after 'chdir-to-client 'add-missing-include
1337 ;; Mimic upstream commit b9797529893, required since the
1338 ;; update to Mesa 19.2.
1339 (substitute* "renderers/egl/shader.h"
1340 (("#include <stdbool\\.h>")
1341 "#include <stdbool.h>\n#include <stddef.h>"))
1344 (lambda* (#:key outputs #:allow-other-keys)
1345 (install-file "looking-glass-client"
1346 (string-append (assoc-ref outputs "out")
1349 (home-page "https://looking-glass.hostfission.com")
1350 (synopsis "KVM Frame Relay (KVMFR) implementation")
1351 (description "Looking Glass allows the use of a KVM (Kernel-based Virtual
1352 Machine) configured for VGA PCI Pass-through without an attached physical
1353 monitor, keyboard or mouse. It displays the VM's rendered contents on your main
1355 ;; This package requires SSE instructions.
1356 (supported-systems '("i686-linux" "x86_64-linux"))
1357 (license license:gpl2+))))
1362 (version "1.0.0-rc6")
1366 "https://github.com/opencontainers/runc/releases/"
1367 "download/v" version "/runc.tar.xz"))
1368 (file-name (string-append name "-" version ".tar.xz"))
1369 (patches (search-patches "runc-CVE-2019-5736.patch"))
1372 "1c7832dq70slkjh8qp2civ1wxhhdd2hrx84pq7db1mmqc9fdr3cc"))))
1373 (build-system go-build-system)
1375 '(#:import-path "github.com/opencontainers/runc"
1376 #:install-source? #f
1377 ;; XXX: 20/139 tests fail due to missing /var, cgroups and apparmor in
1378 ;; the build environment.
1381 (modify-phases %standard-phases
1383 (lambda* (#:key source import-path #:allow-other-keys)
1384 ;; Unpack the tarball into 'runc' instead of 'runc-1.0.0-rc5'.
1385 (let ((dest (string-append "src/" import-path)))
1387 (invoke "tar" "-C" (string-append "src/" import-path)
1388 "--strip-components=1"
1391 (lambda* (#:key import-path #:allow-other-keys)
1392 (chdir (string-append "src/" import-path))
1393 ;; XXX: requires 'go-md2man'.
1394 ;; (invoke "make" "man")
1398 ;; (invoke "make" "localunittest")))
1400 (lambda* (#:key outputs #:allow-other-keys)
1401 (let ((out (assoc-ref outputs "out")))
1402 (invoke "make" "install" "install-bash"
1403 (string-append "PREFIX=" out))))))))
1405 `(("pkg-config" ,pkg-config)))
1407 `(("libseccomp" ,libseccomp)))
1408 (synopsis "Open container initiative runtime")
1409 (home-page "https://www.opencontainers.org/")
1411 "@command{runc} is a command line client for running applications
1412 packaged according to the
1413 @uref{https://github.com/opencontainers/runtime-spec/blob/master/spec.md, Open
1414 Container Initiative (OCI) format} and is a compliant implementation of the
1415 Open Container Initiative specification.")
1416 (license license:asl2.0)))
1418 (define-public umoci
1426 "https://github.com/opencontainers/umoci/releases/download/v"
1427 version "/umoci.tar.xz"))
1428 (file-name (string-append "umoci-" version ".tar.xz"))
1430 (base32 "06q7xfwnqysc013hapx31jhlzmyg8qb467qfkynj673qc7p9bd6h"))))
1431 (build-system go-build-system)
1433 '(#:import-path "github.com/opencontainers/umoci"
1434 #:install-source? #f
1436 (modify-phases %standard-phases
1438 (lambda* (#:key source import-path #:allow-other-keys)
1439 ;; Unpack the tarball into 'umoci' instead of "runc-${version}".
1440 (let ((dest (string-append "src/" import-path)))
1442 (invoke "tar" "-C" (string-append "src/" import-path)
1443 "--strip-components=1"
1446 (lambda* (#:key import-path #:allow-other-keys)
1447 (chdir (string-append "src/" import-path))
1448 ;; TODO: build manpages with 'go-md2man'.
1449 (invoke "make" "SHELL=bash")))
1451 (lambda* (#:key outputs #:allow-other-keys)
1452 (let* ((out (assoc-ref outputs "out"))
1453 (bindir (string-append out "/bin")))
1454 (install-file "umoci" bindir)
1456 (home-page "https://umo.ci/")
1457 (synopsis "Tool for modifying Open Container images")
1459 "@command{umoci} is a tool that allows for high-level modification of an
1460 Open Container Initiative (OCI) image layout and its tagged images.")
1461 (license license:asl2.0)))
1463 (define-public skopeo
1470 (url "https://github.com/projectatomic/skopeo")
1471 (commit (string-append "v" version))))
1472 (file-name (git-file-name name version))
1475 "1bagirzdzjhicn5dr691092ac3q6lhz3xngjzgqiqkxnvpz7p6cn"))))
1476 (build-system go-build-system)
1478 `(("pkg-config" ,pkg-config)))
1480 `(("btrfs-progs" ,btrfs-progs)
1482 ("libassuan" ,libassuan)
1483 ("libselinux" ,libselinux)
1484 ("libostree" ,libostree)
1489 '(#:import-path "github.com/projectatomic/skopeo"
1490 #:install-source? #f
1491 #:tests? #f ; The tests require Docker
1493 (modify-phases %standard-phases
1495 (lambda* (#:key import-path #:allow-other-keys)
1496 (chdir (string-append "src/" import-path))
1497 ;; TODO: build manpages with 'go-md2man'.
1498 (invoke "make" "binary-local")))
1500 (lambda* (#:key outputs #:allow-other-keys)
1501 (let ((out (assoc-ref outputs "out")))
1502 (invoke "make" "install-binary" "install-completions"
1503 (string-append "PREFIX=" out))))))))
1504 (home-page "https://github.com/projectatomic/skopeo")
1505 (synopsis "Interact with container images and container image registries")
1507 "@command{skopeo} is a command line utility providing various operations
1508 with container images and container image registries. It can:
1511 @item Copy container images between various containers image stores,
1512 converting them as necessary.
1514 @item Convert a Docker schema 2 or schema 1 container image to an OCI image.
1516 @item Inspect a repository on a container registry without needlessly pulling
1519 @item Sign and verify container images.
1521 @item Delete container images from a remote container registry.
1524 (license license:asl2.0)))
1526 (define-public python-vagrant
1528 (name "python-vagrant")
1533 (uri (pypi-uri "python-vagrant" version))
1536 "1ikrh6canhcxg5y7pzmkcnnydikppv7s6sm9prfx90nk0ac8m6mg"))))
1537 (build-system python-build-system)
1539 '(#:tests? #f)) ; tests involve running vagrant.
1540 (home-page "https://github.com/todddeluca/python-vagrant")
1541 (synopsis "Python bindings for Vagrant")
1543 "Python-vagrant is a Python module that provides a thin wrapper around the
1544 @code{vagrant} command line executable, allowing programmatic control of Vagrant
1546 (license license:expat)))
1548 (define-public bubblewrap
1554 (uri (string-append "https://github.com/containers/bubblewrap/"
1555 "releases/download/v" version "/bubblewrap-"
1559 "00ycgi6q2yngh06bnz50wkvar6r2jnjf3j158grhi9k13jdrpimr"))))
1560 (build-system gnu-build-system)
1563 (modify-phases %standard-phases
1564 (add-after 'unpack 'fix-test
1565 (lambda* (#:key outputs #:allow-other-keys)
1566 ;; Tests try to access /var/tmp, which is not possible in our build
1567 ;; environment. Let's give them another directory.
1568 ;; /tmp gets overriden in some tests, so we need another directory.
1569 ;; the only possibility is the output directory.
1570 (let ((tmp-dir (string-append (assoc-ref outputs "out") "/tmp")))
1572 (substitute* "tests/test-run.sh"
1573 (("/var/tmp") tmp-dir)
1574 ;; Tests create a temporary python script, so fix its shebang.
1575 (("/usr/bin/env python") (which "python"))
1576 ;; Some tests try to access /usr, but that doesn't exist.
1577 ;; Give them /gnu instead.
1579 (("--ro-bind /bin /bin") "--ro-bind /gnu /bin")
1580 (("--ro-bind /sbin /sbin") "--ro-bind /gnu /sbin")
1581 (("--ro-bind /lib /lib") "--ro-bind /gnu /lib")
1582 ((" */bin/bash") (which "bash"))
1583 (("/bin/sh") (which "sh"))
1584 (("findmnt") (which "findmnt"))))
1586 ;; Remove the directory we gave to tests to have a clean package.
1587 (add-after 'check 'remove-tmp-dir
1588 (lambda* (#:key outputs #:allow-other-keys)
1589 (delete-file-recursively (string-append (assoc-ref outputs "out") "/tmp"))
1592 `(("libcap" ,libcap)))
1594 `(("python-2" ,python-2)
1595 ("util-linux" ,util-linux)))
1596 (home-page "https://github.com/containers/bubblewrap")
1597 (synopsis "Unprivileged sandboxing tool")
1598 (description "Bubblewrap is aimed at running applications in a sandbox,
1599 restricting their access to parts of the operating system or user data such as
1600 the home directory. Bubblewrap always creates a new mount namespace, and the
1601 user can specify exactly what parts of the file system should be made visible
1602 in the sandbox. These directories are mounted with the @code{nodev} option
1603 by default and can be made read-only.")
1604 (license license:lgpl2.0+)))
1606 (define-public bochs
1613 (uri (string-append "https://sourceforge.net/projects/bochs/files/bochs/"
1614 version "/bochs-" version ".tar.gz"))
1616 (base32 "0ql8q6y1k356li1g9gbvl21448mlxphxxi6kjb2b3pxvzd0pp2b3"))))
1617 (build-system gnu-build-system)
1619 `(#:tests? #f)) ; no tests exist
1621 `(("libxrandr" ,libxrandr)))
1622 (home-page "http://bochs.sourceforge.net/")
1623 (synopsis "Emulator for x86 PC")
1625 "Bochs is an emulator which can emulate Intel x86 CPU, common I/O
1626 devices, and a custom BIOS. It can also be compiled to emulate many different
1627 x86 CPUs, from early 386 to the most recent x86-64 Intel and AMD processors.
1628 Bochs can run most Operating Systems inside the emulation including Linux,
1629 DOS or Microsoft Windows.")
1630 (license license:lgpl2.0+)))
1639 (url "git://xenbits.xenproject.org/xen.git")
1640 (commit (string-append "RELEASE-" version))))
1641 (file-name (git-file-name name version))
1644 "0py50n995gv909i0d1lfdcj9wcp5g1d5z6m2291jqqlfyany138g"))))
1645 (build-system gnu-build-system)
1648 (list "--enable-rpath"
1649 "--disable-qemu-traditional" ; It tries to do "git clone"
1650 "--disable-rombios" ; would try to "git clone" via etherboot.
1651 ;; TODO: Re-enable stubdom (it's "more secure" to use it).
1652 "--disable-stubdom" ; tries to "git clone" old patched newlib.
1653 (string-append "--with-initddir="
1654 (assoc-ref %outputs "out")
1656 (string-append "--with-system-qemu="
1657 (assoc-ref %build-inputs "qemu")
1658 "/bin/qemu-system-i386")
1659 (string-append "--with-system-seabios="
1660 (assoc-ref %build-inputs "seabios")
1661 "/share/firmware/bios.bin")
1662 (string-append "--with-system-ovmf="
1663 (assoc-ref %build-inputs "ovmf")
1664 "/share/firmware/ovmf_ia32.bin"))
1665 #:make-flags (list "-j" "1"
1666 "XEN_BUILD_DATE=Thu Jan 1 01:00:01 CET 1970"
1667 "XEN_BUILD_TIME=01:00:01"
1670 "SMBIOS_REL_DATE=01/01/1970"
1671 "VGABIOS_REL_DATE=01 Jan 1970"
1672 ; QEMU_TRADITIONAL_LOC
1674 "SYSCONFIG_DIR=/tmp/etc/default"
1675 (string-append "BASH_COMPLETION_DIR="
1676 (assoc-ref %outputs "out")
1677 "/etc/bash_completion.d")
1678 (string-append "BOOT_DIR="
1679 (assoc-ref %outputs "out")
1681 (string-append "DEBUG_DIR="
1682 (assoc-ref %outputs "out")
1684 (string-append "EFI_DIR="
1685 (assoc-ref %outputs "out")
1686 "/lib/efi") ; TODO lib64 ?
1687 "MINIOS_UPSTREAM_URL="
1688 ;(string-append "DISTDIR="
1689 ; (assoc-ref %outputs "out"))
1691 #:test-target "test"
1693 (modify-phases %standard-phases
1694 (add-after 'unpack 'unpack-mini-os
1695 (lambda* (#:key inputs #:allow-other-keys)
1696 (copy-recursively (assoc-ref inputs "mini-os") "extras/mini-os")
1698 (add-after 'unpack-mini-os 'patch
1699 (lambda* (#:key inputs outputs #:allow-other-keys)
1700 (substitute* "tools/firmware/Rules.mk"
1701 (("override XEN_TARGET_ARCH = x86_32")
1702 (string-append "override XEN_TARGET_ARCH = x86_32
1703 override CC = " (assoc-ref inputs "cross-gcc") "/bin/i686-linux-gnu-gcc"))
1705 (string-append "CFLAGS=-I" (assoc-ref inputs "cross-libc")
1707 (substitute* "config/x86_32.mk"
1708 (("CFLAGS += -m32 -march=i686")
1709 (string-append "CFLAGS += -march=i686 -I"
1710 (assoc-ref inputs "cross-libc")
1712 ;; /var is not in /gnu/store , so don't try to create it.
1713 (substitute* '("tools/Makefile"
1714 "tools/xenstore/Makefile"
1715 "tools/xenpaging/Makefile")
1716 (("\\$\\(INSTALL_DIR\\) .*XEN_(DUMP|LOG|RUN|LIB|PAGING)_DIR.*")
1718 (("\\$\\(INSTALL_DIR\\) .*XEN_(RUN|LIB)_STORED.*")
1720 ;; Prevent xen from creating /etc .
1721 (substitute* "tools/examples/Makefile"
1722 ((" install-readmes") "")
1723 ((" install-configs") ""))
1725 (substitute* "tools/pygrub/setup.py"
1727 ; TODO: extra_link_args = ['-Wl,-rpath=/opt/foo'],
1728 (string-append "runtime_library_dirs = ['"
1729 (assoc-ref outputs "out")
1730 "/lib'],\nlibrary_dirs =")))
1732 (add-before 'configure 'patch-xen-script-directory
1733 (lambda* (#:key outputs #:allow-other-keys)
1734 (substitute* '("configure"
1737 (("XEN_SCRIPT_DIR=.*")
1738 (string-append "XEN_SCRIPT_DIR="
1739 (assoc-ref outputs "out")
1740 "/etc/xen/scripts")))
1742 (add-before 'configure 'set-environment-up
1743 (lambda* (#:key make-flags #:allow-other-keys)
1745 (string-contains x "cross-i686-linux"))
1746 (define (filter-environment! filter-predicate
1747 environment-variable-names)
1750 (let* ((env-value (getenv env-name))
1751 (search-path (search-path-as-string->list env-value))
1752 (new-search-path (filter filter-predicate
1754 (new-env-value (list->search-path-as-string
1755 new-search-path ":")))
1756 (setenv env-name new-env-value)))
1757 environment-variable-names))
1758 (setenv "CROSS_CPATH" (getenv "CPATH"))
1759 (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
1760 (filter-environment! cross?
1762 "CROSS_LIBRARY_PATH"))
1763 (filter-environment! (lambda (e) (not (cross? e)))
1766 ;; Guix tries to be helpful and automatically adds
1767 ;; mini-os-git-checkout/include to the include path,
1768 ;; but actually we don't want it to be there (yet).
1769 (filter-environment! (lambda (e)
1772 "mini-os-git-checkout")))
1775 (setenv "EFI_VENDOR" "guix")
1778 (lambda* (#:key make-flags #:allow-other-keys)
1779 (apply invoke "make" "world" make-flags))))))
1781 `(("acpica" ,acpica) ; TODO: patch iasl invocation.
1782 ("bridge-utils" ,bridge-utils) ; TODO: patch invocations.
1784 ("iproute" ,iproute) ; TODO: patch invocations.
1787 ("libyajl" ,libyajl)
1788 ("ncurses" ,ncurses)
1789 ("openssl" ,openssl)
1792 ("qemu" ,qemu-minimal)
1793 ("seabios" ,seabios)
1794 ("util-linux" ,util-linux "lib") ; uuid
1795 ; TODO: ocaml-findlib, ocaml-nox.
1796 ("xz" ,xz) ; for liblzma
1801 ("cmake" ,cmake-minimal)
1804 ("gettext" ,gettext-minimal)
1810 (url "http://xenbits.xen.org/git-http/mini-os.git")
1811 (commit (string-append "xen-RELEASE-" version))))
1814 "1i8pcl19n60i2m9vlg79q3nknpj209c9ic5x10wxaicx45kc107f"))
1815 (file-name "mini-os-git-checkout")))
1818 ("pkg-config" ,pkg-config)
1819 ("python" ,python-2)
1821 ("cross-gcc" ,(cross-gcc "i686-linux-gnu"
1822 #:xbinutils (cross-binutils "i686-linux-gnu")
1823 #:libc (cross-libc "i686-linux-gnu")))
1824 ("cross-libc" ,(cross-libc "i686-linux-gnu")) ; header files
1825 ("cross-libc-static" ,(cross-libc "i686-linux-gnu") "static")))
1826 (home-page "https://xenproject.org/")
1827 (synopsis "Xen Virtual Machine Monitor")
1828 (description "This package provides the Xen Virtual Machine Monitor
1829 which is a hypervisor.")
1830 ;; TODO: Some files are licensed differently. List those.
1831 (license license:gpl2)
1832 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))))
1834 (define-public osinfo-db-tools
1836 (name "osinfo-db-tools")
1840 (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-tools-"
1845 "038q3gzdbkfkhpicj0755mw1q4gbvn57pslpw8n2dp3lds9im0g9"))))
1846 (build-system meson-build-system)
1848 `(("libsoup" ,libsoup)
1849 ("libxml2" ,libxml2)
1850 ("libxslt" ,libxslt)
1851 ("json-glib" ,json-glib)
1852 ("libarchive" ,libarchive)))
1855 ("gobject-introspection" ,gobject-introspection)
1856 ("gettext" ,gettext-minimal)
1857 ("pkg-config" ,pkg-config)
1860 ("pytest" ,python-pytest)
1861 ("requests" ,python-requests)))
1862 (home-page "https://gitlab.com/libosinfo/osinfo-db-tools")
1863 (synopsis "Tools for managing the osinfo database")
1864 (description "This package contains a set of tools to assist
1865 administrators and developers in managing the database.")
1866 (license license:lgpl2.0+)))
1868 (define-public osinfo-db
1871 (version "20200529")
1874 (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-"
1878 "0mbrf9j5wmjhc6jixvhp4jqyxixh1717lqrmzmipdg99xnzba81n"))))
1879 (build-system trivial-build-system)
1881 `(#:modules ((guix build utils))
1884 (use-modules (guix build utils))
1885 (let* ((out (assoc-ref %outputs "out"))
1886 (osinfo-dir (string-append out "/share/osinfo"))
1887 (source (assoc-ref %build-inputs "source"))
1889 (string-append (assoc-ref %build-inputs "osinfo-db-tools")
1890 "/bin/osinfo-db-import")))
1891 (mkdir-p osinfo-dir)
1892 (invoke osinfo-db-import "--dir" osinfo-dir source)
1895 `(("intltool" ,intltool)
1896 ("osinfo-db-tools" ,osinfo-db-tools)))
1897 (home-page "https://gitlab.com/libosinfo/osinfo-db")
1898 (synopsis "Database of information about operating systems")
1899 (description "Osinfo-db provides the database files for use with the
1900 libosinfo library. It provides information about guest operating systems for
1901 use with virtualization provisioning tools")
1902 (license license:lgpl2.0+)))