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