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–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 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>
23 ;;; This file is part of GNU Guix.
25 ;;; GNU Guix is free software; you can redistribute it and/or modify it
26 ;;; under the terms of the GNU General Public License as published by
27 ;;; the Free Software Foundation; either version 3 of the License, or (at
28 ;;; your option) any later version.
30 ;;; GNU Guix is distributed in the hope that it will be useful, but
31 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
32 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 ;;; GNU General Public License for more details.
35 ;;; You should have received a copy of the GNU General Public License
36 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
38 (define-module (gnu packages virtualization)
39 #:use-module (gnu packages)
40 #:use-module (gnu packages admin)
41 #:use-module (gnu packages assembly)
42 #:use-module (gnu packages attr)
43 #:use-module (gnu packages autotools)
44 #:use-module (gnu packages backup)
45 #:use-module (gnu packages base)
46 #:use-module (gnu packages bash)
47 #:use-module (gnu packages bison)
48 #:use-module (gnu packages build-tools)
49 #:use-module (gnu packages check)
50 #:use-module (gnu packages cmake)
51 #:use-module (gnu packages compression)
52 #:use-module (gnu packages cross-base)
53 #:use-module (gnu packages curl)
54 #:use-module (gnu packages cyrus-sasl)
55 #:use-module (gnu packages debian)
56 #:use-module (gnu packages disk)
57 #:use-module (gnu packages dns)
58 #:use-module (gnu packages docbook)
59 #:use-module (gnu packages documentation)
60 #:use-module (gnu packages figlet)
61 #:use-module (gnu packages firmware)
62 #:use-module (gnu packages flex)
63 #:use-module (gnu packages fontutils)
64 #:use-module (gnu packages freedesktop)
65 #:use-module (gnu packages gettext)
66 #:use-module (gnu packages gl)
67 #:use-module (gnu packages glib)
68 #:use-module (gnu packages gnome)
69 #:use-module (gnu packages gnupg)
70 #:use-module (gnu packages golang)
71 #:use-module (gnu packages graphviz)
72 #:use-module (gnu packages gtk)
73 #:use-module (gnu packages haskell)
74 #:use-module (gnu packages haskell-apps)
75 #:use-module (gnu packages haskell-check)
76 #:use-module (gnu packages haskell-crypto)
77 #:use-module (gnu packages haskell-web)
78 #:use-module (gnu packages haskell-xyz)
79 #:use-module (gnu packages image)
80 #:use-module (gnu packages libbsd)
81 #:use-module (gnu packages libusb)
82 #:use-module (gnu packages linux)
83 #:use-module (gnu packages m4)
84 #:use-module (gnu packages ncurses)
85 #:use-module (gnu packages nettle)
86 #:use-module (gnu packages networking)
87 #:use-module (gnu packages ninja)
88 #:use-module (gnu packages onc-rpc)
89 #:use-module (gnu packages package-management)
90 #:use-module (gnu packages perl)
91 #:use-module (gnu packages pcre)
92 #:use-module (gnu packages pkg-config)
93 #:use-module (gnu packages polkit)
94 #:use-module (gnu packages protobuf)
95 #:use-module (gnu packages python)
96 #:use-module (gnu packages python-build)
97 #:use-module (gnu packages python-check)
98 #:use-module (gnu packages python-crypto)
99 #:use-module (gnu packages python-web)
100 #:use-module (gnu packages python-xyz)
101 #:use-module (gnu packages pulseaudio)
102 #:use-module (gnu packages readline)
103 #:use-module (gnu packages selinux)
104 #:use-module (gnu packages sdl)
105 #:use-module (gnu packages sphinx)
106 #:use-module (gnu packages spice)
107 #:use-module (gnu packages ssh)
108 #:use-module (gnu packages texinfo)
109 #:use-module (gnu packages textutils)
110 #:use-module (gnu packages tls)
111 #:use-module (gnu packages web)
112 #:use-module (gnu packages wget)
113 #:use-module (gnu packages xdisorg)
114 #:use-module (gnu packages xml)
115 #:use-module (gnu packages xorg)
116 #:use-module (guix build-system cmake)
117 #:use-module (guix build-system gnu)
118 #:use-module (guix build-system go)
119 #:use-module (guix build-system meson)
120 #:use-module (guix build-system python)
121 #:use-module (guix build-system trivial)
122 #:use-module (guix download)
123 #:use-module (guix git-download)
124 #:use-module ((guix licenses) #:prefix license:)
125 #:use-module (guix packages)
126 #:use-module (guix utils)
127 #:use-module (srfi srfi-1)
128 #:use-module (srfi srfi-26)
129 #:use-module (ice-9 match))
131 (define (qemu-patch commit file-name sha256-bv)
132 "Return an origin for COMMIT."
136 "http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h="
138 (hash (content-hash sha256-bv sha256))
139 (file-name file-name)))
148 (uri (string-append "https://download.qemu.org/qemu-"
152 "1g0pvx4qbirpcn9mni704y03n3lvkmw2c0rbcwvydyr8ns4xh66b"))
153 (patches (search-patches "qemu-CVE-2021-20203.patch"
154 "qemu-build-info-manual.patch"))
155 (modules '((guix build utils)))
158 ;; Fix a bug in the do_ioctl_ifconf() function of qemu to
159 ;; make ioctl(…, SIOCGIFCONF, …) work for emulated 64 bit
160 ;; architectures. The size of struct ifreq is handled
162 ;; https://lists.nongnu.org/archive/html/qemu-devel/2021-01/msg01545.html
163 (substitute* '("linux-user/syscall.c")
164 (("^([[:blank:]]*)const argtype ifreq_arg_type.*$" line indent)
165 (string-append line indent "const argtype ifreq_max_type[] = "
166 "{ MK_STRUCT(STRUCT_ifmap_ifreq) };\n"))
167 (("^([[:blank:]]*)target_ifreq_size[[:blank:]]=.*$" _ indent)
168 (string-append indent "target_ifreq_size = "
169 "thunk_type_size(ifreq_max_type, 0);")))
170 ;; Delete the bundled meson copy.
171 (delete-file-recursively "meson")))))
172 (outputs '("out" "static" "doc")) ;5.3 MiB of HTML docs
173 (build-system gnu-build-system)
175 ;; FIXME: Disable tests on i686 to work around
176 ;; <https://bugs.gnu.org/40527>.
177 `(#:tests? ,(or (%current-target-system)
178 (not (string=? "i686-linux" (%current-system))))
180 (let ((gcc (string-append (assoc-ref %build-inputs "gcc") "/bin/gcc"))
181 (out (assoc-ref %outputs "out")))
182 (list (string-append "--cc=" gcc)
183 ;; Some architectures insist on using HOST_CC.
184 (string-append "--host-cc=" gcc)
185 (string-append "--prefix=" out)
187 (string-append "--smbd=" out "/libexec/samba-wrapper")
188 "--disable-debug-info" ;for space considerations
189 ;; The binaries need to be linked against -lrt.
190 (string-append "--extra-ldflags=-lrt")))
191 ;; Make build and test output verbose to facilitate investigation upon failure.
192 #:make-flags '("V=1")
193 #:modules ((srfi srfi-1)
197 ,@%gnu-build-system-modules)
199 (modify-phases %standard-phases
200 (add-after 'set-paths 'hide-glibc
201 (lambda* (#:key inputs #:allow-other-keys)
202 ;; Work around https://issues.guix.info/issue/36882. We need to
203 ;; remove glibc from C_INCLUDE_PATH so that the one hardcoded in GCC,
204 ;; at the bottom of GCC include search-path is used.
205 (let* ((filters '("libc"))
207 (filter-map (lambda (input)
210 (and (not (member name filters))
213 (set-path-environment-variable "C_INCLUDE_PATH"
215 input-directories))))
216 (add-after 'unpack 'extend-test-time-outs
218 ;; These tests can time out on heavily-loaded and/or slow storage.
219 (substitute* (cons* "tests/qemu-iotests/common.qemu"
220 (find-files "tests/qemu-iotests" "^[0-9]+$"))
221 (("QEMU_COMM_TIMEOUT=[0-9]+" match)
222 (string-append match "9")))))
223 (add-after 'unpack 'disable-unusable-tests
225 (substitute* "tests/meson.build"
226 ;; Comment out the test-qga test, which needs /sys and
227 ;; fails within the build environment.
228 (("tests.*test-qga.*$" all)
229 (string-append "# " all))
230 ;; Comment out the test-char test, which needs networking and
231 ;; fails within the build environment.
232 (("check-unit-.* tests/test-char" all)
233 (string-append "# " all)))))
234 (add-after 'patch-source-shebangs 'patch-embedded-shebangs
236 ;; Ensure the executables created by these source files reference
237 ;; /bin/sh from the store so they work inside the build container.
238 (substitute* '("block/cloop.c" "migration/exec.c"
239 "net/tap.c" "tests/qtest/libqtest.c")
240 (("/bin/sh") (which "sh")))
241 (substitute* "Makefile"
242 (("SHELL = /usr/bin/env bash -o pipefail")
243 "SHELL = bash -o pipefail"))
244 (substitute* "tests/qemu-iotests/check"
245 (("#!/usr/bin/env python3")
246 (string-append "#!" (which "python3"))))))
247 (add-before 'configure 'fix-optionrom-makefile
249 ;; Work around the inability of the rules defined in this
250 ;; Makefile to locate the firmware files (e.g.: No rule to make
251 ;; target 'multiboot.bin') by extending the VPATH.
252 (substitute* "pc-bios/optionrom/Makefile"
253 (("^VPATH = \\$\\(SRC_DIR\\)")
254 "VPATH = $(SRC_DIR):$(TOPSRC_DIR)/pc-bios"))))
255 ;; XXX ./configure is being re-run at beginning of build phase...
257 (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
258 ;; The `configure' script doesn't understand some of the
259 ;; GNU options. Thus, add a new phase that's compatible.
260 (let ((out (assoc-ref outputs "out")))
261 (setenv "SHELL" (which "bash"))
262 ;; Ensure config.status gets the correct shebang off the bat.
263 ;; The build system gets confused if we change it later and
264 ;; attempts to re-run the whole configuration, and fails.
265 (substitute* "configure"
267 (string-append "#!" (which "sh"))))
270 (apply invoke "../../configure" configure-flags))))
271 ;; Configure, build and install QEMU user-emulation static binaries.
272 (add-after 'configure 'configure-user-static
273 (lambda* (#:key inputs outputs #:allow-other-keys)
274 (let* ((gcc (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
275 (static (assoc-ref outputs "static"))
276 ;; This is the common set of configure flags; it is
277 ;; duplicated here to isolate this phase from manipulations
278 ;; to the #:configure-flags build argument, as done in
279 ;; derived packages such as qemu-minimal.
280 (configure-flags (list (string-append "--cc=" gcc)
281 (string-append "--host-cc=" gcc)
283 "--disable-debug-info")))
284 (mkdir-p "../user-static")
285 (with-directory-excursion "../user-static"
286 (apply invoke "../../configure"
288 "--disable-docs" ;already built
290 "--enable-linux-user"
291 (string-append "--prefix=" static)
293 (add-after 'build 'build-user-static
295 (with-directory-excursion "../user-static"
296 (apply (assoc-ref %standard-phases 'build) args))))
297 (add-after 'install 'install-user-static
298 (lambda* (#:key outputs #:allow-other-keys)
299 (let* ((static (assoc-ref outputs "static"))
300 (bin (string-append static "/bin")))
301 (with-directory-excursion "../user-static"
302 (for-each (cut install-file <> bin)
303 (append-map (cut find-files <> "^qemu-" #:stat stat)
306 "-linux-user" <>))))))))
307 ;; Create a wrapper for Samba. This allows QEMU to use Samba without
308 ;; pulling it in as an input. Note that you need to explicitly install
309 ;; Samba in your Guix profile for Samba support.
310 (add-after 'install 'create-samba-wrapper
311 (lambda* (#:key inputs outputs #:allow-other-keys)
312 (let* ((out (assoc-ref outputs "out"))
313 (libexec (string-append out "/libexec")))
314 (call-with-output-file "samba-wrapper"
316 (format port "#!/bin/sh
318 (chmod "samba-wrapper" #o755)
319 (install-file "samba-wrapper" libexec))))
320 (add-after 'install 'move-html-doc
321 (lambda* (#:key inputs outputs #:allow-other-keys)
322 (let* ((out (assoc-ref outputs "out"))
323 (doc (assoc-ref outputs "doc"))
324 (qemu-doc (string-append doc "/share/doc/qemu-" ,version)))
326 (rename-file (string-append out "/share/doc/qemu")
327 (string-append qemu-doc "/html"))))))))
328 (inputs ; TODO: Add optional inputs.
329 `(("alsa-lib" ,alsa-lib)
335 ("libcacard" ,libcacard) ; smartcard support
336 ("libcap-ng" ,libcap-ng) ; virtfs support requires libcap-ng & libattr
338 ("libepoxy" ,libepoxy)
339 ("libjpeg" ,libjpeg-turbo)
341 ("libseccomp" ,libseccomp)
342 ("libusb" ,libusb) ;USB pass-through support
345 ;; ("pciutils" ,pciutils)
347 ("pulseaudio" ,pulseaudio)
350 ("usbredir" ,usbredir)
351 ("util-linux" ,util-linux)
353 ("virglrenderer" ,virglrenderer)
355 (native-inputs `(("gettext" ,gettext-minimal)
356 ("glib:bin" ,glib "bin") ; gtester, etc.
360 ;; Using meson 0.57.1 enables reproducible QEMU builds.
361 ("meson" ,meson-next)
363 ("pkg-config" ,pkg-config)
364 ("python-wrapper" ,python-wrapper)
365 ("python-sphinx" ,python-sphinx)
367 ;; The following static libraries are required to build
368 ;; the static output of QEMU.
369 ("glib-static" ,glib-static)
370 ("pcre:static" ,pcre "static")
371 ("zlib:static" ,zlib "static")))
372 (home-page "https://www.qemu.org")
373 (synopsis "Machine emulator and virtualizer")
375 "QEMU is a generic machine emulator and virtualizer.
377 When used as a machine emulator, QEMU can run OSes and programs made for one
378 machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
379 using dynamic translation, it achieves very good performance.
381 When used as a virtualizer, QEMU achieves near native performances by
382 executing the guest code directly on the host CPU. QEMU supports
383 virtualization when executing under the Xen hypervisor or using
384 the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
385 server and embedded PowerPC, and S390 guests.")
387 ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
388 (license license:gpl2)
390 ;; Several tests fail on MIPS; see <http://hydra.gnu.org/build/117914>.
391 (supported-systems (fold delete %supported-systems
392 '("mips64el-linux" "i586-gnu")))))
394 (define-public qemu-minimal
395 ;; QEMU without GUI support, only supporting the host's architecture
398 (name "qemu-minimal")
400 "Machine emulator and virtualizer (without GUI) for the host architecture")
402 (substitute-keyword-arguments (package-arguments qemu)
403 ((#:configure-flags configure-flags '(list))
404 ;; Restrict to the host's architecture.
405 (let* ((system (or (%current-target-system)
409 ((? (cut string-prefix? "i686" <>))
410 "--target-list=i386-softmmu")
411 ((? (cut string-prefix? "x86_64" <>))
412 "--target-list=i386-softmmu,x86_64-softmmu")
413 ((? (cut string-prefix? "mips64" <>))
414 (string-append "--target-list=mips-softmmu,mipsel-softmmu,"
415 "mips64-softmmu,mips64el-softmmu"))
416 ((? (cut string-prefix? "mips" <>))
417 "--target-list=mips-softmmu,mipsel-softmmu")
418 ((? (cut string-prefix? "aarch64" <>))
419 "--target-list=arm-softmmu,aarch64-softmmu")
420 ((? (cut string-prefix? "arm" <>))
421 "--target-list=arm-softmmu")
422 ((? (cut string-prefix? "alpha" <>))
423 "--target-list=alpha-softmmu")
424 ((? (cut string-prefix? "powerpc64" <>))
425 "--target-list=ppc-softmmu,ppc64-softmmu")
426 ((? (cut string-prefix? "powerpc" <>))
427 "--target-list=ppc-softmmu")
428 ((? (cut string-prefix? "s390" <>))
429 "--target-list=s390x-softmmu")
430 ((? (cut string-prefix? "riscv" <>))
431 "--target-list=riscv32-softmmu,riscv64-softmmu")
432 (else ; An empty list actually builds all the targets.
434 `(cons ,target-list-arg ,configure-flags)))))
436 ;; Remove dependencies on optional libraries, notably GUI libraries.
437 (native-inputs (fold alist-delete (package-native-inputs qemu)
439 (inputs (fold alist-delete (package-inputs qemu)
440 '("libusb" "mesa" "sdl2" "spice" "virglrenderer" "gtk+"
441 "usbredir" "libdrm" "libepoxy" "pulseaudio" "vde2"
444 (define (system->qemu-target system)
446 ((string-prefix? "i686" system)
448 ((string-prefix? "arm" system)
451 (string-append "qemu-system-" (match (string-split system #\-)
455 (define-public ganeti
458 ;; Note: we use a pre-release for Python 3 compatibility as well as many
460 (version "3.0.0beta1-24-g024cc9fa2")
464 (url "https://github.com/ganeti/ganeti")
465 (commit (string-append "v" version))))
467 (base32 "1ll34qd2mifni3bhg7cnir3xfnkafig8ch33qndqwrsby0y5ssia"))
468 (file-name (git-file-name name version))
469 (patches (search-patches "ganeti-shepherd-support.patch"
470 "ganeti-shepherd-master-failover.patch"
471 "ganeti-deterministic-manual.patch"
472 "ganeti-drbd-compat.patch"
473 "ganeti-os-disk-size.patch"
474 "ganeti-haskell-pythondir.patch"
475 "ganeti-disable-version-symlinks.patch"
476 "ganeti-preserve-PYTHONPATH.patch"))))
477 (build-system gnu-build-system)
479 `(#:imported-modules (,@%gnu-build-system-modules
480 (guix build haskell-build-system)
481 (guix build python-build-system))
482 #:modules (,@%gnu-build-system-modules
483 ((guix build haskell-build-system) #:prefix haskell:)
484 ((guix build python-build-system) #:select (python-version))
487 ;; The default test target includes a lot of checks that are only really
488 ;; relevant for developers such as NEWS file checking, line lengths, etc.
489 ;; We are only interested in the "py-tests" and "hs-tests" targets: this
490 ;; is the closest we've got even though it includes a little more.
491 #:test-target "check-TESTS"
494 (list "--localstatedir=/var"
495 "--sharedstatedir=/var"
497 "--enable-haskell-tests"
499 ;; By default, the build system installs everything to versioned
500 ;; directories such as $libdir/3.0 and relies on a $libdir/default
501 ;; symlink pointed from /etc/ganeti/{lib,share} to actually function.
502 ;; This is done to accommodate installing multiple versions in
503 ;; parallel, but is of little use to us as Guix users can just
504 ;; roll back and forth. Thus, disable it for simplicity.
505 "--disable-version-links"
507 ;; Ganeti can optionally take control over SSH host keys and
508 ;; distribute them to nodes as they are added, and also rotate keys
509 ;; with 'gnt-cluster renew-crypto --new-ssh-keys'. Thus it needs to
510 ;; know how to restart the SSH daemon.
511 "--with-sshd-restart-command='herd restart ssh-daemon'"
513 ;; Look for OS definitions in this directory by default. It can
514 ;; be changed in the cluster configuration.
515 "--with-os-search-path=/run/current-system/profile/share/ganeti/os"
517 ;; The default QEMU executable to use. We don't use the package
518 ;; here because this entry is stored in the cluster configuration.
519 (string-append "--with-kvm-path=/run/current-system/profile/bin/"
520 ,(system->qemu-target (%current-system))))
522 (modify-phases %standard-phases
523 (add-after 'unpack 'create-vcs-version
525 ;; If we are building from a git checkout, we need to create a
526 ;; 'vcs-version' file manually because the build system does
527 ;; not have access to the git repository information.
528 (unless (file-exists? "vcs-version")
529 (call-with-output-file "vcs-version"
531 (format port "v~a~%" ,version))))
533 (add-after 'unpack 'patch-absolute-file-names
535 (substitute* '("lib/utils/process.py"
537 "src/Ganeti/Constants.hs"
538 "src/Ganeti/HTools/CLI.hs"
539 "test/py/ganeti.config_unittest.py"
540 "test/py/ganeti.hooks_unittest.py"
541 "test/py/ganeti.utils.process_unittest.py"
542 "test/py/ganeti.utils.text_unittest.py"
543 "test/py/ganeti.utils.wrapper_unittest.py")
544 (("/bin/sh") (which "sh"))
545 (("/bin/bash") (which "bash"))
546 (("/usr/bin/env") (which "env"))
547 (("/bin/true") (which "true")))
549 ;; This script is called by the node daemon at startup to perform
550 ;; sanity checks on the cluster IP addresses, and it is also used
551 ;; in a master-failover scenario. Add absolute references to
552 ;; avoid propagating these executables.
553 (substitute* "tools/master-ip-setup"
554 (("arping") (which "arping"))
555 (("ndisc6") (which "ndisc6"))
556 (("fping") (which "fping"))
557 (("grep") (which "grep"))
558 (("ip addr") (string-append (which "ip") " addr")))
560 (add-after 'unpack 'override-builtin-PATH
562 ;; Ganeti runs OS install scripts and similar with a built-in
563 ;; hard coded PATH. Patch so it works on Guix System.
564 (substitute* "src/Ganeti/Constants.hs"
565 (("/sbin:/bin:/usr/sbin:/usr/bin")
566 "/run/setuid-programs:/run/current-system/profile/sbin:\
567 /run/current-system/profile/bin"))
569 (add-after 'bootstrap 'patch-sphinx-version-detection
571 ;; The build system runs 'sphinx-build --version' to verify that
572 ;; the Sphinx is recent enough, but does not expect the
573 ;; .sphinx-build-real executable name created by the Sphinx wrapper.
574 (substitute* "configure"
575 (("\\$SPHINX --version 2>&1")
576 "$SPHINX --version 2>&1 | sed 's/.sphinx-build-real/sphinx-build/g'"))
579 ;; The build system invokes Cabal and GHC, which do not work with
580 ;; GHC_PACKAGE_PATH: <https://github.com/haskell/cabal/issues/3728>.
581 ;; Tweak the build system to do roughly what haskell-build-system does.
582 (add-before 'configure 'configure-haskell
583 (assoc-ref haskell:%standard-phases 'setup-compiler))
584 (add-after 'configure 'do-not-use-GHC_PACKAGE_PATH
586 (unsetenv "GHC_PACKAGE_PATH")
587 (substitute* "Makefile"
589 "$(CABAL) --package-db=../package.conf.d")
591 "$(GHC) -package-db=../package.conf.d"))
593 (add-after 'configure 'make-ghc-use-shared-libraries
595 (substitute* "Makefile"
596 (("HFLAGS =") "HFLAGS = -dynamic -fPIC"))
598 (add-after 'configure 'fix-installation-directories
600 (substitute* "Makefile"
601 ;; Do not attempt to create /var during install.
602 (("\\$\\(DESTDIR\\)\\$\\{localstatedir\\}")
603 "$(DESTDIR)${prefix}${localstatedir}")
604 ;; Similarly, do not attempt to install the sample ifup scripts
606 (("\\$\\(DESTDIR\\)\\$\\(ifupdir\\)")
607 "$(DESTDIR)${prefix}$(ifupdir)"))
609 (add-before 'build 'adjust-tests
611 ;; Disable tests that can not run. Do it early to prevent
612 ;; touching the Makefile later and triggering a needless rebuild.
613 (substitute* "Makefile"
614 ;; These tests expect the presence of a 'root' user (via
615 ;; ganeti/runtime.py), which fails in the build environment.
616 (("test/py/ganeti\\.asyncnotifier_unittest\\.py") "")
617 (("test/py/ganeti\\.backend_unittest\\.py") "")
618 (("test/py/ganeti\\.daemon_unittest\\.py") "")
619 (("test/py/ganeti\\.tools\\.ensure_dirs_unittest\\.py") "")
620 (("test/py/ganeti\\.utils\\.io_unittest-runasroot\\.py") "")
621 ;; Disable the bash_completion test, as it requires the full
622 ;; bash instead of bash-minimal.
623 (("test/py/bash_completion\\.bash")
625 ;; This test requires networking.
626 (("test/py/import-export_unittest\\.bash")
629 ;; Many of the Makefile targets reset PYTHONPATH before running
630 ;; the Python interpreter, which does not work very well for us.
631 (substitute* "Makefile"
633 (string-append "PYTHONPATH=" (getenv "PYTHONPATH") ":")))
635 (add-after 'build 'build-bash-completions
637 (let ((orig-pythonpath (getenv "PYTHONPATH")))
638 (setenv "PYTHONPATH" (string-append ".:" orig-pythonpath))
639 (invoke "./autotools/build-bash-completion")
640 (setenv "PYTHONPATH" orig-pythonpath)
642 (add-before 'check 'pre-check
643 (lambda* (#:key inputs #:allow-other-keys)
644 ;; Set TZDIR so that time zones are found.
645 (setenv "TZDIR" (string-append (assoc-ref inputs "tzdata")
648 ;; This test checks whether PYTHONPATH is untouched, and extends
649 ;; it to include test directories if so. Add an else branch for
650 ;; our modified PYTHONPATH, in order to prevent a confusing test
651 ;; failure where expired certificates are not cleaned because
652 ;; check-cert-expired is silently crashing.
653 (substitute* "test/py/ganeti-cleaner_unittest.bash"
654 (("then export PYTHONPATH=(.*)" all testpath)
655 (string-append all "else export PYTHONPATH="
656 (getenv "PYTHONPATH") ":" testpath "\n")))
658 (substitute* "test/py/ganeti.utils.process_unittest.py"
659 ;; This test attempts to run an executable with
660 ;; RunCmd(..., reset_env=True), which fails because the default
661 ;; PATH from Constants.hs does not exist in the build container.
662 ((".*def testResetEnv.*" all)
663 (string-append " @unittest.skipIf(True, "
664 "\"cannot reset env in the build container\")\n"
667 ;; XXX: Somehow this test fails in the build container, but
668 ;; works in 'guix environment -C', even without /bin/sh?
669 ((".*def testPidFile.*" all)
670 (string-append " @unittest.skipIf(True, "
671 "\"testPidFile fails in the build container\")\n"
674 ;; XXX: Why are these links not added automatically.
675 (with-directory-excursion "test/hs"
676 (for-each (lambda (file)
677 (symlink "../../src/htools" file))
678 '("hspace" "hscan" "hinfo" "hbal" "hroller"
679 "hcheck" "hail" "hsqueeze")))
681 (add-after 'install 'install-bash-completions
682 (lambda* (#:key outputs #:allow-other-keys)
683 (let* ((out (assoc-ref outputs "out"))
684 (compdir (string-append out "/etc/bash_completion.d")))
686 (copy-file "doc/examples/bash_completion"
687 (string-append compdir "/ganeti"))
688 ;; The one file contains completions for many different
689 ;; executables. Create symlinks for found completions.
690 (with-directory-excursion compdir
692 (lambda (prog) (symlink "ganeti" prog))
693 (call-with-input-file "ganeti"
695 (let loop ((line (read-line port))
697 (if (eof-object? line)
699 (if (string-prefix? "complete" line)
700 (loop (read-line port)
701 ;; Extract "prog" from lines of the form:
702 ;; "complete -F _prog -o filenames prog".
703 ;; Note that 'burnin' is listed with the
704 ;; absolute file name, which is why we
705 ;; run everything through 'basename'.
706 (cons (basename (car (reverse (string-split
709 (loop (read-line port) progs))))))))
711 ;; Wrap all executables with PYTHONPATH. We can't borrow the phase
712 ;; from python-build-system because we also need to wrap the scripts
713 ;; in $out/lib/ganeti such as "node-daemon-setup".
714 (add-after 'install 'wrap
715 (lambda* (#:key inputs outputs #:allow-other-keys)
716 (let* ((out (assoc-ref outputs "out"))
717 (sbin (string-append out "/sbin"))
718 (lib (string-append out "/lib"))
719 (python (assoc-ref inputs "python"))
720 (major+minor (python-version python))
721 (PYTHONPATH (string-append lib "/python" major+minor
723 (getenv "PYTHONPATH"))))
724 (define (shell-script? file)
725 (call-with-ascii-input-file file
727 (let ((shebang (false-if-exception (read-line port))))
729 (string-prefix? "#!" shebang)
730 (or (string-contains shebang "/bin/bash")
731 (string-contains shebang "/bin/sh")))))))
734 ;; Do not wrap shell scripts because some are meant to be
735 ;; sourced, which breaks if they are wrapped. We do wrap
736 ;; the Haskell executables because some call out to Python
738 (and (executable-file? file)
739 (not (symbolic-link? file))
740 (not (shell-script? file))))
742 (for-each (lambda (file)
744 `("PYTHONPATH" ":" prefix (,PYTHONPATH))))
746 (append (find-files (string-append lib "/ganeti"))
751 ("cabal" ,cabal-install)
754 ;; These inputs are necessary to bootstrap the package, because we
755 ;; have patched the build system.
756 ("autoconf" ,autoconf)
757 ("automake" ,automake)
759 ;; For the documentation.
760 ("python-docutils" ,python-docutils)
761 ("sphinx" ,python-sphinx)
765 ;; Test dependencies.
766 ("fakeroot" ,fakeroot)
767 ("ghc-temporary" ,ghc-temporary)
768 ("ghc-test-framework" ,ghc-test-framework)
769 ("ghc-test-framework-hunit" ,ghc-test-framework-hunit)
770 ("ghc-test-framework-quickcheck2" ,ghc-test-framework-quickcheck2)
771 ("python-mock" ,python-mock)
772 ("python-pyyaml" ,python-pyyaml)
775 ("shelltestrunner" ,shelltestrunner)
776 ("tzdata" ,tzdata-for-tests)))
778 `(("arping" ,iputils) ;must be the iputils version
781 ("iproute2" ,iproute)
784 ("qemu" ,qemu-minimal) ;for qemu-img
785 ("ghc-attoparsec" ,ghc-attoparsec)
786 ("ghc-base64-bytestring" ,ghc-base64-bytestring)
787 ("ghc-cryptonite" ,ghc-cryptonite)
788 ("ghc-curl" ,ghc-curl)
789 ("ghc-hinotify" ,ghc-hinotify)
790 ("ghc-hslogger" ,ghc-hslogger)
791 ("ghc-json" ,ghc-json)
792 ("ghc-lens" ,ghc-lens)
793 ("ghc-lifted-base" ,ghc-lifted-base)
794 ("ghc-network" ,ghc-network)
795 ("ghc-old-time" ,ghc-old-time)
796 ("ghc-psqueue" ,ghc-psqueue)
797 ("ghc-regex-pcre" ,ghc-regex-pcre)
798 ("ghc-utf8-string" ,ghc-utf8-string)
799 ("ghc-zlib" ,ghc-zlib)
801 ;; For the optional metadata daemon.
802 ("ghc-snap-core" ,ghc-snap-core)
803 ("ghc-snap-server" ,ghc-snap-server)
806 ("python-pyopenssl" ,python-pyopenssl)
807 ("python-simplejson" ,python-simplejson)
808 ("python-pyparsing" ,python-pyparsing)
809 ("python-pyinotify" ,python-pyinotify)
810 ("python-pycurl" ,python-pycurl)
811 ("python-bitarray" ,python-bitarray)
812 ("python-paramiko" ,python-paramiko)
813 ("python-psutil" ,python-psutil)))
814 (home-page "https://www.ganeti.org/")
815 (synopsis "Cluster-based virtual machine management system")
817 "Ganeti is a virtual machine management tool built on top of existing
818 virtualization technologies such as Xen or KVM. Ganeti controls:
821 @item Disk creation management;
822 @item Operating system installation for instances (in co-operation with
823 OS-specific install scripts); and
824 @item Startup, shutdown, and failover between physical systems.
827 Ganeti is designed to facilitate cluster management of virtual servers and
828 to provide fast and simple recovery after physical failures, using
829 commodity hardware.")
830 (license license:bsd-2)))
832 (define-public ganeti-instance-guix
834 (name "ganeti-instance-guix")
836 (home-page "https://github.com/mbakke/ganeti-instance-guix")
839 (uri (git-reference (url home-page) (commit version)))
840 (file-name (git-file-name name version))
843 "0aa08irpcpns6mhjgsplc5f0p8ab1qcr9ah1gj5z66kxgqyflzrp"))))
844 (build-system gnu-build-system)
846 '(#:configure-flags '("--sysconfdir=/etc" "--localstatedir=/var")))
848 `(("autoconf" ,autoconf)
849 ("automake" ,automake)))
851 `(("util-linux" ,util-linux)
852 ("qemu-img" ,qemu-minimal)))
853 (synopsis "Guix OS integration for Ganeti")
855 "This package provides a guest OS definition for Ganeti that uses
856 Guix to build virtual machines.")
857 (license license:gpl3+)))
859 (define-public ganeti-instance-debootstrap
861 (name "ganeti-instance-debootstrap")
862 ;; We need two commits on top of the latest release for compatibility
863 ;; with newer sfdisk, as well as gnt-network integration.
864 (version "0.16-2-ge145396")
865 (home-page "https://github.com/ganeti/instance-debootstrap")
868 (uri (git-reference (url home-page) (commit version)))
869 (file-name (git-file-name name version))
872 "0f2isw9d8lawzj21rrq1q9xhq8xfa65rqbhqmrn59z201x9q1336"))))
873 (build-system gnu-build-system)
875 '(#:configure-flags '("--sysconfdir=/etc" "--localstatedir=/var")
876 #:phases (modify-phases %standard-phases
877 (add-after 'unpack 'add-absolute-references
879 (substitute* "common.sh.in"
880 (("/sbin/blkid") (which "blkid"))
882 (string-append (which "kpartx") " -")))
883 (substitute* "import"
885 (string-append (which "restore") " -r")))
886 (substitute* "export"
888 (string-append (which "dump") " -0")))
889 (substitute* "create"
890 (("debootstrap") (which "debootstrap"))
891 (("`which run-parts`") (which "run-parts"))
892 ;; Here we actually need to hard code /bin/passwd
893 ;; because it's called via chroot, which fails if
894 ;; "/bin" is not in PATH.
895 (("passwd") "/bin/passwd"))
897 (add-after 'unpack 'set-dpkg-arch
898 (lambda* (#:key system #:allow-other-keys)
899 ;; The create script passes --arch to debootstrap,
900 ;; and defaults to `dpkg --print-architecture` when
901 ;; ARCH is not set in variant.conf. Hard code the
902 ;; build-time architecture to avoid the dpkg dependency.
904 (cond ((string-prefix? "x86_64" system)
906 ((string-prefix? "i686" system)
908 ((string-prefix? "aarch64" system)
910 (else (car (string-split system #\-))))))
911 (substitute* "create"
912 (("`dpkg --print-architecture`")
915 (add-after 'configure 'adjust-Makefile
917 ;; Do not attempt to create /etc/ganeti/instance-debootstrap
918 ;; and /etc/default/ganeti-instance-debootstrap during install.
919 ;; They are created by the Ganeti service.
920 (substitute* "Makefile"
921 (("\\$\\(variantsdir\\)")
922 "$(prefix)/etc/ganeti/instance-debootstrap/variants")
923 (("\\$\\(defaultsdir\\)")
924 "$(prefix)/etc/default/ganeti-instance-debootstrap"))
926 (add-after 'install 'make-variants.list-symlink
927 (lambda* (#:key outputs #:allow-other-keys)
928 ;; The Ganeti OS API mandates a variants.list file that
929 ;; describes all supported "variants" of this OS.
930 ;; Guix generates this file, so make the original file
932 (with-directory-excursion (string-append
933 (assoc-ref outputs "out")
934 "/share/ganeti/os/debootstrap")
935 (delete-file "variants.list")
936 (symlink "/etc/ganeti/instance-debootstrap/variants/variants.list"
940 `(("autoconf" ,autoconf)
941 ("automake" ,automake)))
943 `(("debianutils" ,debianutils)
944 ("debootstrap" ,debootstrap)
946 ("kpartx" ,multipath-tools)
947 ("util-linux" ,util-linux)))
948 (synopsis "Debian OS integration for Ganeti")
950 "This package provides a guest OS definition for Ganeti. It installs
951 Debian or a derivative using @command{debootstrap}.")
952 (license license:gpl2+)))
954 (define-public libosinfo
961 (uri (string-append "https://releases.pagure.org/libosinfo/libosinfo-"
965 "1s97sv24bybggjx6hgqba2qdqz3ivfpd4cmkh4zm5y59sim109mv"))))
966 (build-system meson-build-system)
969 (list (string-append "-Dwith-usb-ids-path="
970 (assoc-ref %build-inputs "usb.ids"))
971 (string-append "-Dwith-pci-ids-path="
972 (assoc-ref %build-inputs "pci.ids")))
974 (modify-phases %standard-phases
975 (add-after 'unpack 'patch-osinfo-path
976 (lambda* (#:key inputs #:allow-other-keys)
977 (substitute* "osinfo/osinfo_loader.c"
978 (("path = DATA_DIR.*")
979 (string-append "path = \"" (assoc-ref inputs "osinfo-db")
980 "/share/osinfo\";")))
983 `(("libsoup" ,libsoup)
986 ("osinfo-db" ,osinfo-db)))
988 `(("glib" ,glib "bin") ; glib-mkenums, etc.
989 ("gobject-introspection" ,gobject-introspection)
990 ("gtk-doc" ,gtk-doc/stable)
992 ("intltool" ,intltool)
993 ("pkg-config" ,pkg-config)
997 (uri "https://github.com/pciutils/pciids/raw/ad02084f0bc143e3c15e31a6152a3dfb1d7a3156/pci.ids")
1000 "0kfhpj5rnh24hz2714qhfmxk281vwc2w50sm73ggw5d15af7zfsw"))))
1004 (uri "https://svn.code.sf.net/p/linux-usb/repo/trunk/htdocs/usb.ids?r=2681")
1005 (file-name "usb.ids")
1008 "1m6yhvz5k8aqzxgk7xj3jkk8frl1hbv0h3vgj4wbnvnx79qnvz3r"))))))
1009 (home-page "https://libosinfo.org/")
1010 (synopsis "Operating system information database")
1011 (description "libosinfo is a GObject based library API for managing
1012 information about operating systems, hypervisors and the (virtual) hardware
1013 devices they can support. It includes a database containing device metadata
1014 and provides APIs to match/identify optimal devices for deploying an operating
1015 system on a hypervisor. Via GObject Introspection, the API is available in
1016 all common programming languages. Vala bindings are also provided.")
1017 ;; The library files are released under LGPLv2.1 or later; the source
1018 ;; files in the "tools" directory are released under GPLv2+.
1019 (license (list license:lgpl2.1+ license:gpl2+))))
1028 "https://linuxcontainers.org/downloads/lxc/lxc-"
1032 "0qz4l7mlhq7hx53q606qgvkyzyr01glsw290v8ppzvxn1fydlrci"))))
1033 (build-system gnu-build-system)
1035 `(("pkg-config" ,pkg-config)))
1037 `(("gnutls" ,gnutls)
1039 ("libseccomp" ,libseccomp)
1040 ("libselinux" ,libselinux)))
1043 (list (string-append "--docdir=" (assoc-ref %outputs "out")
1044 "/share/doc/" ,name "-" ,version)
1046 "--localstatedir=/var")
1048 (modify-phases %standard-phases
1050 (lambda* (#:key outputs #:allow-other-keys)
1051 (let* ((out (assoc-ref outputs "out"))
1052 (bashcompdir (string-append out "/etc/bash_completion.d")))
1053 (invoke "make" "install"
1054 (string-append "bashcompdir=" bashcompdir)
1055 ;; Don't install files into /var and /etc.
1056 "LXCPATH=/tmp/var/lib/lxc"
1057 "localstatedir=/tmp/var"
1058 "sysconfdir=/tmp/etc"
1059 "sysconfigdir=/tmp/etc/default")))))))
1060 (synopsis "Linux container tools")
1061 (home-page "https://linuxcontainers.org/")
1063 "LXC is a userspace interface for the Linux kernel containment features.
1064 Through a powerful API and simple tools, it lets Linux users easily create and
1065 manage system or application containers.")
1066 (license license:lgpl2.1+)))
1068 (define-public libvirt
1075 (uri (string-append "https://libvirt.org/sources/libvirt-"
1078 (base32 "1l6i1rz1v9rnp61sgzlrlbsfh03208dbm3b259i0jl5sqz85kx01"))
1079 (patches (search-patches "libvirt-add-install-prefix.patch"))))
1080 (build-system meson-build-system)
1083 (list "-Ddriver_qemu=enabled"
1084 "-Dqemu_user=nobody"
1086 "-Dstorage_disk=enabled"
1087 "-Dstorage_dir=enabled"
1089 "-Dnls=enabled" ;translations
1090 (string-append "-Ddocdir=" (assoc-ref %outputs "out") "/share/doc/"
1092 "-Dbash_completion=enabled"
1093 (string-append "-Dinstall_prefix=" (assoc-ref %outputs "out"))
1095 "--localstatedir=/var")
1098 (modify-phases %standard-phases
1099 (add-before 'configure 'disable-broken-tests
1101 (let ((tests (list "commandtest" ; hangs idly
1102 "qemuxml2argvtest" ; fails
1103 "virnetsockettest"))) ; tries to network
1104 (substitute* "tests/meson.build"
1105 (((format #f ".*'name': '(~a)'.*" (string-join tests "|")))
1108 (add-before 'install 'no-polkit-magic
1109 ;; Meson ‘magically’ invokes pkexec, which fails (not setuid).
1111 (setenv "PKEXEC_UID" "something")
1114 `(("libxml2" ,libxml2)
1116 ("libpciaccess" ,libpciaccess)
1119 ("libpcap" ,libpcap)
1121 ("libssh2" ,libssh2) ;optional
1122 ("libtirpc" ,libtirpc) ;for <rpc/rpc.h>
1123 ("libuuid" ,util-linux "lib")
1124 ("lvm2" ,lvm2) ;for libdevmapper
1126 ("openssl" ,openssl)
1127 ("readline" ,readline)
1128 ("cyrus-sasl" ,cyrus-sasl)
1129 ("libyajl" ,libyajl)
1131 ("dmidecode" ,dmidecode)
1132 ("dnsmasq" ,dnsmasq)
1133 ("ebtables" ,ebtables)
1135 ("iproute" ,iproute)
1136 ("iptables" ,iptables)))
1138 `(("bash-completion" ,bash-completion)
1139 ("gettext" ,gettext-minimal)
1140 ("xsltproc" ,libxslt)
1142 ("pkg-config" ,pkg-config)
1144 ("python" ,python-wrapper)
1145 ("python-docutils" ,python-docutils) ;for rst2html
1146 ("rpcsvc-proto" ,rpcsvc-proto))) ;for rpcgen
1147 (home-page "https://libvirt.org")
1148 (synopsis "Simple API for virtualization")
1149 (description "Libvirt is a C toolkit to interact with the virtualization
1150 capabilities of recent versions of Linux. The library aims at providing long
1151 term stable C API initially for the Xen paravirtualization but should be able
1152 to integrate other virtualization mechanisms if needed.")
1153 (license license:lgpl2.1+)))
1155 (define-public libvirt-glib
1157 (name "libvirt-glib")
1161 (uri (string-append "ftp://libvirt.org/libvirt/glib/"
1162 "libvirt-glib-" version ".tar.xz"))
1165 "1gdcvqz88qkp402zra9csc6391f2xki1270x683n6ixakl3gf8w4"))))
1166 (build-system meson-build-system)
1168 `(("openssl" ,openssl)
1169 ("cyrus-sasl" ,cyrus-sasl)
1170 ("lvm2" ,lvm2) ; for libdevmapper
1171 ("libyajl" ,libyajl)))
1173 `(("pkg-config" ,pkg-config)
1174 ("intltool" ,intltool)
1175 ("glib" ,glib "bin")
1178 ;; ‘Required:’ by the installed .pc files.
1180 ("libvirt" ,libvirt)
1181 ("libxml2" ,libxml2)
1182 ("gobject-introspection" ,gobject-introspection)))
1183 (home-page "https://libvirt.org")
1184 (synopsis "GLib wrapper around libvirt")
1185 (description "libvirt-glib wraps the libvirt library to provide a
1186 high-level object-oriented API better suited for glib-based applications, via
1190 @item libvirt-glib - GLib main loop integration & misc helper APIs
1191 @item libvirt-gconfig - GObjects for manipulating libvirt XML documents
1192 @item libvirt-gobject - GObjects for managing libvirt objects
1195 (license license:lgpl2.1+)))
1197 (define-public python-libvirt
1199 (name "python-libvirt")
1204 (uri (string-append "https://libvirt.org/sources/python/libvirt-python-"
1207 (base32 "1ryfimhf47s9k4n0gys233bh15l68fccs2bvj8bjwqjm9k2vmhy0"))))
1208 (build-system python-build-system)
1211 (modify-phases %standard-phases
1212 (add-after 'unpack 'patch-nosetests-path
1213 (lambda* (#:key inputs #:allow-other-keys)
1214 (substitute* "setup.py"
1215 (("\"/usr/bin/nosetests\"")
1216 (string-append "\"" (which "nosetests") "\""))
1217 (("self\\.spawn\\(\\[sys\\.executable, nose\\]\\)")
1218 (format #f "self.spawn([\"~a\", nose])" (which "bash"))))
1221 `(("libvirt" ,libvirt)))
1223 `(("python-lxml" ,python-lxml)))
1225 `(("pkg-config" ,pkg-config)
1226 ("python-nose" ,python-nose)))
1227 (home-page "https://libvirt.org")
1228 (synopsis "Python bindings to libvirt")
1229 (description "This package provides Python bindings to the libvirt
1230 virtualization library.")
1231 (license license:lgpl2.1+)))
1233 (define-public python2-libvirt
1234 (package-with-python2 python-libvirt))
1236 (define-public virt-manager
1238 (name "virt-manager")
1242 (uri (string-append "https://virt-manager.org/download/sources"
1243 "/virt-manager/virt-manager-"
1247 "11kvpzcmyir91qz0dsnk7748jbb4wr8mrc744w117qc91pcy6vrb"))))
1248 (build-system python-build-system)
1250 `(#:use-setuptools? #f ; uses custom distutils 'install' command
1251 #:tests? #f ; TODO The tests currently fail
1252 ; RuntimeError: Loop condition wasn't
1254 #:imported-modules ((guix build glib-or-gtk-build-system)
1255 ,@%python-build-system-modules)
1256 #:modules ((ice-9 match)
1258 (guix build python-build-system)
1259 ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
1262 (modify-phases %standard-phases
1263 (add-after 'unpack 'fix-setup
1264 (lambda* (#:key outputs #:allow-other-keys)
1265 (substitute* "virtinst/buildconfig.py"
1266 (("/usr") (assoc-ref outputs "out")))
1268 (add-after 'unpack 'fix-default-uri
1269 (lambda* (#:key inputs #:allow-other-keys)
1270 ;; Xen is not available for now - so only patch qemu.
1271 (substitute* "virtManager/createconn.py"
1272 (("/usr(/bin/qemu-system)" _ suffix)
1273 (string-append (assoc-ref inputs "qemu") suffix)))
1275 (add-before 'wrap 'wrap-with-GI_TYPELIB_PATH
1276 (lambda* (#:key inputs outputs #:allow-other-keys)
1277 (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
1278 (bin-files (find-files bin ".*"))
1279 (paths (map (match-lambda
1280 ((output . directory)
1281 (let* ((girepodir (string-append
1283 "/lib/girepository-1.0")))
1284 (if (file-exists? girepodir)
1287 (for-each (lambda (file)
1288 (format #t "wrapping ~a\n" file)
1290 `("GI_TYPELIB_PATH" ":" prefix
1291 ,(filter identity paths))))
1295 (lambda* (#:key tests? #:allow-other-keys)
1297 (setenv "HOME" "/tmp")
1298 (setenv "XDG_CACHE_HOME" "/tmp")
1299 (system "Xvfb :1 &")
1300 (setenv "DISPLAY" ":1")
1301 ;; Dogtail requires that Assistive Technology support be enabled
1302 (setenv "GTK_MODULES" "gail:atk-bridge")
1303 (invoke "dbus-run-session" "--" "pytest" "--uitests"))
1305 (add-after 'install 'glib-or-gtk-compile-schemas
1306 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
1307 (add-after 'install 'glib-or-gtk-wrap
1308 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
1312 ("gtk-vnc" ,gtk-vnc)
1313 ("gtksourceview" ,gtksourceview)
1314 ("libvirt" ,libvirt)
1315 ("libvirt-glib" ,libvirt-glib)
1316 ("libosinfo" ,libosinfo)
1318 ("python-libvirt" ,python-libvirt)
1319 ("python-requests" ,python-requests)
1320 ("python-pycairo" ,python-pycairo)
1321 ("python-pygobject" ,python-pygobject)
1322 ("python-libxml2" ,python-libxml2)
1323 ("spice-gtk" ,spice-gtk)))
1324 ;; virt-manager searches for qemu-img or kvm-img in the PATH.
1328 `(("glib" ,glib "bin") ; glib-compile-schemas
1329 ("gobject-introspection" ,gobject-introspection)
1330 ("gtk+" ,gtk+ "bin") ; gtk-update-icon-cache
1331 ("perl" ,perl) ; pod2man
1332 ("intltool" ,intltool)
1333 ("rst2man" ,python-docutils)
1334 ;; The following are required for running the tests
1335 ;; ("python-pytest" ,python-pytest)
1336 ;; ("python-dogtail" ,python-dogtail)
1337 ;; ("xvfb" ,xorg-server-for-tests)
1339 ;; ("at-spi2-core" ,at-spi2-core)
1340 ;; ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
1342 (home-page "https://virt-manager.org/")
1343 (synopsis "Manage virtual machines")
1345 "The virt-manager application is a desktop user interface for managing
1346 virtual machines through libvirt. It primarily targets KVM VMs, but also
1347 manages Xen and LXC (Linux containers). It presents a summary view of running
1348 domains, their live performance and resource utilization statistics.")
1349 (license license:gpl2+)))
1357 (uri (string-append "https://download.openvz.org/criu/criu-"
1358 version ".tar.bz2"))
1361 "09d0j24x0cyc7wkgi7cnxqgfjk7kbdlm79zxpj8d356sa3rw2z24"))))
1362 (build-system gnu-build-system)
1364 `(#:test-target "test"
1365 #:tests? #f ; tests require mounting as root
1367 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1368 (string-append "LIBDIR=" (assoc-ref %outputs "out")
1370 (string-append "ASCIIDOC=" (assoc-ref %build-inputs "asciidoc")
1372 (string-append "XMLTO=" (assoc-ref %build-inputs "xmlto")
1375 (modify-phases %standard-phases
1377 (lambda* (#:key inputs #:allow-other-keys)
1378 ;; The includes for libnl are located in a sub-directory.
1379 (setenv "C_INCLUDE_PATH"
1380 (string-append (assoc-ref inputs "libnl")
1382 (or (getenv "C_INCLUDE_PATH") "")))
1384 (add-after 'configure 'fix-documentation
1385 (lambda* (#:key inputs outputs #:allow-other-keys)
1386 (substitute* "Documentation/Makefile"
1389 "-m custom.xsl --skip-validation -x "
1390 (assoc-ref inputs "docbook-xsl") "/xml/xsl/"
1391 ,(package-name docbook-xsl) "-"
1392 ,(package-version docbook-xsl)
1393 "/manpages/docbook.xsl")))
1395 (add-after 'unpack 'hardcode-variables
1396 (lambda* (#:key inputs #:allow-other-keys)
1397 ;; Hardcode arm version detection
1398 (substitute* "Makefile"
1399 (("ARMV.*:=.*") "ARMV := 7\n"))
1400 ;; We are currently using python-2
1401 (substitute* "crit/Makefile"
1402 (("\\$\\(PYTHON\\)") "python2"))
1403 (substitute* "lib/Makefile"
1404 (("\\$\\(PYTHON\\)")
1405 (string-append (assoc-ref inputs "python")
1408 (add-before 'build 'fix-symlink
1409 (lambda* (#:key inputs #:allow-other-keys)
1410 ;; The file 'images/google/protobuf/descriptor.proto' points to
1411 ;; /usr/include/..., which obviously does not exist.
1412 (let* ((file "google/protobuf/descriptor.proto")
1413 (target (string-append "images/" file))
1414 (source (string-append (assoc-ref inputs "protobuf")
1416 (delete-file target)
1417 (symlink source target)
1419 (add-after 'install 'wrap
1420 (lambda* (#:key inputs outputs #:allow-other-keys)
1421 ;; Make sure 'crit' runs with the correct PYTHONPATH.
1422 (let* ((out (assoc-ref outputs "out"))
1423 (path (string-append out
1425 (string-take (string-take-right
1426 (assoc-ref inputs "python") 5) 3)
1428 (getenv "PYTHONPATH"))))
1429 (wrap-program (string-append out "/bin/crit")
1430 `("PYTHONPATH" ":" prefix (,path))))
1433 `(("protobuf" ,protobuf)
1434 ("python" ,python-2)
1435 ("python2-protobuf" ,python2-protobuf)
1436 ("python2-ipaddr" ,python2-ipaddr)
1437 ("iproute" ,iproute)
1443 ("nftables" ,nftables)))
1445 `(("pkg-config" ,pkg-config)
1447 ("protobuf-c" ,protobuf-c)
1448 ("asciidoc" ,asciidoc)
1450 ("docbook-xml" ,docbook-xml)
1451 ("docbook-xsl" ,docbook-xsl)))
1452 (home-page "https://criu.org")
1453 (synopsis "Checkpoint and restore in user space")
1454 (description "Using this tool, you can freeze a running application (or
1455 part of it) and checkpoint it to a hard drive as a collection of files. You
1456 can then use the files to restore and run the application from the point it
1457 was frozen at. The distinctive feature of the CRIU project is that it is
1458 mainly implemented in user space.")
1459 ;; The project is licensed under GPLv2; files in the lib/ directory are
1461 (license (list license:gpl2 license:lgpl2.1))))
1463 (define-public qmpbackup
1470 (url "https://github.com/abbbi/qmpbackup")
1472 (file-name (git-file-name name version))
1475 "0swhp5byz44brhyis1a39p11fyn9q84xz5q6v2fah29r7d71kmmx"))))
1476 (build-system python-build-system)
1478 `(#:python ,python-2))
1479 (home-page "https://github.com/abbbi/qmpbackup")
1480 (synopsis "Backup and restore QEMU machines")
1481 (description "qmpbackup is designed to create and restore full and
1482 incremental backups of running QEMU virtual machines via QMP, the QEMU
1484 (license license:gpl3+)))
1486 (define-public looking-glass-client
1487 (let ((commit "182c4752d57690da7f99d5e788de9b8baea33895"))
1489 (name "looking-glass-client")
1490 (version (string-append "a12-" (string-take commit 7)))
1494 (uri (git-reference (url "https://github.com/gnif/LookingGlass")
1496 (file-name (git-file-name name version))
1499 "02bq46ndmzq9cihazzn7xq1x7q5nzm7iw4l9lqzihxcxp9famkhw"))
1500 (modules '((guix build utils)))
1503 ;; Do not create binaries optimized for the CPU of the build machine,
1504 ;; for reproducibility and compatibility. TODO: in the next version
1505 ;; of looking glass, this is exposed as a CMake configure option.
1506 (substitute* "client/CMakeLists.txt"
1510 (build-system cmake-build-system)
1511 (inputs `(("fontconfig" ,fontconfig)
1514 ("openssl" ,openssl)
1516 ("sdl2-ttf" ,sdl2-ttf)
1517 ("spice-protocol" ,spice-protocol)
1518 ("wayland" ,wayland)))
1519 (native-inputs `(("libconfig" ,libconfig)
1521 ("pkg-config" ,pkg-config)))
1523 `(#:tests? #f ;; No tests are available.
1524 #:make-flags '("CC=gcc")
1525 #:phases (modify-phases %standard-phases
1526 (add-before 'configure 'chdir-to-client
1527 (lambda* (#:key outputs #:allow-other-keys)
1530 (add-after 'chdir-to-client 'add-missing-include
1532 ;; Mimic upstream commit b9797529893, required since the
1533 ;; update to Mesa 19.2.
1534 (substitute* "renderers/egl/shader.h"
1535 (("#include <stdbool\\.h>")
1536 "#include <stdbool.h>\n#include <stddef.h>"))
1539 (lambda* (#:key outputs #:allow-other-keys)
1540 (install-file "looking-glass-client"
1541 (string-append (assoc-ref outputs "out")
1544 (home-page "https://looking-glass.hostfission.com")
1545 (synopsis "KVM Frame Relay (KVMFR) implementation")
1546 (description "Looking Glass allows the use of a KVM (Kernel-based Virtual
1547 Machine) configured for VGA PCI Pass-through without an attached physical
1548 monitor, keyboard or mouse. It displays the VM's rendered contents on your main
1550 ;; This package requires SSE instructions.
1551 (supported-systems '("i686-linux" "x86_64-linux"))
1552 (license license:gpl2+))))
1557 (version "1.0.0-rc93")
1561 "https://github.com/opencontainers/runc/releases/"
1562 "download/v" version "/runc.tar.xz"))
1563 (file-name (string-append name "-" version ".tar.xz"))
1566 "0b90r1bkvlqli53ca1yc1l488dba0isd3i6l7nlhszxi8p7hzvkh"))))
1567 (build-system go-build-system)
1569 '(#:import-path "github.com/opencontainers/runc"
1570 #:install-source? #f
1571 ;; XXX: 20/139 tests fail due to missing /var, cgroups and apparmor in
1572 ;; the build environment.
1575 (modify-phases %standard-phases
1577 (lambda* (#:key import-path #:allow-other-keys)
1578 (with-directory-excursion (string-append "src/" import-path)
1579 (invoke "make" "all" "man"))))
1581 (lambda* (#:key tests? #:allow-other-keys)
1583 (invoke "make" "localunittest"))))
1585 (lambda* (#:key import-path outputs #:allow-other-keys)
1586 (with-directory-excursion (string-append "src/" import-path)
1587 (let ((out (assoc-ref outputs "out")))
1588 (invoke "make" "install" "install-bash" "install-man"
1589 (string-append "PREFIX=" out)))))))))
1591 `(("go-md2man" ,go-github-com-go-md2man)
1592 ("pkg-config" ,pkg-config)))
1594 `(("libseccomp" ,libseccomp)))
1595 (synopsis "Open container initiative runtime")
1596 (home-page "https://opencontainers.org/")
1598 "@command{runc} is a command line client for running applications
1599 packaged according to the
1600 @uref{https://github.com/opencontainers/runtime-spec/blob/master/spec.md, Open
1601 Container Initiative (OCI) format} and is a compliant implementation of the
1602 Open Container Initiative specification.")
1603 (license license:asl2.0)))
1605 (define-public umoci
1613 "https://github.com/opencontainers/umoci/releases/download/v"
1614 version "/umoci.tar.xz"))
1615 (file-name (string-append "umoci-" version ".tar.xz"))
1617 (base32 "0fvljj9k4f83wbqzd8nbijz0p1zaq633f8yxyvl5sy3wjf03ffk9"))))
1618 (build-system go-build-system)
1620 '(#:import-path "github.com/opencontainers/umoci"
1621 #:install-source? #f
1623 (modify-phases %standard-phases
1625 (lambda* (#:key source import-path #:allow-other-keys)
1626 ;; Unpack the tarball into 'umoci' instead of "runc-${version}".
1627 (let ((dest (string-append "src/" import-path)))
1629 (invoke "tar" "-C" (string-append "src/" import-path)
1630 "--strip-components=1"
1633 (lambda* (#:key import-path #:allow-other-keys)
1634 (with-directory-excursion (string-append "src/" import-path)
1635 ;; TODO: build manpages with 'go-md2man'.
1636 (invoke "make" "SHELL=bash"))))
1638 (lambda* (#:key import-path outputs #:allow-other-keys)
1639 (let* ((out (assoc-ref outputs "out"))
1640 (bindir (string-append out "/bin")))
1641 (install-file (string-append "src/" import-path "/umoci")
1644 (home-page "https://umo.ci/")
1645 (synopsis "Tool for modifying Open Container images")
1647 "@command{umoci} is a tool that allows for high-level modification of an
1648 Open Container Initiative (OCI) image layout and its tagged images.")
1649 (license license:asl2.0)))
1651 (define-public skopeo
1658 (url "https://github.com/containers/skopeo")
1659 (commit (string-append "v" version))))
1660 (file-name (git-file-name name version))
1663 "0n22sdif437ddg5ch0ipwim3fg0n6ihc9bfi52qkhy3r1grz04hs"))))
1664 (build-system go-build-system)
1666 `(("pkg-config" ,pkg-config)
1667 ("go-github-com-go-md2man" ,go-github-com-go-md2man)))
1669 `(("btrfs-progs" ,btrfs-progs)
1671 ("libassuan" ,libassuan)
1672 ("libselinux" ,libselinux)
1673 ("libostree" ,libostree)
1678 '(#:import-path "github.com/containers/skopeo"
1679 #:install-source? #f
1680 #:tests? #f ; The tests require Docker
1682 (modify-phases %standard-phases
1684 (lambda* (#:key import-path #:allow-other-keys)
1685 (with-directory-excursion (string-append "src/" import-path)
1686 (invoke "make" "bin/skopeo"))))
1687 (add-after 'build 'build-docs
1688 (lambda* (#:key import-path #:allow-other-keys)
1689 (with-directory-excursion (string-append "src/" import-path)
1690 (invoke "make" "docs"))))
1692 (lambda* (#:key import-path outputs #:allow-other-keys)
1693 (with-directory-excursion (string-append "src/" import-path)
1694 (let ((out (assoc-ref outputs "out")))
1695 (install-file "default-policy.json"
1696 (string-append out "/etc/containers"))
1697 (invoke "make" "install-binary" "install-completions" "install-docs"
1698 (string-append "PREFIX=" out)))))))))
1699 (home-page "https://github.com/containers/skopeo")
1700 (synopsis "Interact with container images and container image registries")
1702 "@command{skopeo} is a command line utility providing various operations
1703 with container images and container image registries. It can:
1706 @item Copy container images between various containers image stores,
1707 converting them as necessary.
1709 @item Convert a Docker schema 2 or schema 1 container image to an OCI image.
1711 @item Inspect a repository on a container registry without needlessly pulling
1714 @item Sign and verify container images.
1716 @item Delete container images from a remote container registry.
1719 (license license:asl2.0)))
1721 (define-public python-vagrant
1723 (name "python-vagrant")
1728 (uri (pypi-uri "python-vagrant" version))
1731 "1ikrh6canhcxg5y7pzmkcnnydikppv7s6sm9prfx90nk0ac8m6mg"))))
1732 (build-system python-build-system)
1734 '(#:tests? #f)) ; tests involve running vagrant.
1735 (home-page "https://github.com/todddeluca/python-vagrant")
1736 (synopsis "Python bindings for Vagrant")
1738 "Python-vagrant is a Python module that provides a thin wrapper around the
1739 @code{vagrant} command line executable, allowing programmatic control of Vagrant
1741 (license license:expat)))
1743 (define-public bubblewrap
1749 (uri (string-append "https://github.com/containers/bubblewrap/"
1750 "releases/download/v" version "/bubblewrap-"
1754 "00ycgi6q2yngh06bnz50wkvar6r2jnjf3j158grhi9k13jdrpimr"))))
1755 (build-system gnu-build-system)
1758 (modify-phases %standard-phases
1759 (add-after 'unpack 'fix-test
1760 (lambda* (#:key outputs #:allow-other-keys)
1761 ;; Tests try to access /var/tmp, which is not possible in our build
1762 ;; environment. Let's give them another directory.
1763 ;; /tmp gets overriden in some tests, so we need another directory.
1764 ;; the only possibility is the output directory.
1765 (let ((tmp-dir (string-append (assoc-ref outputs "out") "/tmp")))
1767 (substitute* "tests/test-run.sh"
1768 (("/var/tmp") tmp-dir)
1769 ;; Tests create a temporary python script, so fix its shebang.
1770 (("/usr/bin/env python") (which "python"))
1771 ;; Some tests try to access /usr, but that doesn't exist.
1772 ;; Give them /gnu instead.
1774 (("--ro-bind /bin /bin") "--ro-bind /gnu /bin")
1775 (("--ro-bind /sbin /sbin") "--ro-bind /gnu /sbin")
1776 (("--ro-bind /lib /lib") "--ro-bind /gnu /lib")
1777 ((" */bin/bash") (which "bash"))
1778 (("/bin/sh") (which "sh"))
1779 (("findmnt") (which "findmnt"))))
1781 ;; Remove the directory we gave to tests to have a clean package.
1782 (add-after 'check 'remove-tmp-dir
1783 (lambda* (#:key outputs #:allow-other-keys)
1784 (delete-file-recursively (string-append (assoc-ref outputs "out") "/tmp"))
1787 `(("libcap" ,libcap)))
1789 `(("python" ,python-wrapper)
1790 ("util-linux" ,util-linux)))
1791 (home-page "https://github.com/containers/bubblewrap")
1792 (synopsis "Unprivileged sandboxing tool")
1793 (description "Bubblewrap is aimed at running applications in a sandbox,
1794 restricting their access to parts of the operating system or user data such as
1795 the home directory. Bubblewrap always creates a new mount namespace, and the
1796 user can specify exactly what parts of the file system should be made visible
1797 in the sandbox. These directories are mounted with the @code{nodev} option
1798 by default and can be made read-only.")
1799 (license license:lgpl2.0+)))
1801 (define-public bochs
1808 (uri (string-append "https://sourceforge.net/projects/bochs/files/bochs/"
1809 version "/bochs-" version ".tar.gz"))
1811 (base32 "0ql8q6y1k356li1g9gbvl21448mlxphxxi6kjb2b3pxvzd0pp2b3"))))
1812 (build-system gnu-build-system)
1814 `(#:tests? #f)) ; no tests exist
1816 `(("libxrandr" ,libxrandr)))
1817 (home-page "http://bochs.sourceforge.net/")
1818 (synopsis "Emulator for x86 PC")
1820 "Bochs is an emulator which can emulate Intel x86 CPU, common I/O
1821 devices, and a custom BIOS. It can also be compiled to emulate many different
1822 x86 CPUs, from early 386 to the most recent x86-64 Intel and AMD processors.
1823 Bochs can run most Operating Systems inside the emulation including Linux,
1824 DOS or Microsoft Windows.")
1825 (license license:lgpl2.0+)))
1834 (url "git://xenbits.xenproject.org/xen.git")
1835 (commit (string-append "RELEASE-" version))))
1836 (file-name (git-file-name name version))
1839 "1r90rvypw76ya9clqw5p02gm1k8hxz73f7gr95ca778nnzvb7xjw"))))
1840 (build-system gnu-build-system)
1843 (list "--enable-rpath"
1844 "--disable-qemu-traditional" ; It tries to do "git clone"
1845 "--disable-rombios" ; would try to "git clone" via etherboot.
1846 ;; TODO: Re-enable stubdom (it's "more secure" to use it).
1847 "--disable-stubdom" ; tries to "git clone" old patched newlib.
1848 (string-append "--with-initddir="
1849 (assoc-ref %outputs "out")
1851 (string-append "--with-system-qemu="
1852 (assoc-ref %build-inputs "qemu")
1853 "/bin/qemu-system-i386")
1854 (string-append "--with-system-seabios="
1855 (assoc-ref %build-inputs "seabios")
1856 "/share/firmware/bios.bin")
1857 (string-append "--with-system-ovmf="
1858 (assoc-ref %build-inputs "ovmf")
1859 "/share/firmware/ovmf_ia32.bin"))
1860 #:make-flags (list "-j" "1"
1861 "XEN_BUILD_DATE=Thu Jan 1 01:00:01 CET 1970"
1862 "XEN_BUILD_TIME=01:00:01"
1865 "SMBIOS_REL_DATE=01/01/1970"
1866 "VGABIOS_REL_DATE=01 Jan 1970"
1867 ; QEMU_TRADITIONAL_LOC
1869 "SYSCONFIG_DIR=/tmp/etc/default"
1870 (string-append "BASH_COMPLETION_DIR="
1871 (assoc-ref %outputs "out")
1872 "/etc/bash_completion.d")
1873 (string-append "BOOT_DIR="
1874 (assoc-ref %outputs "out")
1876 (string-append "DEBUG_DIR="
1877 (assoc-ref %outputs "out")
1879 (string-append "EFI_DIR="
1880 (assoc-ref %outputs "out")
1881 "/lib/efi") ; TODO lib64 ?
1882 "MINIOS_UPSTREAM_URL="
1883 ;(string-append "DISTDIR="
1884 ; (assoc-ref %outputs "out"))
1886 #:test-target "test"
1888 (modify-phases %standard-phases
1889 (add-after 'unpack 'unpack-mini-os
1890 (lambda* (#:key inputs #:allow-other-keys)
1891 (copy-recursively (assoc-ref inputs "mini-os") "extras/mini-os")
1893 (add-after 'unpack-mini-os 'patch
1894 (lambda* (#:key inputs outputs #:allow-other-keys)
1895 (substitute* "tools/firmware/Rules.mk"
1896 (("override XEN_TARGET_ARCH = x86_32")
1897 (string-append "override XEN_TARGET_ARCH = x86_32
1898 override CC = " (assoc-ref inputs "cross-gcc") "/bin/i686-linux-gnu-gcc"))
1900 (string-append "CFLAGS=-I" (assoc-ref inputs "cross-libc")
1902 (substitute* "config/x86_32.mk"
1903 (("CFLAGS += -m32 -march=i686")
1904 (string-append "CFLAGS += -march=i686 -I"
1905 (assoc-ref inputs "cross-libc")
1907 ;; /var is not in /gnu/store , so don't try to create it.
1908 (substitute* '("tools/Makefile"
1909 "tools/xenstore/Makefile"
1910 "tools/xenpaging/Makefile")
1911 (("\\$\\(INSTALL_DIR\\) .*XEN_(DUMP|LOG|RUN|LIB|PAGING)_DIR.*")
1913 (("\\$\\(INSTALL_DIR\\) .*XEN_(RUN|LIB)_STORED.*")
1915 ;; Prevent xen from creating /etc .
1916 (substitute* "tools/examples/Makefile"
1917 ((" install-readmes") "")
1918 ((" install-configs") ""))
1920 (substitute* "tools/pygrub/setup.py"
1922 ; TODO: extra_link_args = ['-Wl,-rpath=/opt/foo'],
1923 (string-append "runtime_library_dirs = ['"
1924 (assoc-ref outputs "out")
1925 "/lib'],\nlibrary_dirs =")))
1927 (add-before 'configure 'patch-xen-script-directory
1928 (lambda* (#:key outputs #:allow-other-keys)
1929 (substitute* '("configure"
1932 (("XEN_SCRIPT_DIR=.*")
1933 (string-append "XEN_SCRIPT_DIR="
1934 (assoc-ref outputs "out")
1935 "/etc/xen/scripts")))
1937 (add-before 'configure 'set-environment-up
1938 (lambda* (#:key make-flags #:allow-other-keys)
1940 (string-contains x "cross-i686-linux"))
1941 (define (filter-environment! filter-predicate
1942 environment-variable-names)
1945 (let* ((env-value (getenv env-name))
1946 (search-path (search-path-as-string->list env-value))
1947 (new-search-path (filter filter-predicate
1949 (new-env-value (list->search-path-as-string
1950 new-search-path ":")))
1951 (setenv env-name new-env-value)))
1952 environment-variable-names))
1953 (setenv "CROSS_C_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
1954 (setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
1955 (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
1956 (filter-environment! cross?
1957 '("CROSS_C_INCLUDE_PATH" "CROSS_CPLUS_INCLUDE_PATH"
1958 "CROSS_LIBRARY_PATH"))
1959 (filter-environment! (lambda (e) (not (cross? e)))
1960 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
1962 ;; Guix tries to be helpful and automatically adds
1963 ;; mini-os-git-checkout/include to the include path,
1964 ;; but actually we don't want it to be there (yet).
1965 (filter-environment! (lambda (e)
1968 "mini-os-git-checkout")))
1969 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
1971 (setenv "EFI_VENDOR" "guix")
1974 (lambda* (#:key make-flags #:allow-other-keys)
1975 (apply invoke "make" "world" make-flags))))))
1977 `(("acpica" ,acpica) ; TODO: patch iasl invocation.
1978 ("bridge-utils" ,bridge-utils) ; TODO: patch invocations.
1980 ("iproute" ,iproute) ; TODO: patch invocations.
1983 ("libyajl" ,libyajl)
1984 ("ncurses" ,ncurses)
1985 ("openssl" ,openssl)
1988 ("qemu" ,qemu-minimal)
1989 ("seabios" ,seabios)
1990 ("util-linux" ,util-linux "lib") ; uuid
1991 ; TODO: ocaml-findlib, ocaml-nox.
1992 ("xz" ,xz) ; for liblzma
1997 ("cmake" ,cmake-minimal)
2000 ("gettext" ,gettext-minimal)
2006 (url "http://xenbits.xen.org/git-http/mini-os.git")
2007 (commit (string-append "xen-RELEASE-" version))))
2010 "1i8pcl19n60i2m9vlg79q3nknpj209c9ic5x10wxaicx45kc107f"))
2011 (file-name "mini-os-git-checkout")))
2014 ("pkg-config" ,pkg-config)
2015 ("python" ,python-2)
2017 ("cross-gcc" ,(cross-gcc "i686-linux-gnu"
2018 #:xbinutils (cross-binutils "i686-linux-gnu")
2019 #:libc (cross-libc "i686-linux-gnu")))
2020 ("cross-libc" ,(cross-libc "i686-linux-gnu")) ; header files
2021 ("cross-libc-static" ,(cross-libc "i686-linux-gnu") "static")))
2022 (home-page "https://xenproject.org/")
2023 (synopsis "Xen Virtual Machine Monitor")
2024 (description "This package provides the Xen Virtual Machine Monitor
2025 which is a hypervisor.")
2026 ;; TODO: Some files are licensed differently. List those.
2027 (license license:gpl2)
2028 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))))
2030 (define-public osinfo-db-tools
2032 (name "osinfo-db-tools")
2036 (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-tools-"
2041 "038q3gzdbkfkhpicj0755mw1q4gbvn57pslpw8n2dp3lds9im0g9"))))
2042 (build-system meson-build-system)
2044 `(("libsoup" ,libsoup)
2045 ("libxml2" ,libxml2)
2046 ("libxslt" ,libxslt)
2047 ("json-glib" ,json-glib)
2048 ("libarchive" ,libarchive)))
2051 ("gobject-introspection" ,gobject-introspection)
2052 ("gettext" ,gettext-minimal)
2053 ("pkg-config" ,pkg-config)
2056 ("pytest" ,python-pytest)
2057 ("requests" ,python-requests)))
2058 (home-page "https://gitlab.com/libosinfo/osinfo-db-tools")
2059 (synopsis "Tools for managing the osinfo database")
2060 (description "This package contains a set of tools to assist
2061 administrators and developers in managing the database.")
2062 (license license:lgpl2.0+)))
2064 (define-public osinfo-db
2067 (version "20201218")
2070 (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-"
2074 "0ydbindwgw7kg861rqii5036gq0dbbbmv35dzrmmv937ddfsxwh0"))))
2075 (build-system trivial-build-system)
2077 `(#:modules ((guix build utils))
2080 (use-modules (guix build utils))
2081 (let* ((out (assoc-ref %outputs "out"))
2082 (osinfo-dir (string-append out "/share/osinfo"))
2083 (source (assoc-ref %build-inputs "source"))
2085 (string-append (assoc-ref %build-inputs "osinfo-db-tools")
2086 "/bin/osinfo-db-import")))
2087 (mkdir-p osinfo-dir)
2088 (invoke osinfo-db-import "--dir" osinfo-dir source)
2091 `(("intltool" ,intltool)
2092 ("osinfo-db-tools" ,osinfo-db-tools)))
2093 (home-page "https://gitlab.com/libosinfo/osinfo-db")
2094 (synopsis "Database of information about operating systems")
2095 (description "Osinfo-db provides the database files for use with the
2096 libosinfo library. It provides information about guest operating systems for
2097 use with virtualization provisioning tools")
2098 (license license:lgpl2.0+)))
2100 (define-public python-transient
2102 (name "python-transient")
2107 (uri (pypi-uri "transient" version))
2110 "148yiqrmcscsi6787y0f27i1y9cf0gcw3mqfv5frhpmsmv62mv5z"))))
2111 (build-system python-build-system)
2113 `(#:tests? #f ; Requires behave
2114 #:phases (modify-phases %standard-phases
2115 (add-after 'unpack 'fix-dependencies
2117 (substitute* "setup.py"
2122 `(("python-beautifultable" ,python-beautifultable)
2123 ("python-click" ,python-click)
2124 ("python-importlib-resources"
2125 ,python-importlib-resources)
2126 ("python-lark-parser" ,python-lark-parser)
2127 ("python-marshmallow" ,python-marshmallow)
2128 ("python-progressbar2" ,python-progressbar2)
2129 ("python-requests" ,python-requests)
2130 ("python-toml" ,python-toml)))
2132 `(("python-black" ,python-black)
2133 ("python-mypy" ,python-mypy)
2134 ("python-pyhamcrest" ,python-pyhamcrest)
2135 ("python-twine" ,python-twine)))
2137 "https://github.com/ALSchwalm/transient")
2139 "QEMU Wrapper written in Python")
2141 "@code{transient} is a wrapper for QEMU allowing the creation of virtual
2142 machines with shared folder, ssh, and disk creation support.")
2143 (license license:expat)))