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 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 bison)
47 #:use-module (gnu packages build-tools)
48 #:use-module (gnu packages check)
49 #:use-module (gnu packages cmake)
50 #:use-module (gnu packages compression)
51 #:use-module (gnu packages cross-base)
52 #:use-module (gnu packages curl)
53 #:use-module (gnu packages cyrus-sasl)
54 #:use-module (gnu packages debian)
55 #:use-module (gnu packages disk)
56 #:use-module (gnu packages dns)
57 #:use-module (gnu packages docbook)
58 #:use-module (gnu packages documentation)
59 #:use-module (gnu packages figlet)
60 #:use-module (gnu packages firmware)
61 #:use-module (gnu packages flex)
62 #:use-module (gnu packages fontutils)
63 #:use-module (gnu packages freedesktop)
64 #:use-module (gnu packages gettext)
65 #:use-module (gnu packages gl)
66 #:use-module (gnu packages glib)
67 #:use-module (gnu packages gnome)
68 #:use-module (gnu packages gnupg)
69 #:use-module (gnu packages golang)
70 #:use-module (gnu packages graphviz)
71 #:use-module (gnu packages gtk)
72 #:use-module (gnu packages haskell)
73 #:use-module (gnu packages haskell-apps)
74 #:use-module (gnu packages haskell-check)
75 #:use-module (gnu packages haskell-crypto)
76 #:use-module (gnu packages haskell-web)
77 #:use-module (gnu packages haskell-xyz)
78 #:use-module (gnu packages image)
79 #:use-module (gnu packages libbsd)
80 #:use-module (gnu packages libusb)
81 #:use-module (gnu packages linux)
82 #:use-module (gnu packages m4)
83 #:use-module (gnu packages ncurses)
84 #:use-module (gnu packages nettle)
85 #:use-module (gnu packages networking)
86 #:use-module (gnu packages ninja)
87 #:use-module (gnu packages onc-rpc)
88 #:use-module (gnu packages package-management)
89 #:use-module (gnu packages perl)
90 #:use-module (gnu packages pcre)
91 #:use-module (gnu packages pkg-config)
92 #:use-module (gnu packages polkit)
93 #:use-module (gnu packages protobuf)
94 #:use-module (gnu packages python)
95 #:use-module (gnu packages python-build)
96 #:use-module (gnu packages python-check)
97 #:use-module (gnu packages python-crypto)
98 #:use-module (gnu packages python-web)
99 #:use-module (gnu packages python-xyz)
100 #:use-module (gnu packages pulseaudio)
101 #:use-module (gnu packages selinux)
102 #:use-module (gnu packages sdl)
103 #:use-module (gnu packages sphinx)
104 #:use-module (gnu packages spice)
105 #:use-module (gnu packages ssh)
106 #:use-module (gnu packages texinfo)
107 #:use-module (gnu packages textutils)
108 #:use-module (gnu packages tls)
109 #:use-module (gnu packages web)
110 #:use-module (gnu packages wget)
111 #:use-module (gnu packages xdisorg)
112 #:use-module (gnu packages xml)
113 #:use-module (gnu packages xorg)
114 #:use-module (guix build-system cmake)
115 #:use-module (guix build-system gnu)
116 #:use-module (guix build-system go)
117 #:use-module (guix build-system meson)
118 #:use-module (guix build-system python)
119 #:use-module (guix build-system trivial)
120 #:use-module (guix download)
121 #:use-module (guix git-download)
122 #:use-module ((guix licenses) #:prefix license:)
123 #:use-module (guix packages)
124 #:use-module (guix utils)
125 #:use-module (srfi srfi-1)
126 #:use-module (srfi srfi-26)
127 #:use-module (ice-9 match))
129 (define (qemu-patch commit file-name sha256-bv)
130 "Return an origin for COMMIT."
134 "http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h="
136 (hash (content-hash sha256-bv sha256))
137 (file-name file-name)))
146 (uri (string-append "https://download.qemu.org/qemu-"
150 "1g0pvx4qbirpcn9mni704y03n3lvkmw2c0rbcwvydyr8ns4xh66b"))
151 (patches (search-patches "qemu-CVE-2021-20203.patch"
152 "qemu-build-info-manual.patch"))
153 (modules '((guix build utils)))
156 ;; Fix a bug in the do_ioctl_ifconf() function of qemu to
157 ;; make ioctl(…, SIOCGIFCONF, …) work for emulated 64 bit
158 ;; architectures. The size of struct ifreq is handled
160 ;; https://lists.nongnu.org/archive/html/qemu-devel/2021-01/msg01545.html
161 (substitute* '("linux-user/syscall.c")
162 (("^([[:blank:]]*)const argtype ifreq_arg_type.*$" line indent)
163 (string-append line indent "const argtype ifreq_max_type[] = "
164 "{ MK_STRUCT(STRUCT_ifmap_ifreq) };\n"))
165 (("^([[:blank:]]*)target_ifreq_size[[:blank:]]=.*$" _ indent)
166 (string-append indent "target_ifreq_size = "
167 "thunk_type_size(ifreq_max_type, 0);")))
168 ;; Delete the bundled meson copy.
169 (delete-file-recursively "meson")))))
170 (outputs '("out" "static" "doc")) ;5.3 MiB of HTML docs
171 (build-system gnu-build-system)
173 ;; FIXME: Disable tests on i686 to work around
174 ;; <https://bugs.gnu.org/40527>.
175 `(#:tests? ,(or (%current-target-system)
176 (not (string=? "i686-linux" (%current-system))))
178 (let ((gcc (string-append (assoc-ref %build-inputs "gcc") "/bin/gcc"))
179 (out (assoc-ref %outputs "out")))
180 (list (string-append "--cc=" gcc)
181 ;; Some architectures insist on using HOST_CC.
182 (string-append "--host-cc=" gcc)
183 (string-append "--prefix=" out)
185 (string-append "--smbd=" out "/libexec/samba-wrapper")
186 "--disable-debug-info" ;for space considerations
187 ;; The binaries need to be linked against -lrt.
188 (string-append "--extra-ldflags=-lrt")))
189 ;; Make build and test output verbose to facilitate investigation upon failure.
190 #:make-flags '("V=1")
191 #:modules ((srfi srfi-1)
195 ,@%gnu-build-system-modules)
197 (modify-phases %standard-phases
198 (add-after 'set-paths 'hide-glibc
199 (lambda* (#:key inputs #:allow-other-keys)
200 ;; Work around https://issues.guix.info/issue/36882. We need to
201 ;; remove glibc from C_INCLUDE_PATH so that the one hardcoded in GCC,
202 ;; at the bottom of GCC include search-path is used.
203 (let* ((filters '("libc"))
205 (filter-map (lambda (input)
208 (and (not (member name filters))
211 (set-path-environment-variable "C_INCLUDE_PATH"
213 input-directories))))
214 (add-after 'unpack 'extend-test-time-outs
216 ;; These tests can time out on heavily-loaded and/or slow storage.
217 (substitute* (cons* "tests/qemu-iotests/common.qemu"
218 (find-files "tests/qemu-iotests" "^[0-9]+$"))
219 (("QEMU_COMM_TIMEOUT=[0-9]+" match)
220 (string-append match "9")))))
221 (add-after 'unpack 'disable-unusable-tests
223 (substitute* "tests/meson.build"
224 ;; Comment out the test-qga test, which needs /sys and
225 ;; fails within the build environment.
226 (("tests.*test-qga.*$" all)
227 (string-append "# " all))
228 ;; Comment out the test-char test, which needs networking and
229 ;; fails within the build environment.
230 (("check-unit-.* tests/test-char" all)
231 (string-append "# " all)))))
232 (add-after 'patch-source-shebangs 'patch-embedded-shebangs
234 ;; Ensure the executables created by these source files reference
235 ;; /bin/sh from the store so they work inside the build container.
236 (substitute* '("block/cloop.c" "migration/exec.c"
237 "net/tap.c" "tests/qtest/libqtest.c")
238 (("/bin/sh") (which "sh")))
239 (substitute* "Makefile"
240 (("SHELL = /usr/bin/env bash -o pipefail")
241 "SHELL = bash -o pipefail"))
242 (substitute* "tests/qemu-iotests/check"
243 (("#!/usr/bin/env python3")
244 (string-append "#!" (which "python3"))))))
245 (add-before 'configure 'fix-optionrom-makefile
247 ;; Work around the inability of the rules defined in this
248 ;; Makefile to locate the firmware files (e.g.: No rule to make
249 ;; target 'multiboot.bin') by extending the VPATH.
250 (substitute* "pc-bios/optionrom/Makefile"
251 (("^VPATH = \\$\\(SRC_DIR\\)")
252 "VPATH = $(SRC_DIR):$(TOPSRC_DIR)/pc-bios"))))
253 ;; XXX ./configure is being re-run at beginning of build phase...
255 (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
256 ;; The `configure' script doesn't understand some of the
257 ;; GNU options. Thus, add a new phase that's compatible.
258 (let ((out (assoc-ref outputs "out")))
259 (setenv "SHELL" (which "bash"))
260 ;; Ensure config.status gets the correct shebang off the bat.
261 ;; The build system gets confused if we change it later and
262 ;; attempts to re-run the whole configuration, and fails.
263 (substitute* "configure"
265 (string-append "#!" (which "sh"))))
268 (apply invoke "../../configure" configure-flags))))
269 ;; Configure, build and install QEMU user-emulation static binaries.
270 (add-after 'configure 'configure-user-static
271 (lambda* (#:key inputs outputs #:allow-other-keys)
272 (let* ((gcc (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
273 (static (assoc-ref outputs "static"))
274 ;; This is the common set of configure flags; it is
275 ;; duplicated here to isolate this phase from manipulations
276 ;; to the #:configure-flags build argument, as done in
277 ;; derived packages such as qemu-minimal.
278 (configure-flags (list (string-append "--cc=" gcc)
279 (string-append "--host-cc=" gcc)
281 "--disable-debug-info")))
282 (mkdir-p "../user-static")
283 (with-directory-excursion "../user-static"
284 (apply invoke "../../configure"
286 "--disable-docs" ;already built
288 "--enable-linux-user"
289 (string-append "--prefix=" static)
291 (add-after 'build 'build-user-static
293 (with-directory-excursion "../user-static"
294 (apply (assoc-ref %standard-phases 'build) args))))
295 (add-after 'install 'install-user-static
296 (lambda* (#:key outputs #:allow-other-keys)
297 (let* ((static (assoc-ref outputs "static"))
298 (bin (string-append static "/bin")))
299 (with-directory-excursion "../user-static"
300 (for-each (cut install-file <> bin)
301 (append-map (cut find-files <> "^qemu-" #:stat stat)
304 "-linux-user" <>))))))))
305 ;; Create a wrapper for Samba. This allows QEMU to use Samba without
306 ;; pulling it in as an input. Note that you need to explicitly install
307 ;; Samba in your Guix profile for Samba support.
308 (add-after 'install 'create-samba-wrapper
309 (lambda* (#:key inputs outputs #:allow-other-keys)
310 (let* ((out (assoc-ref outputs "out"))
311 (libexec (string-append out "/libexec")))
312 (call-with-output-file "samba-wrapper"
314 (format port "#!/bin/sh
316 (chmod "samba-wrapper" #o755)
317 (install-file "samba-wrapper" libexec))))
318 (add-after 'install 'move-html-doc
319 (lambda* (#:key inputs outputs #:allow-other-keys)
320 (let* ((out (assoc-ref outputs "out"))
321 (doc (assoc-ref outputs "doc"))
322 (qemu-doc (string-append doc "/share/doc/qemu-" ,version)))
324 (rename-file (string-append out "/share/doc/qemu")
325 (string-append qemu-doc "/html"))))))))
326 (inputs ; TODO: Add optional inputs.
327 `(("alsa-lib" ,alsa-lib)
333 ("libcacard" ,libcacard) ; smartcard support
334 ("libcap-ng" ,libcap-ng) ; virtfs support requires libcap-ng & libattr
336 ("libepoxy" ,libepoxy)
337 ("libjpeg" ,libjpeg-turbo)
339 ("libseccomp" ,libseccomp)
340 ("libusb" ,libusb) ;USB pass-through support
343 ;; ("pciutils" ,pciutils)
345 ("pulseaudio" ,pulseaudio)
348 ("usbredir" ,usbredir)
349 ("util-linux" ,util-linux)
351 ("virglrenderer" ,virglrenderer)
353 (native-inputs `(("gettext" ,gettext-minimal)
354 ("glib:bin" ,glib "bin") ; gtester, etc.
358 ;; Using meson 0.57.1 enables reproducible QEMU builds.
359 ("meson" ,meson-next)
361 ("pkg-config" ,pkg-config)
362 ("python-wrapper" ,python-wrapper)
363 ("python-sphinx" ,python-sphinx)
365 ;; The following static libraries are required to build
366 ;; the static output of QEMU.
367 ("glib-static" ,glib-static)
368 ("pcre:static" ,pcre "static")
369 ("zlib:static" ,zlib "static")))
370 (home-page "https://www.qemu.org")
371 (synopsis "Machine emulator and virtualizer")
373 "QEMU is a generic machine emulator and virtualizer.
375 When used as a machine emulator, QEMU can run OSes and programs made for one
376 machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
377 using dynamic translation, it achieves very good performance.
379 When used as a virtualizer, QEMU achieves near native performances by
380 executing the guest code directly on the host CPU. QEMU supports
381 virtualization when executing under the Xen hypervisor or using
382 the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
383 server and embedded PowerPC, and S390 guests.")
385 ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
386 (license license:gpl2)
388 ;; Several tests fail on MIPS; see <http://hydra.gnu.org/build/117914>.
389 (supported-systems (fold delete %supported-systems
390 '("mips64el-linux" "i586-gnu")))))
392 (define-public qemu-minimal
393 ;; QEMU without GUI support, only supporting the host's architecture
396 (name "qemu-minimal")
398 "Machine emulator and virtualizer (without GUI) for the host architecture")
400 (substitute-keyword-arguments (package-arguments qemu)
401 ((#:configure-flags configure-flags '(list))
402 ;; Restrict to the host's architecture.
403 (let* ((system (or (%current-target-system)
407 ((? (cut string-prefix? "i686" <>))
408 "--target-list=i386-softmmu")
409 ((? (cut string-prefix? "x86_64" <>))
410 "--target-list=i386-softmmu,x86_64-softmmu")
411 ((? (cut string-prefix? "mips64" <>))
412 (string-append "--target-list=mips-softmmu,mipsel-softmmu,"
413 "mips64-softmmu,mips64el-softmmu"))
414 ((? (cut string-prefix? "mips" <>))
415 "--target-list=mips-softmmu,mipsel-softmmu")
416 ((? (cut string-prefix? "aarch64" <>))
417 "--target-list=arm-softmmu,aarch64-softmmu")
418 ((? (cut string-prefix? "arm" <>))
419 "--target-list=arm-softmmu")
420 ((? (cut string-prefix? "alpha" <>))
421 "--target-list=alpha-softmmu")
422 ((? (cut string-prefix? "powerpc64" <>))
423 "--target-list=ppc-softmmu,ppc64-softmmu")
424 ((? (cut string-prefix? "powerpc" <>))
425 "--target-list=ppc-softmmu")
426 ((? (cut string-prefix? "s390" <>))
427 "--target-list=s390x-softmmu")
428 ((? (cut string-prefix? "riscv" <>))
429 "--target-list=riscv32-softmmu,riscv64-softmmu")
430 (else ; An empty list actually builds all the targets.
432 `(cons ,target-list-arg ,configure-flags)))))
434 ;; Remove dependencies on optional libraries, notably GUI libraries.
435 (native-inputs (fold alist-delete (package-native-inputs qemu)
437 (inputs (fold alist-delete (package-inputs qemu)
438 '("libusb" "mesa" "sdl2" "spice" "virglrenderer" "gtk+"
439 "usbredir" "libdrm" "libepoxy" "pulseaudio" "vde2"
442 (define (system->qemu-target system)
444 ((string-prefix? "i686" system)
446 ((string-prefix? "arm" system)
449 (string-append "qemu-system-" (match (string-split system #\-)
453 (define-public ganeti
456 ;; Note: we use a pre-release for Python 3 compatibility as well as many
458 (version "3.0.0beta1-24-g024cc9fa2")
462 (url "https://github.com/ganeti/ganeti")
463 (commit (string-append "v" version))))
465 (base32 "1ll34qd2mifni3bhg7cnir3xfnkafig8ch33qndqwrsby0y5ssia"))
466 (file-name (git-file-name name version))
467 (patches (search-patches "ganeti-shepherd-support.patch"
468 "ganeti-shepherd-master-failover.patch"
469 "ganeti-deterministic-manual.patch"
470 "ganeti-drbd-compat.patch"
471 "ganeti-os-disk-size.patch"
472 "ganeti-haskell-pythondir.patch"
473 "ganeti-disable-version-symlinks.patch"
474 "ganeti-preserve-PYTHONPATH.patch"))))
475 (build-system gnu-build-system)
477 `(#:imported-modules (,@%gnu-build-system-modules
478 (guix build haskell-build-system)
479 (guix build python-build-system))
480 #:modules (,@%gnu-build-system-modules
481 ((guix build haskell-build-system) #:prefix haskell:)
482 ((guix build python-build-system) #:select (python-version))
485 ;; The default test target includes a lot of checks that are only really
486 ;; relevant for developers such as NEWS file checking, line lengths, etc.
487 ;; We are only interested in the "py-tests" and "hs-tests" targets: this
488 ;; is the closest we've got even though it includes a little more.
489 #:test-target "check-TESTS"
492 (list "--localstatedir=/var"
493 "--sharedstatedir=/var"
495 "--enable-haskell-tests"
497 ;; By default, the build system installs everything to versioned
498 ;; directories such as $libdir/3.0 and relies on a $libdir/default
499 ;; symlink pointed from /etc/ganeti/{lib,share} to actually function.
500 ;; This is done to accommodate installing multiple versions in
501 ;; parallel, but is of little use to us as Guix users can just
502 ;; roll back and forth. Thus, disable it for simplicity.
503 "--disable-version-links"
505 ;; Ganeti can optionally take control over SSH host keys and
506 ;; distribute them to nodes as they are added, and also rotate keys
507 ;; with 'gnt-cluster renew-crypto --new-ssh-keys'. Thus it needs to
508 ;; know how to restart the SSH daemon.
509 "--with-sshd-restart-command='herd restart ssh-daemon'"
511 ;; Look for OS definitions in this directory by default. It can
512 ;; be changed in the cluster configuration.
513 "--with-os-search-path=/run/current-system/profile/share/ganeti/os"
515 ;; The default QEMU executable to use. We don't use the package
516 ;; here because this entry is stored in the cluster configuration.
517 (string-append "--with-kvm-path=/run/current-system/profile/bin/"
518 ,(system->qemu-target (%current-system))))
520 (modify-phases %standard-phases
521 (add-after 'unpack 'create-vcs-version
523 ;; If we are building from a git checkout, we need to create a
524 ;; 'vcs-version' file manually because the build system does
525 ;; not have access to the git repository information.
526 (unless (file-exists? "vcs-version")
527 (call-with-output-file "vcs-version"
529 (format port "v~a~%" ,version))))
531 (add-after 'unpack 'patch-absolute-file-names
533 (substitute* '("lib/utils/process.py"
535 "src/Ganeti/Constants.hs"
536 "src/Ganeti/HTools/CLI.hs"
537 "test/py/ganeti.config_unittest.py"
538 "test/py/ganeti.hooks_unittest.py"
539 "test/py/ganeti.utils.process_unittest.py"
540 "test/py/ganeti.utils.text_unittest.py"
541 "test/py/ganeti.utils.wrapper_unittest.py")
542 (("/bin/sh") (which "sh"))
543 (("/bin/bash") (which "bash"))
544 (("/usr/bin/env") (which "env"))
545 (("/bin/true") (which "true")))
547 ;; This script is called by the node daemon at startup to perform
548 ;; sanity checks on the cluster IP addresses, and it is also used
549 ;; in a master-failover scenario. Add absolute references to
550 ;; avoid propagating these executables.
551 (substitute* "tools/master-ip-setup"
552 (("arping") (which "arping"))
553 (("ndisc6") (which "ndisc6"))
554 (("fping") (which "fping"))
555 (("grep") (which "grep"))
556 (("ip addr") (string-append (which "ip") " addr")))
558 (add-after 'unpack 'override-builtin-PATH
560 ;; Ganeti runs OS install scripts and similar with a built-in
561 ;; hard coded PATH. Patch so it works on Guix System.
562 (substitute* "src/Ganeti/Constants.hs"
563 (("/sbin:/bin:/usr/sbin:/usr/bin")
564 "/run/setuid-programs:/run/current-system/profile/sbin:\
565 /run/current-system/profile/bin"))
567 (add-after 'bootstrap 'patch-sphinx-version-detection
569 ;; The build system runs 'sphinx-build --version' to verify that
570 ;; the Sphinx is recent enough, but does not expect the
571 ;; .sphinx-build-real executable name created by the Sphinx wrapper.
572 (substitute* "configure"
573 (("\\$SPHINX --version 2>&1")
574 "$SPHINX --version 2>&1 | sed 's/.sphinx-build-real/sphinx-build/g'"))
577 ;; The build system invokes Cabal and GHC, which do not work with
578 ;; GHC_PACKAGE_PATH: <https://github.com/haskell/cabal/issues/3728>.
579 ;; Tweak the build system to do roughly what haskell-build-system does.
580 (add-before 'configure 'configure-haskell
581 (assoc-ref haskell:%standard-phases 'setup-compiler))
582 (add-after 'configure 'do-not-use-GHC_PACKAGE_PATH
584 (unsetenv "GHC_PACKAGE_PATH")
585 (substitute* "Makefile"
587 "$(CABAL) --package-db=../package.conf.d")
589 "$(GHC) -package-db=../package.conf.d"))
591 (add-after 'configure 'make-ghc-use-shared-libraries
593 (substitute* "Makefile"
594 (("HFLAGS =") "HFLAGS = -dynamic -fPIC"))
596 (add-after 'configure 'fix-installation-directories
598 (substitute* "Makefile"
599 ;; Do not attempt to create /var during install.
600 (("\\$\\(DESTDIR\\)\\$\\{localstatedir\\}")
601 "$(DESTDIR)${prefix}${localstatedir}")
602 ;; Similarly, do not attempt to install the sample ifup scripts
604 (("\\$\\(DESTDIR\\)\\$\\(ifupdir\\)")
605 "$(DESTDIR)${prefix}$(ifupdir)"))
607 (add-before 'build 'adjust-tests
609 ;; Disable tests that can not run. Do it early to prevent
610 ;; touching the Makefile later and triggering a needless rebuild.
611 (substitute* "Makefile"
612 ;; These tests expect the presence of a 'root' user (via
613 ;; ganeti/runtime.py), which fails in the build environment.
614 (("test/py/ganeti\\.asyncnotifier_unittest\\.py") "")
615 (("test/py/ganeti\\.backend_unittest\\.py") "")
616 (("test/py/ganeti\\.daemon_unittest\\.py") "")
617 (("test/py/ganeti\\.tools\\.ensure_dirs_unittest\\.py") "")
618 (("test/py/ganeti\\.utils\\.io_unittest-runasroot\\.py") "")
619 ;; Disable the bash_completion test, as it requires the full
620 ;; bash instead of bash-minimal.
621 (("test/py/bash_completion\\.bash")
623 ;; This test requires networking.
624 (("test/py/import-export_unittest\\.bash")
627 ;; Many of the Makefile targets reset PYTHONPATH before running
628 ;; the Python interpreter, which does not work very well for us.
629 (substitute* "Makefile"
631 (string-append "PYTHONPATH=" (getenv "PYTHONPATH") ":")))
633 (add-after 'build 'build-bash-completions
635 (let ((orig-pythonpath (getenv "PYTHONPATH")))
636 (setenv "PYTHONPATH" (string-append ".:" orig-pythonpath))
637 (invoke "./autotools/build-bash-completion")
638 (setenv "PYTHONPATH" orig-pythonpath)
640 (add-before 'check 'pre-check
641 (lambda* (#:key inputs #:allow-other-keys)
642 ;; Set TZDIR so that time zones are found.
643 (setenv "TZDIR" (string-append (assoc-ref inputs "tzdata")
646 ;; This test checks whether PYTHONPATH is untouched, and extends
647 ;; it to include test directories if so. Add an else branch for
648 ;; our modified PYTHONPATH, in order to prevent a confusing test
649 ;; failure where expired certificates are not cleaned because
650 ;; check-cert-expired is silently crashing.
651 (substitute* "test/py/ganeti-cleaner_unittest.bash"
652 (("then export PYTHONPATH=(.*)" all testpath)
653 (string-append all "else export PYTHONPATH="
654 (getenv "PYTHONPATH") ":" testpath "\n")))
656 (substitute* "test/py/ganeti.utils.process_unittest.py"
657 ;; This test attempts to run an executable with
658 ;; RunCmd(..., reset_env=True), which fails because the default
659 ;; PATH from Constants.hs does not exist in the build container.
660 ((".*def testResetEnv.*" all)
661 (string-append " @unittest.skipIf(True, "
662 "\"cannot reset env in the build container\")\n"
665 ;; XXX: Somehow this test fails in the build container, but
666 ;; works in 'guix environment -C', even without /bin/sh?
667 ((".*def testPidFile.*" all)
668 (string-append " @unittest.skipIf(True, "
669 "\"testPidFile fails in the build container\")\n"
672 ;; XXX: Why are these links not added automatically.
673 (with-directory-excursion "test/hs"
674 (for-each (lambda (file)
675 (symlink "../../src/htools" file))
676 '("hspace" "hscan" "hinfo" "hbal" "hroller"
677 "hcheck" "hail" "hsqueeze")))
679 (add-after 'install 'install-bash-completions
680 (lambda* (#:key outputs #:allow-other-keys)
681 (let* ((out (assoc-ref outputs "out"))
682 (compdir (string-append out "/etc/bash_completion.d")))
684 (copy-file "doc/examples/bash_completion"
685 (string-append compdir "/ganeti"))
686 ;; The one file contains completions for many different
687 ;; executables. Create symlinks for found completions.
688 (with-directory-excursion compdir
690 (lambda (prog) (symlink "ganeti" prog))
691 (call-with-input-file "ganeti"
693 (let loop ((line (read-line port))
695 (if (eof-object? line)
697 (if (string-prefix? "complete" line)
698 (loop (read-line port)
699 ;; Extract "prog" from lines of the form:
700 ;; "complete -F _prog -o filenames prog".
701 ;; Note that 'burnin' is listed with the
702 ;; absolute file name, which is why we
703 ;; run everything through 'basename'.
704 (cons (basename (car (reverse (string-split
707 (loop (read-line port) progs))))))))
709 ;; Wrap all executables with PYTHONPATH. We can't borrow the phase
710 ;; from python-build-system because we also need to wrap the scripts
711 ;; in $out/lib/ganeti such as "node-daemon-setup".
712 (add-after 'install 'wrap
713 (lambda* (#:key inputs outputs #:allow-other-keys)
714 (let* ((out (assoc-ref outputs "out"))
715 (sbin (string-append out "/sbin"))
716 (lib (string-append out "/lib"))
717 (python (assoc-ref inputs "python"))
718 (major+minor (python-version python))
719 (PYTHONPATH (string-append lib "/python" major+minor
721 (getenv "PYTHONPATH"))))
722 (define (shell-script? file)
723 (call-with-ascii-input-file file
725 (let ((shebang (false-if-exception (read-line port))))
727 (string-prefix? "#!" shebang)
728 (or (string-contains shebang "/bin/bash")
729 (string-contains shebang "/bin/sh")))))))
732 ;; Do not wrap shell scripts because some are meant to be
733 ;; sourced, which breaks if they are wrapped. We do wrap
734 ;; the Haskell executables because some call out to Python
736 (and (executable-file? file)
737 (not (symbolic-link? file))
738 (not (shell-script? file))))
740 (for-each (lambda (file)
742 `("PYTHONPATH" ":" prefix (,PYTHONPATH))))
744 (append (find-files (string-append lib "/ganeti"))
749 ("cabal" ,cabal-install)
752 ;; These inputs are necessary to bootstrap the package, because we
753 ;; have patched the build system.
754 ("autoconf" ,autoconf)
755 ("automake" ,automake)
757 ;; For the documentation.
758 ("python-docutils" ,python-docutils)
759 ("sphinx" ,python-sphinx)
763 ;; Test dependencies.
764 ("fakeroot" ,fakeroot)
765 ("ghc-temporary" ,ghc-temporary)
766 ("ghc-test-framework" ,ghc-test-framework)
767 ("ghc-test-framework-hunit" ,ghc-test-framework-hunit)
768 ("ghc-test-framework-quickcheck2" ,ghc-test-framework-quickcheck2)
769 ("python-mock" ,python-mock)
770 ("python-pyyaml" ,python-pyyaml)
773 ("shelltestrunner" ,shelltestrunner)
774 ("tzdata" ,tzdata-for-tests)))
776 `(("arping" ,iputils) ;must be the iputils version
779 ("iproute2" ,iproute)
782 ("qemu" ,qemu-minimal) ;for qemu-img
783 ("ghc-attoparsec" ,ghc-attoparsec)
784 ("ghc-base64-bytestring" ,ghc-base64-bytestring)
785 ("ghc-cryptonite" ,ghc-cryptonite)
786 ("ghc-curl" ,ghc-curl)
787 ("ghc-hinotify" ,ghc-hinotify)
788 ("ghc-hslogger" ,ghc-hslogger)
789 ("ghc-json" ,ghc-json)
790 ("ghc-lens" ,ghc-lens)
791 ("ghc-lifted-base" ,ghc-lifted-base)
792 ("ghc-network" ,ghc-network)
793 ("ghc-old-time" ,ghc-old-time)
794 ("ghc-psqueue" ,ghc-psqueue)
795 ("ghc-regex-pcre" ,ghc-regex-pcre)
796 ("ghc-utf8-string" ,ghc-utf8-string)
797 ("ghc-zlib" ,ghc-zlib)
799 ;; For the optional metadata daemon.
800 ("ghc-snap-core" ,ghc-snap-core)
801 ("ghc-snap-server" ,ghc-snap-server)
804 ("python-pyopenssl" ,python-pyopenssl)
805 ("python-simplejson" ,python-simplejson)
806 ("python-pyparsing" ,python-pyparsing)
807 ("python-pyinotify" ,python-pyinotify)
808 ("python-pycurl" ,python-pycurl)
809 ("python-bitarray" ,python-bitarray)
810 ("python-paramiko" ,python-paramiko)
811 ("python-psutil" ,python-psutil)))
812 (home-page "https://www.ganeti.org/")
813 (synopsis "Cluster-based virtual machine management system")
815 "Ganeti is a virtual machine management tool built on top of existing
816 virtualization technologies such as Xen or KVM. Ganeti controls:
819 @item Disk creation management;
820 @item Operating system installation for instances (in co-operation with
821 OS-specific install scripts); and
822 @item Startup, shutdown, and failover between physical systems.
825 Ganeti is designed to facilitate cluster management of virtual servers and
826 to provide fast and simple recovery after physical failures, using
827 commodity hardware.")
828 (license license:bsd-2)))
830 (define-public ganeti-instance-guix
832 (name "ganeti-instance-guix")
834 (home-page "https://github.com/mbakke/ganeti-instance-guix")
837 (uri (git-reference (url home-page) (commit version)))
838 (file-name (git-file-name name version))
841 "0aa08irpcpns6mhjgsplc5f0p8ab1qcr9ah1gj5z66kxgqyflzrp"))))
842 (build-system gnu-build-system)
844 '(#:configure-flags '("--sysconfdir=/etc" "--localstatedir=/var")))
846 `(("autoconf" ,autoconf)
847 ("automake" ,automake)))
849 `(("util-linux" ,util-linux)
850 ("qemu-img" ,qemu-minimal)))
851 (synopsis "Guix OS integration for Ganeti")
853 "This package provides a guest OS definition for Ganeti that uses
854 Guix to build virtual machines.")
855 (license license:gpl3+)))
857 (define-public ganeti-instance-debootstrap
859 (name "ganeti-instance-debootstrap")
860 ;; We need two commits on top of the latest release for compatibility
861 ;; with newer sfdisk, as well as gnt-network integration.
862 (version "0.16-2-ge145396")
863 (home-page "https://github.com/ganeti/instance-debootstrap")
866 (uri (git-reference (url home-page) (commit version)))
867 (file-name (git-file-name name version))
870 "0f2isw9d8lawzj21rrq1q9xhq8xfa65rqbhqmrn59z201x9q1336"))))
871 (build-system gnu-build-system)
873 '(#:configure-flags '("--sysconfdir=/etc" "--localstatedir=/var")
874 #:phases (modify-phases %standard-phases
875 (add-after 'unpack 'add-absolute-references
877 (substitute* "common.sh.in"
878 (("/sbin/blkid") (which "blkid"))
880 (string-append (which "kpartx") " -")))
881 (substitute* "import"
883 (string-append (which "restore") " -r")))
884 (substitute* "export"
886 (string-append (which "dump") " -0")))
887 (substitute* "create"
888 (("debootstrap") (which "debootstrap"))
889 (("`which run-parts`") (which "run-parts"))
890 ;; Here we actually need to hard code /bin/passwd
891 ;; because it's called via chroot, which fails if
892 ;; "/bin" is not in PATH.
893 (("passwd") "/bin/passwd"))
895 (add-after 'unpack 'set-dpkg-arch
896 (lambda* (#:key system #:allow-other-keys)
897 ;; The create script passes --arch to debootstrap,
898 ;; and defaults to `dpkg --print-architecture` when
899 ;; ARCH is not set in variant.conf. Hard code the
900 ;; build-time architecture to avoid the dpkg dependency.
902 (cond ((string-prefix? "x86_64" system)
904 ((string-prefix? "i686" system)
906 ((string-prefix? "aarch64" system)
908 (else (car (string-split system #\-))))))
909 (substitute* "create"
910 (("`dpkg --print-architecture`")
913 (add-after 'configure 'adjust-Makefile
915 ;; Do not attempt to create /etc/ganeti/instance-debootstrap
916 ;; and /etc/default/ganeti-instance-debootstrap during install.
917 ;; They are created by the Ganeti service.
918 (substitute* "Makefile"
919 (("\\$\\(variantsdir\\)")
920 "$(prefix)/etc/ganeti/instance-debootstrap/variants")
921 (("\\$\\(defaultsdir\\)")
922 "$(prefix)/etc/default/ganeti-instance-debootstrap"))
924 (add-after 'install 'make-variants.list-symlink
925 (lambda* (#:key outputs #:allow-other-keys)
926 ;; The Ganeti OS API mandates a variants.list file that
927 ;; describes all supported "variants" of this OS.
928 ;; Guix generates this file, so make the original file
930 (with-directory-excursion (string-append
931 (assoc-ref outputs "out")
932 "/share/ganeti/os/debootstrap")
933 (delete-file "variants.list")
934 (symlink "/etc/ganeti/instance-debootstrap/variants/variants.list"
938 `(("autoconf" ,autoconf)
939 ("automake" ,automake)))
941 `(("debianutils" ,debianutils)
942 ("debootstrap" ,debootstrap)
944 ("kpartx" ,multipath-tools)
945 ("util-linux" ,util-linux)))
946 (synopsis "Debian OS integration for Ganeti")
948 "This package provides a guest OS definition for Ganeti. It installs
949 Debian or a derivative using @command{debootstrap}.")
950 (license license:gpl2+)))
952 (define-public libosinfo
959 (uri (string-append "https://releases.pagure.org/libosinfo/libosinfo-"
963 "1s97sv24bybggjx6hgqba2qdqz3ivfpd4cmkh4zm5y59sim109mv"))))
964 (build-system meson-build-system)
967 (list (string-append "-Dwith-usb-ids-path="
968 (assoc-ref %build-inputs "usb.ids"))
969 (string-append "-Dwith-pci-ids-path="
970 (assoc-ref %build-inputs "pci.ids")))
972 (modify-phases %standard-phases
973 (add-after 'unpack 'patch-osinfo-path
974 (lambda* (#:key inputs #:allow-other-keys)
975 (substitute* "osinfo/osinfo_loader.c"
976 (("path = DATA_DIR.*")
977 (string-append "path = \"" (assoc-ref inputs "osinfo-db")
978 "/share/osinfo\";")))
981 `(("libsoup" ,libsoup)
984 ("osinfo-db" ,osinfo-db)))
986 `(("glib" ,glib "bin") ; glib-mkenums, etc.
987 ("gobject-introspection" ,gobject-introspection)
988 ("gtk-doc" ,gtk-doc/stable)
990 ("intltool" ,intltool)
991 ("pkg-config" ,pkg-config)
995 (uri "https://github.com/pciutils/pciids/raw/ad02084f0bc143e3c15e31a6152a3dfb1d7a3156/pci.ids")
998 "0kfhpj5rnh24hz2714qhfmxk281vwc2w50sm73ggw5d15af7zfsw"))))
1002 (uri "https://svn.code.sf.net/p/linux-usb/repo/trunk/htdocs/usb.ids?r=2681")
1003 (file-name "usb.ids")
1006 "1m6yhvz5k8aqzxgk7xj3jkk8frl1hbv0h3vgj4wbnvnx79qnvz3r"))))))
1007 (home-page "https://libosinfo.org/")
1008 (synopsis "Operating system information database")
1009 (description "libosinfo is a GObject based library API for managing
1010 information about operating systems, hypervisors and the (virtual) hardware
1011 devices they can support. It includes a database containing device metadata
1012 and provides APIs to match/identify optimal devices for deploying an operating
1013 system on a hypervisor. Via GObject Introspection, the API is available in
1014 all common programming languages. Vala bindings are also provided.")
1015 ;; The library files are released under LGPLv2.1 or later; the source
1016 ;; files in the "tools" directory are released under GPLv2+.
1017 (license (list license:lgpl2.1+ license:gpl2+))))
1026 "https://linuxcontainers.org/downloads/lxc/lxc-"
1030 "0qz4l7mlhq7hx53q606qgvkyzyr01glsw290v8ppzvxn1fydlrci"))))
1031 (build-system gnu-build-system)
1033 `(("pkg-config" ,pkg-config)))
1035 `(("gnutls" ,gnutls)
1037 ("libseccomp" ,libseccomp)
1038 ("libselinux" ,libselinux)))
1041 (list (string-append "--docdir=" (assoc-ref %outputs "out")
1042 "/share/doc/" ,name "-" ,version)
1044 "--localstatedir=/var")
1046 (modify-phases %standard-phases
1048 (lambda* (#:key outputs #:allow-other-keys)
1049 (let* ((out (assoc-ref outputs "out"))
1050 (bashcompdir (string-append out "/etc/bash_completion.d")))
1051 (invoke "make" "install"
1052 (string-append "bashcompdir=" bashcompdir)
1053 ;; Don't install files into /var and /etc.
1054 "LXCPATH=/tmp/var/lib/lxc"
1055 "localstatedir=/tmp/var"
1056 "sysconfdir=/tmp/etc"
1057 "sysconfigdir=/tmp/etc/default")))))))
1058 (synopsis "Linux container tools")
1059 (home-page "https://linuxcontainers.org/")
1061 "LXC is a userspace interface for the Linux kernel containment features.
1062 Through a powerful API and simple tools, it lets Linux users easily create and
1063 manage system or application containers.")
1064 (license license:lgpl2.1+)))
1066 (define-public libvirt
1073 (uri (string-append "https://libvirt.org/sources/libvirt-"
1076 (base32 "0v50ckf56h6jd9bmqwp0lh2cmb7qqjmcb6y3mz2i2r15h06ih3w7"))
1078 (search-patches "libvirt-do-not-create-var-dirs.patch"))))
1079 (build-system meson-build-system)
1081 `(#:meson ,meson-0.55 ;; libvirt requires meson 0.54 or higher.
1083 (list "-Ddriver_qemu=enabled"
1084 "-Dqemu_user=nobody"
1088 (modify-phases %standard-phases
1089 (add-after 'unpack 'fix-sysconfdir-and-localstatedir
1091 (substitute* "meson.build"
1092 ;; We set the prefix to be the package output, but we need
1093 ;; localstatedir to be /var. Sadly the build system doesn't
1094 ;; seem to allow that easily.
1095 (("localstatedir = prefix / get_option\\('localstatedir'\\)")
1096 "localstatedir = get_option('localstatedir')")
1097 ;; On the other hand, we keep sysconfdir using the prefix so
1098 ;; that we install configuration files in the package output.
1099 ;; However, we need to make sure the C code refers to /etc via
1100 ;; SYSCONFDIR, and not the read-only configuration in the
1102 (("set_quoted\\('SYSCONFDIR', sysconfdir\\)")
1103 "set_quoted('SYSCONFDIR', '/etc')"))
1105 (add-before 'configure 'disable-broken-tests
1107 (substitute* "tests/meson.build"
1108 (("\\{ 'name': 'commandtest'.*") "") ; hangs idly
1109 (("\\{ 'name': 'qemuxml2argvtest'.*") "") ; fails
1110 (("\\{ 'name': 'virnetsockettest'.*") "")) ; tries to network
1113 `(("libxml2" ,libxml2)
1115 ("libpciaccess" ,libpciaccess)
1118 ("libpcap" ,libpcap)
1120 ("libtirpc" ,libtirpc) ;for <rpc/rpc.h>
1121 ("libuuid" ,util-linux "lib")
1122 ("lvm2" ,lvm2) ;for libdevmapper
1124 ("openssl" ,openssl)
1125 ("cyrus-sasl" ,cyrus-sasl)
1126 ("libyajl" ,libyajl)
1128 ("dmidecode" ,dmidecode)
1129 ("dnsmasq" ,dnsmasq)
1130 ("ebtables" ,ebtables)
1131 ("iproute" ,iproute)
1132 ("iptables" ,iptables)))
1134 `(("xsltproc" ,libxslt)
1136 ("pkg-config" ,pkg-config)
1138 ("python" ,python-wrapper)
1139 ("python-docutils" ,python-docutils) ;for rst2html
1140 ("rpcsvc-proto" ,rpcsvc-proto))) ;for 'rpcgen'
1141 (home-page "https://libvirt.org")
1142 (synopsis "Simple API for virtualization")
1143 (description "Libvirt is a C toolkit to interact with the virtualization
1144 capabilities of recent versions of Linux. The library aims at providing long
1145 term stable C API initially for the Xen paravirtualization but should be able
1146 to integrate other virtualization mechanisms if needed.")
1147 (license license:lgpl2.1+)))
1149 (define-public libvirt-glib
1151 (name "libvirt-glib")
1155 (uri (string-append "ftp://libvirt.org/libvirt/glib/"
1156 "libvirt-glib-" version ".tar.gz"))
1159 "1zpbv4ninc57c9rw4zmmkvvqn7154iv1qfr20kyxn8xplalqrzvz"))))
1160 (build-system gnu-build-system)
1162 `(("openssl" ,openssl)
1163 ("cyrus-sasl" ,cyrus-sasl)
1164 ("lvm2" ,lvm2) ; for libdevmapper
1165 ("libyajl" ,libyajl)))
1167 `(("pkg-config" ,pkg-config)
1168 ("intltool" ,intltool)
1169 ("glib" ,glib "bin")
1172 ;; ‘Required:’ by the installed .pc files.
1174 ("libvirt" ,libvirt)
1175 ("libxml2" ,libxml2)
1176 ("gobject-introspection" ,gobject-introspection)))
1177 (home-page "https://libvirt.org")
1178 (synopsis "GLib wrapper around libvirt")
1179 (description "libvirt-glib wraps the libvirt library to provide a
1180 high-level object-oriented API better suited for glib-based applications, via
1184 @item libvirt-glib - GLib main loop integration & misc helper APIs
1185 @item libvirt-gconfig - GObjects for manipulating libvirt XML documents
1186 @item libvirt-gobject - GObjects for managing libvirt objects
1189 (license license:lgpl2.1+)))
1191 (define-public python-libvirt
1193 (name "python-libvirt")
1198 (uri (string-append "https://libvirt.org/sources/python/libvirt-python-"
1201 (base32 "0dq0qn0xx5hflaq5apj5pm79ba0wcl3w0j9klx8bg73z80gd7bzs"))))
1202 (build-system python-build-system)
1205 (modify-phases %standard-phases
1206 (add-after 'unpack 'patch-nosetests-path
1207 (lambda* (#:key inputs #:allow-other-keys)
1208 (substitute* "setup.py"
1209 (("\"/usr/bin/nosetests\"")
1210 (string-append "\"" (which "nosetests") "\""))
1211 (("self\\.spawn\\(\\[sys\\.executable, nose\\]\\)")
1212 (format #f "self.spawn([\"~a\", nose])" (which "bash"))))
1215 `(("libvirt" ,libvirt)))
1217 `(("python-lxml" ,python-lxml)))
1219 `(("pkg-config" ,pkg-config)
1220 ("python-nose" ,python-nose)))
1221 (home-page "https://libvirt.org")
1222 (synopsis "Python bindings to libvirt")
1223 (description "This package provides Python bindings to the libvirt
1224 virtualization library.")
1225 (license license:lgpl2.1+)))
1227 (define-public python2-libvirt
1228 (package-with-python2 python-libvirt))
1230 (define-public virt-manager
1232 (name "virt-manager")
1236 (uri (string-append "https://virt-manager.org/download/sources"
1237 "/virt-manager/virt-manager-"
1241 "06ws0agxlip6p6n3n43knsnjyd91gqhh2dadgc33wl9lx1k8vn6g"))))
1242 (build-system python-build-system)
1244 `(#:use-setuptools? #f ; uses custom distutils 'install' command
1245 #:test-target "test_ui"
1246 #:tests? #f ; TODO The tests currently fail
1247 ; RuntimeError: Loop condition wasn't
1249 #:imported-modules ((guix build glib-or-gtk-build-system)
1250 ,@%python-build-system-modules)
1251 #:modules ((ice-9 match)
1253 (guix build python-build-system)
1254 ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
1257 (modify-phases %standard-phases
1258 (add-after 'unpack 'fix-setup
1259 (lambda* (#:key outputs #:allow-other-keys)
1260 (substitute* "virtinst/buildconfig.py"
1261 (("/usr") (assoc-ref outputs "out")))
1263 (add-after 'unpack 'fix-qemu-img-reference
1264 (lambda* (#:key inputs #:allow-other-keys)
1265 (substitute* "virtconv/formats.py"
1266 (("/usr(/bin/qemu-img)" _ suffix)
1267 (string-append (assoc-ref inputs "qemu") suffix)))
1269 (add-after 'unpack 'fix-default-uri
1270 (lambda* (#:key inputs #:allow-other-keys)
1271 ;; Xen is not available for now - so only patch qemu.
1272 (substitute* "virtManager/createconn.py"
1273 (("/usr(/bin/qemu-system)" _ suffix)
1274 (string-append (assoc-ref inputs "qemu") suffix)))
1276 (add-before 'wrap 'wrap-with-GI_TYPELIB_PATH
1277 (lambda* (#:key inputs outputs #:allow-other-keys)
1278 (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
1279 (bin-files (find-files bin ".*"))
1280 (paths (map (match-lambda
1281 ((output . directory)
1282 (let* ((girepodir (string-append
1284 "/lib/girepository-1.0")))
1285 (if (file-exists? girepodir)
1288 (for-each (lambda (file)
1289 (format #t "wrapping ~a\n" file)
1291 `("GI_TYPELIB_PATH" ":" prefix
1292 ,(filter identity paths))))
1296 (lambda* (#:key tests? #:allow-other-keys)
1298 (setenv "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" "--" "python" "setup.py" "test_ui"))
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 ;; The following are required for running the tests
1334 ;; ("python-dogtail" ,python-dogtail)
1335 ;; ("xvfb" ,xorg-server-for-tests)
1337 ;; ("at-spi2-core" ,at-spi2-core)
1338 ;; ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
1340 (home-page "https://virt-manager.org/")
1341 (synopsis "Manage virtual machines")
1343 "The virt-manager application is a desktop user interface for managing
1344 virtual machines through libvirt. It primarily targets KVM VMs, but also
1345 manages Xen and LXC (Linux containers). It presents a summary view of running
1346 domains, their live performance and resource utilization statistics.")
1347 (license license:gpl2+)))
1355 (uri (string-append "https://download.openvz.org/criu/criu-"
1356 version ".tar.bz2"))
1359 "09d0j24x0cyc7wkgi7cnxqgfjk7kbdlm79zxpj8d356sa3rw2z24"))))
1360 (build-system gnu-build-system)
1362 `(#:test-target "test"
1363 #:tests? #f ; tests require mounting as root
1365 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1366 (string-append "LIBDIR=" (assoc-ref %outputs "out")
1368 (string-append "ASCIIDOC=" (assoc-ref %build-inputs "asciidoc")
1370 (string-append "XMLTO=" (assoc-ref %build-inputs "xmlto")
1373 (modify-phases %standard-phases
1375 (lambda* (#:key inputs #:allow-other-keys)
1376 ;; The includes for libnl are located in a sub-directory.
1377 (setenv "C_INCLUDE_PATH"
1378 (string-append (assoc-ref inputs "libnl")
1380 (or (getenv "C_INCLUDE_PATH") "")))
1382 (add-after 'configure 'fix-documentation
1383 (lambda* (#:key inputs outputs #:allow-other-keys)
1384 (substitute* "Documentation/Makefile"
1387 "-m custom.xsl --skip-validation -x "
1388 (assoc-ref inputs "docbook-xsl") "/xml/xsl/"
1389 ,(package-name docbook-xsl) "-"
1390 ,(package-version docbook-xsl)
1391 "/manpages/docbook.xsl")))
1393 (add-after 'unpack 'hardcode-variables
1394 (lambda* (#:key inputs #:allow-other-keys)
1395 ;; Hardcode arm version detection
1396 (substitute* "Makefile"
1397 (("ARMV.*:=.*") "ARMV := 7\n"))
1398 ;; We are currently using python-2
1399 (substitute* "crit/Makefile"
1400 (("\\$\\(PYTHON\\)") "python2"))
1401 (substitute* "lib/Makefile"
1402 (("\\$\\(PYTHON\\)")
1403 (string-append (assoc-ref inputs "python")
1406 (add-before 'build 'fix-symlink
1407 (lambda* (#:key inputs #:allow-other-keys)
1408 ;; The file 'images/google/protobuf/descriptor.proto' points to
1409 ;; /usr/include/..., which obviously does not exist.
1410 (let* ((file "google/protobuf/descriptor.proto")
1411 (target (string-append "images/" file))
1412 (source (string-append (assoc-ref inputs "protobuf")
1414 (delete-file target)
1415 (symlink source target)
1417 (add-after 'install 'wrap
1418 (lambda* (#:key inputs outputs #:allow-other-keys)
1419 ;; Make sure 'crit' runs with the correct PYTHONPATH.
1420 (let* ((out (assoc-ref outputs "out"))
1421 (path (string-append out
1423 (string-take (string-take-right
1424 (assoc-ref inputs "python") 5) 3)
1426 (getenv "PYTHONPATH"))))
1427 (wrap-program (string-append out "/bin/crit")
1428 `("PYTHONPATH" ":" prefix (,path))))
1431 `(("protobuf" ,protobuf)
1432 ("python" ,python-2)
1433 ("python2-protobuf" ,python2-protobuf)
1434 ("python2-ipaddr" ,python2-ipaddr)
1435 ("iproute" ,iproute)
1441 ("nftables" ,nftables)))
1443 `(("pkg-config" ,pkg-config)
1445 ("protobuf-c" ,protobuf-c)
1446 ("asciidoc" ,asciidoc)
1448 ("docbook-xml" ,docbook-xml)
1449 ("docbook-xsl" ,docbook-xsl)))
1450 (home-page "https://criu.org")
1451 (synopsis "Checkpoint and restore in user space")
1452 (description "Using this tool, you can freeze a running application (or
1453 part of it) and checkpoint it to a hard drive as a collection of files. You
1454 can then use the files to restore and run the application from the point it
1455 was frozen at. The distinctive feature of the CRIU project is that it is
1456 mainly implemented in user space.")
1457 ;; The project is licensed under GPLv2; files in the lib/ directory are
1459 (license (list license:gpl2 license:lgpl2.1))))
1461 (define-public qmpbackup
1468 (url "https://github.com/abbbi/qmpbackup")
1470 (file-name (git-file-name name version))
1473 "0swhp5byz44brhyis1a39p11fyn9q84xz5q6v2fah29r7d71kmmx"))))
1474 (build-system python-build-system)
1476 `(#:python ,python-2))
1477 (home-page "https://github.com/abbbi/qmpbackup")
1478 (synopsis "Backup and restore QEMU machines")
1479 (description "qmpbackup is designed to create and restore full and
1480 incremental backups of running QEMU virtual machines via QMP, the QEMU
1482 (license license:gpl3+)))
1484 (define-public looking-glass-client
1485 (let ((commit "182c4752d57690da7f99d5e788de9b8baea33895"))
1487 (name "looking-glass-client")
1488 (version (string-append "a12-" (string-take commit 7)))
1492 (uri (git-reference (url "https://github.com/gnif/LookingGlass")
1494 (file-name (git-file-name name version))
1497 "02bq46ndmzq9cihazzn7xq1x7q5nzm7iw4l9lqzihxcxp9famkhw"))
1498 (modules '((guix build utils)))
1501 ;; Do not create binaries optimized for the CPU of the build machine,
1502 ;; for reproducibility and compatibility. TODO: in the next version
1503 ;; of looking glass, this is exposed as a CMake configure option.
1504 (substitute* "client/CMakeLists.txt"
1508 (build-system cmake-build-system)
1509 (inputs `(("fontconfig" ,fontconfig)
1512 ("openssl" ,openssl)
1514 ("sdl2-ttf" ,sdl2-ttf)
1515 ("spice-protocol" ,spice-protocol)
1516 ("wayland" ,wayland)))
1517 (native-inputs `(("libconfig" ,libconfig)
1519 ("pkg-config" ,pkg-config)))
1521 `(#:tests? #f ;; No tests are available.
1522 #:make-flags '("CC=gcc")
1523 #:phases (modify-phases %standard-phases
1524 (add-before 'configure 'chdir-to-client
1525 (lambda* (#:key outputs #:allow-other-keys)
1528 (add-after 'chdir-to-client 'add-missing-include
1530 ;; Mimic upstream commit b9797529893, required since the
1531 ;; update to Mesa 19.2.
1532 (substitute* "renderers/egl/shader.h"
1533 (("#include <stdbool\\.h>")
1534 "#include <stdbool.h>\n#include <stddef.h>"))
1537 (lambda* (#:key outputs #:allow-other-keys)
1538 (install-file "looking-glass-client"
1539 (string-append (assoc-ref outputs "out")
1542 (home-page "https://looking-glass.hostfission.com")
1543 (synopsis "KVM Frame Relay (KVMFR) implementation")
1544 (description "Looking Glass allows the use of a KVM (Kernel-based Virtual
1545 Machine) configured for VGA PCI Pass-through without an attached physical
1546 monitor, keyboard or mouse. It displays the VM's rendered contents on your main
1548 ;; This package requires SSE instructions.
1549 (supported-systems '("i686-linux" "x86_64-linux"))
1550 (license license:gpl2+))))
1555 (version "1.0.0-rc6")
1559 "https://github.com/opencontainers/runc/releases/"
1560 "download/v" version "/runc.tar.xz"))
1561 (file-name (string-append name "-" version ".tar.xz"))
1562 (patches (search-patches "runc-CVE-2019-5736.patch"))
1565 "1c7832dq70slkjh8qp2civ1wxhhdd2hrx84pq7db1mmqc9fdr3cc"))))
1566 (build-system go-build-system)
1568 '(#:import-path "github.com/opencontainers/runc"
1569 #:install-source? #f
1570 ;; XXX: 20/139 tests fail due to missing /var, cgroups and apparmor in
1571 ;; the build environment.
1574 (modify-phases %standard-phases
1576 (lambda* (#:key source import-path #:allow-other-keys)
1577 ;; Unpack the tarball into 'runc' instead of 'runc-1.0.0-rc5'.
1578 (let ((dest (string-append "src/" import-path)))
1580 (invoke "tar" "-C" (string-append "src/" import-path)
1581 "--strip-components=1"
1584 (lambda* (#:key import-path #:allow-other-keys)
1585 (with-directory-excursion (string-append "src/" import-path)
1586 ;; XXX: requires 'go-md2man'.
1587 ;; (invoke "make" "man")
1591 ;; (invoke "make" "localunittest")))
1593 (lambda* (#:key import-path outputs #:allow-other-keys)
1594 (with-directory-excursion (string-append "src/" import-path)
1595 (let ((out (assoc-ref outputs "out")))
1596 (invoke "make" "install" "install-bash"
1597 (string-append "PREFIX=" out)))))))))
1599 `(("pkg-config" ,pkg-config)))
1601 `(("libseccomp" ,libseccomp)))
1602 (synopsis "Open container initiative runtime")
1603 (home-page "https://www.opencontainers.org/")
1605 "@command{runc} is a command line client for running applications
1606 packaged according to the
1607 @uref{https://github.com/opencontainers/runtime-spec/blob/master/spec.md, Open
1608 Container Initiative (OCI) format} and is a compliant implementation of the
1609 Open Container Initiative specification.")
1610 (license license:asl2.0)))
1612 (define-public umoci
1620 "https://github.com/opencontainers/umoci/releases/download/v"
1621 version "/umoci.tar.xz"))
1622 (file-name (string-append "umoci-" version ".tar.xz"))
1624 (base32 "06q7xfwnqysc013hapx31jhlzmyg8qb467qfkynj673qc7p9bd6h"))))
1625 (build-system go-build-system)
1627 '(#:import-path "github.com/opencontainers/umoci"
1628 #:install-source? #f
1630 (modify-phases %standard-phases
1632 (lambda* (#:key source import-path #:allow-other-keys)
1633 ;; Unpack the tarball into 'umoci' instead of "runc-${version}".
1634 (let ((dest (string-append "src/" import-path)))
1636 (invoke "tar" "-C" (string-append "src/" import-path)
1637 "--strip-components=1"
1640 (lambda* (#:key import-path #:allow-other-keys)
1641 (with-directory-excursion (string-append "src/" import-path)
1642 ;; TODO: build manpages with 'go-md2man'.
1643 (invoke "make" "SHELL=bash"))))
1645 (lambda* (#:key import-path outputs #:allow-other-keys)
1646 (let* ((out (assoc-ref outputs "out"))
1647 (bindir (string-append out "/bin")))
1648 (install-file (string-append "src/" import-path "/umoci")
1651 (home-page "https://umo.ci/")
1652 (synopsis "Tool for modifying Open Container images")
1654 "@command{umoci} is a tool that allows for high-level modification of an
1655 Open Container Initiative (OCI) image layout and its tagged images.")
1656 (license license:asl2.0)))
1658 (define-public skopeo
1665 (url "https://github.com/containers/skopeo")
1666 (commit (string-append "v" version))))
1667 (file-name (git-file-name name version))
1670 "03sznybn3rqjyplc6w4b7mfa6gas8db15p5vnmfm1xqw72ldylgc"))))
1671 (build-system go-build-system)
1673 `(("pkg-config" ,pkg-config)
1674 ("go-github-com-go-md2man" ,go-github-com-go-md2man)))
1676 `(("btrfs-progs" ,btrfs-progs)
1678 ("libassuan" ,libassuan)
1679 ("libselinux" ,libselinux)
1680 ("libostree" ,libostree)
1685 '(#:import-path "github.com/containers/skopeo"
1686 #:install-source? #f
1687 #:tests? #f ; The tests require Docker
1689 (modify-phases %standard-phases
1691 (lambda* (#:key import-path #:allow-other-keys)
1692 (with-directory-excursion (string-append "src/" import-path)
1693 (invoke "make" "bin/skopeo"))))
1694 (add-after 'build 'build-docs
1695 (lambda* (#:key import-path #:allow-other-keys)
1696 (with-directory-excursion (string-append "src/" import-path)
1697 (invoke "make" "docs"))))
1699 (lambda* (#:key import-path outputs #:allow-other-keys)
1700 (with-directory-excursion (string-append "src/" import-path)
1701 (let ((out (assoc-ref outputs "out")))
1702 (install-file "default-policy.json"
1703 (string-append out "/etc/containers"))
1704 (invoke "make" "install-binary" "install-completions" "install-docs"
1705 (string-append "PREFIX=" out)))))))))
1706 (home-page "https://github.com/containers/skopeo")
1707 (synopsis "Interact with container images and container image registries")
1709 "@command{skopeo} is a command line utility providing various operations
1710 with container images and container image registries. It can:
1713 @item Copy container images between various containers image stores,
1714 converting them as necessary.
1716 @item Convert a Docker schema 2 or schema 1 container image to an OCI image.
1718 @item Inspect a repository on a container registry without needlessly pulling
1721 @item Sign and verify container images.
1723 @item Delete container images from a remote container registry.
1726 (license license:asl2.0)))
1728 (define-public python-vagrant
1730 (name "python-vagrant")
1735 (uri (pypi-uri "python-vagrant" version))
1738 "1ikrh6canhcxg5y7pzmkcnnydikppv7s6sm9prfx90nk0ac8m6mg"))))
1739 (build-system python-build-system)
1741 '(#:tests? #f)) ; tests involve running vagrant.
1742 (home-page "https://github.com/todddeluca/python-vagrant")
1743 (synopsis "Python bindings for Vagrant")
1745 "Python-vagrant is a Python module that provides a thin wrapper around the
1746 @code{vagrant} command line executable, allowing programmatic control of Vagrant
1748 (license license:expat)))
1750 (define-public bubblewrap
1756 (uri (string-append "https://github.com/containers/bubblewrap/"
1757 "releases/download/v" version "/bubblewrap-"
1761 "00ycgi6q2yngh06bnz50wkvar6r2jnjf3j158grhi9k13jdrpimr"))))
1762 (build-system gnu-build-system)
1765 (modify-phases %standard-phases
1766 (add-after 'unpack 'fix-test
1767 (lambda* (#:key outputs #:allow-other-keys)
1768 ;; Tests try to access /var/tmp, which is not possible in our build
1769 ;; environment. Let's give them another directory.
1770 ;; /tmp gets overriden in some tests, so we need another directory.
1771 ;; the only possibility is the output directory.
1772 (let ((tmp-dir (string-append (assoc-ref outputs "out") "/tmp")))
1774 (substitute* "tests/test-run.sh"
1775 (("/var/tmp") tmp-dir)
1776 ;; Tests create a temporary python script, so fix its shebang.
1777 (("/usr/bin/env python") (which "python"))
1778 ;; Some tests try to access /usr, but that doesn't exist.
1779 ;; Give them /gnu instead.
1781 (("--ro-bind /bin /bin") "--ro-bind /gnu /bin")
1782 (("--ro-bind /sbin /sbin") "--ro-bind /gnu /sbin")
1783 (("--ro-bind /lib /lib") "--ro-bind /gnu /lib")
1784 ((" */bin/bash") (which "bash"))
1785 (("/bin/sh") (which "sh"))
1786 (("findmnt") (which "findmnt"))))
1788 ;; Remove the directory we gave to tests to have a clean package.
1789 (add-after 'check 'remove-tmp-dir
1790 (lambda* (#:key outputs #:allow-other-keys)
1791 (delete-file-recursively (string-append (assoc-ref outputs "out") "/tmp"))
1794 `(("libcap" ,libcap)))
1796 `(("python" ,python-wrapper)
1797 ("util-linux" ,util-linux)))
1798 (home-page "https://github.com/containers/bubblewrap")
1799 (synopsis "Unprivileged sandboxing tool")
1800 (description "Bubblewrap is aimed at running applications in a sandbox,
1801 restricting their access to parts of the operating system or user data such as
1802 the home directory. Bubblewrap always creates a new mount namespace, and the
1803 user can specify exactly what parts of the file system should be made visible
1804 in the sandbox. These directories are mounted with the @code{nodev} option
1805 by default and can be made read-only.")
1806 (license license:lgpl2.0+)))
1808 (define-public bochs
1815 (uri (string-append "https://sourceforge.net/projects/bochs/files/bochs/"
1816 version "/bochs-" version ".tar.gz"))
1818 (base32 "0ql8q6y1k356li1g9gbvl21448mlxphxxi6kjb2b3pxvzd0pp2b3"))))
1819 (build-system gnu-build-system)
1821 `(#:tests? #f)) ; no tests exist
1823 `(("libxrandr" ,libxrandr)))
1824 (home-page "http://bochs.sourceforge.net/")
1825 (synopsis "Emulator for x86 PC")
1827 "Bochs is an emulator which can emulate Intel x86 CPU, common I/O
1828 devices, and a custom BIOS. It can also be compiled to emulate many different
1829 x86 CPUs, from early 386 to the most recent x86-64 Intel and AMD processors.
1830 Bochs can run most Operating Systems inside the emulation including Linux,
1831 DOS or Microsoft Windows.")
1832 (license license:lgpl2.0+)))
1841 (url "git://xenbits.xenproject.org/xen.git")
1842 (commit (string-append "RELEASE-" version))))
1843 (file-name (git-file-name name version))
1846 "1r90rvypw76ya9clqw5p02gm1k8hxz73f7gr95ca778nnzvb7xjw"))))
1847 (build-system gnu-build-system)
1850 (list "--enable-rpath"
1851 "--disable-qemu-traditional" ; It tries to do "git clone"
1852 "--disable-rombios" ; would try to "git clone" via etherboot.
1853 ;; TODO: Re-enable stubdom (it's "more secure" to use it).
1854 "--disable-stubdom" ; tries to "git clone" old patched newlib.
1855 (string-append "--with-initddir="
1856 (assoc-ref %outputs "out")
1858 (string-append "--with-system-qemu="
1859 (assoc-ref %build-inputs "qemu")
1860 "/bin/qemu-system-i386")
1861 (string-append "--with-system-seabios="
1862 (assoc-ref %build-inputs "seabios")
1863 "/share/firmware/bios.bin")
1864 (string-append "--with-system-ovmf="
1865 (assoc-ref %build-inputs "ovmf")
1866 "/share/firmware/ovmf_ia32.bin"))
1867 #:make-flags (list "-j" "1"
1868 "XEN_BUILD_DATE=Thu Jan 1 01:00:01 CET 1970"
1869 "XEN_BUILD_TIME=01:00:01"
1872 "SMBIOS_REL_DATE=01/01/1970"
1873 "VGABIOS_REL_DATE=01 Jan 1970"
1874 ; QEMU_TRADITIONAL_LOC
1876 "SYSCONFIG_DIR=/tmp/etc/default"
1877 (string-append "BASH_COMPLETION_DIR="
1878 (assoc-ref %outputs "out")
1879 "/etc/bash_completion.d")
1880 (string-append "BOOT_DIR="
1881 (assoc-ref %outputs "out")
1883 (string-append "DEBUG_DIR="
1884 (assoc-ref %outputs "out")
1886 (string-append "EFI_DIR="
1887 (assoc-ref %outputs "out")
1888 "/lib/efi") ; TODO lib64 ?
1889 "MINIOS_UPSTREAM_URL="
1890 ;(string-append "DISTDIR="
1891 ; (assoc-ref %outputs "out"))
1893 #:test-target "test"
1895 (modify-phases %standard-phases
1896 (add-after 'unpack 'unpack-mini-os
1897 (lambda* (#:key inputs #:allow-other-keys)
1898 (copy-recursively (assoc-ref inputs "mini-os") "extras/mini-os")
1900 (add-after 'unpack-mini-os 'patch
1901 (lambda* (#:key inputs outputs #:allow-other-keys)
1902 (substitute* "tools/firmware/Rules.mk"
1903 (("override XEN_TARGET_ARCH = x86_32")
1904 (string-append "override XEN_TARGET_ARCH = x86_32
1905 override CC = " (assoc-ref inputs "cross-gcc") "/bin/i686-linux-gnu-gcc"))
1907 (string-append "CFLAGS=-I" (assoc-ref inputs "cross-libc")
1909 (substitute* "config/x86_32.mk"
1910 (("CFLAGS += -m32 -march=i686")
1911 (string-append "CFLAGS += -march=i686 -I"
1912 (assoc-ref inputs "cross-libc")
1914 ;; /var is not in /gnu/store , so don't try to create it.
1915 (substitute* '("tools/Makefile"
1916 "tools/xenstore/Makefile"
1917 "tools/xenpaging/Makefile")
1918 (("\\$\\(INSTALL_DIR\\) .*XEN_(DUMP|LOG|RUN|LIB|PAGING)_DIR.*")
1920 (("\\$\\(INSTALL_DIR\\) .*XEN_(RUN|LIB)_STORED.*")
1922 ;; Prevent xen from creating /etc .
1923 (substitute* "tools/examples/Makefile"
1924 ((" install-readmes") "")
1925 ((" install-configs") ""))
1927 (substitute* "tools/pygrub/setup.py"
1929 ; TODO: extra_link_args = ['-Wl,-rpath=/opt/foo'],
1930 (string-append "runtime_library_dirs = ['"
1931 (assoc-ref outputs "out")
1932 "/lib'],\nlibrary_dirs =")))
1934 (add-before 'configure 'patch-xen-script-directory
1935 (lambda* (#:key outputs #:allow-other-keys)
1936 (substitute* '("configure"
1939 (("XEN_SCRIPT_DIR=.*")
1940 (string-append "XEN_SCRIPT_DIR="
1941 (assoc-ref outputs "out")
1942 "/etc/xen/scripts")))
1944 (add-before 'configure 'set-environment-up
1945 (lambda* (#:key make-flags #:allow-other-keys)
1947 (string-contains x "cross-i686-linux"))
1948 (define (filter-environment! filter-predicate
1949 environment-variable-names)
1952 (let* ((env-value (getenv env-name))
1953 (search-path (search-path-as-string->list env-value))
1954 (new-search-path (filter filter-predicate
1956 (new-env-value (list->search-path-as-string
1957 new-search-path ":")))
1958 (setenv env-name new-env-value)))
1959 environment-variable-names))
1960 (setenv "CROSS_C_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
1961 (setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
1962 (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
1963 (filter-environment! cross?
1964 '("CROSS_C_INCLUDE_PATH" "CROSS_CPLUS_INCLUDE_PATH"
1965 "CROSS_LIBRARY_PATH"))
1966 (filter-environment! (lambda (e) (not (cross? e)))
1967 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
1969 ;; Guix tries to be helpful and automatically adds
1970 ;; mini-os-git-checkout/include to the include path,
1971 ;; but actually we don't want it to be there (yet).
1972 (filter-environment! (lambda (e)
1975 "mini-os-git-checkout")))
1976 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
1978 (setenv "EFI_VENDOR" "guix")
1981 (lambda* (#:key make-flags #:allow-other-keys)
1982 (apply invoke "make" "world" make-flags))))))
1984 `(("acpica" ,acpica) ; TODO: patch iasl invocation.
1985 ("bridge-utils" ,bridge-utils) ; TODO: patch invocations.
1987 ("iproute" ,iproute) ; TODO: patch invocations.
1990 ("libyajl" ,libyajl)
1991 ("ncurses" ,ncurses)
1992 ("openssl" ,openssl)
1995 ("qemu" ,qemu-minimal)
1996 ("seabios" ,seabios)
1997 ("util-linux" ,util-linux "lib") ; uuid
1998 ; TODO: ocaml-findlib, ocaml-nox.
1999 ("xz" ,xz) ; for liblzma
2004 ("cmake" ,cmake-minimal)
2007 ("gettext" ,gettext-minimal)
2013 (url "http://xenbits.xen.org/git-http/mini-os.git")
2014 (commit (string-append "xen-RELEASE-" version))))
2017 "1i8pcl19n60i2m9vlg79q3nknpj209c9ic5x10wxaicx45kc107f"))
2018 (file-name "mini-os-git-checkout")))
2021 ("pkg-config" ,pkg-config)
2022 ("python" ,python-2)
2024 ("cross-gcc" ,(cross-gcc "i686-linux-gnu"
2025 #:xbinutils (cross-binutils "i686-linux-gnu")
2026 #:libc (cross-libc "i686-linux-gnu")))
2027 ("cross-libc" ,(cross-libc "i686-linux-gnu")) ; header files
2028 ("cross-libc-static" ,(cross-libc "i686-linux-gnu") "static")))
2029 (home-page "https://xenproject.org/")
2030 (synopsis "Xen Virtual Machine Monitor")
2031 (description "This package provides the Xen Virtual Machine Monitor
2032 which is a hypervisor.")
2033 ;; TODO: Some files are licensed differently. List those.
2034 (license license:gpl2)
2035 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))))
2037 (define-public osinfo-db-tools
2039 (name "osinfo-db-tools")
2043 (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-tools-"
2048 "038q3gzdbkfkhpicj0755mw1q4gbvn57pslpw8n2dp3lds9im0g9"))))
2049 (build-system meson-build-system)
2051 `(("libsoup" ,libsoup)
2052 ("libxml2" ,libxml2)
2053 ("libxslt" ,libxslt)
2054 ("json-glib" ,json-glib)
2055 ("libarchive" ,libarchive)))
2058 ("gobject-introspection" ,gobject-introspection)
2059 ("gettext" ,gettext-minimal)
2060 ("pkg-config" ,pkg-config)
2063 ("pytest" ,python-pytest)
2064 ("requests" ,python-requests)))
2065 (home-page "https://gitlab.com/libosinfo/osinfo-db-tools")
2066 (synopsis "Tools for managing the osinfo database")
2067 (description "This package contains a set of tools to assist
2068 administrators and developers in managing the database.")
2069 (license license:lgpl2.0+)))
2071 (define-public osinfo-db
2074 (version "20201218")
2077 (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-"
2081 "0ydbindwgw7kg861rqii5036gq0dbbbmv35dzrmmv937ddfsxwh0"))))
2082 (build-system trivial-build-system)
2084 `(#:modules ((guix build utils))
2087 (use-modules (guix build utils))
2088 (let* ((out (assoc-ref %outputs "out"))
2089 (osinfo-dir (string-append out "/share/osinfo"))
2090 (source (assoc-ref %build-inputs "source"))
2092 (string-append (assoc-ref %build-inputs "osinfo-db-tools")
2093 "/bin/osinfo-db-import")))
2094 (mkdir-p osinfo-dir)
2095 (invoke osinfo-db-import "--dir" osinfo-dir source)
2098 `(("intltool" ,intltool)
2099 ("osinfo-db-tools" ,osinfo-db-tools)))
2100 (home-page "https://gitlab.com/libosinfo/osinfo-db")
2101 (synopsis "Database of information about operating systems")
2102 (description "Osinfo-db provides the database files for use with the
2103 libosinfo library. It provides information about guest operating systems for
2104 use with virtualization provisioning tools")
2105 (license license:lgpl2.0+)))
2107 (define-public python-transient
2109 (name "python-transient")
2114 (uri (pypi-uri "transient" version))
2117 "148yiqrmcscsi6787y0f27i1y9cf0gcw3mqfv5frhpmsmv62mv5z"))))
2118 (build-system python-build-system)
2120 `(#:tests? #f ; Requires behave
2121 #:phases (modify-phases %standard-phases
2122 (add-after 'unpack 'fix-dependencies
2124 (substitute* "setup.py"
2129 `(("python-beautifultable" ,python-beautifultable)
2130 ("python-click" ,python-click)
2131 ("python-importlib-resources"
2132 ,python-importlib-resources)
2133 ("python-lark-parser" ,python-lark-parser)
2134 ("python-marshmallow" ,python-marshmallow)
2135 ("python-progressbar2" ,python-progressbar2)
2136 ("python-requests" ,python-requests)
2137 ("python-toml" ,python-toml)))
2139 `(("python-black" ,python-black)
2140 ("python-mypy" ,python-mypy)
2141 ("python-pyhamcrest" ,python-pyhamcrest)
2142 ("python-twine" ,python-twine)))
2144 "https://github.com/ALSchwalm/transient")
2146 "QEMU Wrapper written in Python")
2148 "@code{transient} is a wrapper for QEMU allowing the creation of virtual
2149 machines with shared folder, ssh, and disk creation support.")
2150 (license license:expat)))