1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015, 2016, 2017, 2018 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2016, 2017, 2018. 2019, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2016, 2017 Ricardo Wurmus <rekado@elephly.net>
6 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
7 ;;; Copyright © 2017 Andy Patterson <ajpatter@uwaterloo.ca>
8 ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
9 ;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
10 ;;; Copyright © 2018 Danny Milosavljevic <dannym@scratchpost.org>
11 ;;; Copyright © 2018 Sou Bunnbu <iyzsong@member.fsf.org>
12 ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
13 ;;; Copyright © 2019 Guy Fleury Iteriteka <hoonandon@gmail.com>
14 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
15 ;;; Copyright © 2020, 2021 Brice Waegeneire <brice@waegenei.re>
16 ;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
17 ;;; Copyright © 2020, 2021 Marius Bakke <mbakke@fastmail.com>
18 ;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
19 ;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
20 ;;; Copyright © 2021 Leo Famulari <leo@famulari.name>
21 ;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
22 ;;; Copyright © 2021 Dion Mendel <guix@dm9.info>
23 ;;; Copyright © 2021 Andrew Whatson <whatson@gmail.com>
24 ;;; Copyright © 2021 Vincent Legoll <vincent.legoll@gmail.com>
25 ;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
26 ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
27 ;;; Copyright © 2022 Oleg Pykhalov <go.wigust@gmail.com>
28 ;;; Copyright © 2022 Ekaitz Zarraga <ekaitz@elenq.tech>
29 ;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net>
31 ;;; This file is part of GNU Guix.
33 ;;; GNU Guix is free software; you can redistribute it and/or modify it
34 ;;; under the terms of the GNU General Public License as published by
35 ;;; the Free Software Foundation; either version 3 of the License, or (at
36 ;;; your option) any later version.
38 ;;; GNU Guix is distributed in the hope that it will be useful, but
39 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
40 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41 ;;; GNU General Public License for more details.
43 ;;; You should have received a copy of the GNU General Public License
44 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
46 (define-module (gnu packages virtualization)
47 #:use-module (gnu packages)
48 #:use-module (gnu packages acl)
49 #:use-module (gnu packages admin)
50 #:use-module (gnu packages assembly)
51 #:use-module (gnu packages attr)
52 #:use-module (gnu packages autotools)
53 #:use-module (gnu packages backup)
54 #:use-module (gnu packages base)
55 #:use-module (gnu packages bash)
56 #:use-module (gnu packages bison)
57 #:use-module (gnu packages bootloaders)
58 #:use-module (gnu packages build-tools)
59 #:use-module (gnu packages check)
60 #:use-module (gnu packages cluster)
61 #:use-module (gnu packages cmake)
62 #:use-module (gnu packages compression)
63 #:use-module (gnu packages cross-base)
64 #:use-module (gnu packages curl)
65 #:use-module (gnu packages cyrus-sasl)
66 #:use-module (gnu packages debian)
67 #:use-module (gnu packages disk)
68 #:use-module (gnu packages dns)
69 #:use-module (gnu packages docbook)
70 #:use-module (gnu packages documentation)
71 #:use-module (gnu packages figlet)
72 #:use-module (gnu packages firmware)
73 #:use-module (gnu packages flex)
74 #:use-module (gnu packages fontutils)
75 #:use-module (gnu packages freedesktop)
76 #:use-module (gnu packages gettext)
77 #:use-module (gnu packages gcc)
78 #:use-module (gnu packages gl)
79 #:use-module (gnu packages glib)
80 #:use-module (gnu packages gnome)
81 #:use-module (gnu packages gnupg)
82 #:use-module (gnu packages golang)
83 #:use-module (gnu packages graphviz)
84 #:use-module (gnu packages gtk)
85 #:use-module (gnu packages haskell)
86 #:use-module (gnu packages haskell-apps)
87 #:use-module (gnu packages haskell-check)
88 #:use-module (gnu packages haskell-crypto)
89 #:use-module (gnu packages haskell-web)
90 #:use-module (gnu packages haskell-xyz)
91 #:use-module (gnu packages image)
92 #:use-module (gnu packages libbsd)
93 #:use-module (gnu packages libusb)
94 #:use-module (gnu packages linux)
95 #:use-module (gnu packages m4)
96 #:use-module (gnu packages multiprecision)
97 #:use-module (gnu packages ncurses)
98 #:use-module (gnu packages nettle)
99 #:use-module (gnu packages networking)
100 #:use-module (gnu packages ninja)
101 #:use-module (gnu packages onc-rpc)
102 #:use-module (gnu packages package-management)
103 #:use-module (gnu packages pciutils)
104 #:use-module (gnu packages pcre)
105 #:use-module (gnu packages perl)
106 #:use-module (gnu packages pkg-config)
107 #:use-module (gnu packages polkit)
108 #:use-module (gnu packages protobuf)
109 #:use-module (gnu packages python)
110 #:use-module (gnu packages python-build)
111 #:use-module (gnu packages python-check)
112 #:use-module (gnu packages python-crypto)
113 #:use-module (gnu packages python-web)
114 #:use-module (gnu packages python-xyz)
115 #:use-module (gnu packages pulseaudio)
116 #:use-module (gnu packages readline)
117 #:use-module (gnu packages rsync)
118 #:use-module (gnu packages selinux)
119 #:use-module (gnu packages sdl)
120 #:use-module (gnu packages sphinx)
121 #:use-module (gnu packages spice)
122 #:use-module (gnu packages ssh)
123 #:use-module (gnu packages texinfo)
124 #:use-module (gnu packages textutils)
125 #:use-module (gnu packages tls)
126 #:use-module (gnu packages web)
127 #:use-module (gnu packages wget)
128 #:use-module (gnu packages xdisorg)
129 #:use-module (gnu packages xml)
130 #:use-module (gnu packages xorg)
131 #:use-module (guix build-system cmake)
132 #:use-module (guix build-system gnu)
133 #:use-module (guix build-system go)
134 #:use-module (guix build-system meson)
135 #:use-module (guix build-system python)
136 #:use-module (guix build-system trivial)
137 #:use-module (guix download)
138 #:use-module (guix git-download)
139 #:use-module (guix gexp)
140 #:use-module ((guix licenses) #:prefix license:)
141 #:use-module (guix packages)
142 #:use-module (guix utils)
143 #:use-module (srfi srfi-1)
144 #:use-module (srfi srfi-26)
145 #:use-module (ice-9 match))
147 (define (qemu-patch commit file-name sha256-bv)
148 "Return an origin for COMMIT."
152 "http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h="
154 (hash (content-hash sha256-bv sha256))
155 (file-name file-name)))
164 (uri (string-append "https://download.qemu.org/qemu-"
168 "0iavlsy9hin8k38230j8lfmyipx3965zljls1dp34mmc8n75vqb8"))
169 (patches (search-patches "qemu-build-info-manual.patch"
170 "qemu-fix-agent-paths.patch"))
171 (modules '((guix build utils)))
174 ;; Delete the bundled meson copy.
175 (delete-file-recursively "meson")))))
176 (outputs '("out" "static" "doc")) ;5.3 MiB of HTML docs
177 (build-system gnu-build-system)
179 ;; FIXME: Disable tests on i686 to work around
180 ;; <https://bugs.gnu.org/40527>.
181 `(#:tests? ,(or (%current-target-system)
182 (not (string=? "i686-linux" (%current-system))))
184 (let ((gcc (search-input-file %build-inputs "/bin/gcc"))
185 (out (assoc-ref %outputs "out")))
186 (list (string-append "--cc=" gcc)
187 ;; Some architectures insist on using HOST_CC.
188 (string-append "--host-cc=" gcc)
189 (string-append "--prefix=" out)
191 (string-append "--smbd=" out "/libexec/samba-wrapper")
192 "--disable-debug-info" ;for space considerations
193 ;; The binaries need to be linked against -lrt.
194 (string-append "--extra-ldflags=-lrt")))
195 ;; Make build and test output verbose to facilitate investigation upon failure.
196 #:make-flags '("V=1")
197 #:modules ((srfi srfi-1)
201 ,@%gnu-build-system-modules)
203 (modify-phases %standard-phases
204 (add-after 'unpack 'extend-test-time-outs
206 ;; These tests can time out on heavily-loaded and/or slow storage.
207 (substitute* (cons* "tests/qemu-iotests/common.qemu"
208 (find-files "tests/qemu-iotests" "^[0-9]+$"))
209 (("QEMU_COMM_TIMEOUT=[0-9]+" match)
210 (string-append match "9")))))
211 (add-after 'unpack 'disable-unusable-tests
213 (substitute* "tests/unit/meson.build"
214 ;; Comment out the test-qga test, which needs /sys and
215 ;; fails within the build environment.
216 (("tests.*test-qga.*$" all)
217 (string-append "# " all))
218 ;; Comment out the test-char test, which needs networking and
219 ;; fails within the build environment.
220 ((".*'test-char':.*" all)
221 (string-append "# " all)))))
222 ,@(if (target-riscv64?)
223 `((add-after 'unpack 'disable-some-tests
225 ;; qemu.qmp.QMPConnectError: Unexpected empty reply from server
226 (delete-file "tests/qemu-iotests/040")
227 (delete-file "tests/qemu-iotests/041")
228 (delete-file "tests/qemu-iotests/256")
230 ;; No 'PCI' bus found for device 'virtio-scsi-pci'
231 (delete-file "tests/qemu-iotests/127")
232 (delete-file "tests/qemu-iotests/267"))))
234 (add-after 'patch-source-shebangs 'patch-embedded-shebangs
235 (lambda* (#:key native-inputs inputs #:allow-other-keys)
236 ;; Ensure the executables created by these source files reference
237 ;; /bin/sh from the store so they work inside the build container.
238 (substitute* '("block/cloop.c" "migration/exec.c"
239 "net/tap.c" "tests/qtest/libqtest.c"
240 "tests/qtest/vhost-user-blk-test.c")
241 (("/bin/sh") (search-input-file inputs "/bin/sh")))
242 (substitute* "tests/qemu-iotests/testenv.py"
243 (("#!/usr/bin/env python3")
244 (string-append "#!" (search-input-file (or native-inputs inputs)
246 (add-before 'configure 'fix-optionrom-makefile
248 ;; Work around the inability of the rules defined in this
249 ;; Makefile to locate the firmware files (e.g.: No rule to make
250 ;; target 'multiboot.bin') by extending the VPATH.
251 (substitute* "pc-bios/optionrom/Makefile"
252 (("^VPATH = \\$\\(SRC_DIR\\)")
253 "VPATH = $(SRC_DIR):$(TOPSRC_DIR)/pc-bios"))))
254 ;; XXX ./configure is being re-run at beginning of build phase...
256 (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
257 ;; The `configure' script doesn't understand some of the
258 ;; GNU options. Thus, add a new phase that's compatible.
259 (let ((out (assoc-ref outputs "out")))
260 (setenv "SHELL" (which "bash"))
261 ;; Ensure config.status gets the correct shebang off the bat.
262 ;; The build system gets confused if we change it later and
263 ;; attempts to re-run the whole configuration, and fails.
264 (substitute* "configure"
266 (string-append "#!" (which "sh"))))
269 (apply invoke "../../configure" configure-flags))))
270 ;; Configure, build and install QEMU user-emulation static binaries.
271 (add-after 'configure 'configure-user-static
272 (lambda* (#:key inputs outputs #:allow-other-keys)
273 (let* ((gcc (search-input-file inputs "/bin/gcc"))
274 (static (assoc-ref outputs "static"))
275 ;; This is the common set of configure flags; it is
276 ;; duplicated here to isolate this phase from manipulations
277 ;; to the #:configure-flags build argument, as done in
278 ;; derived packages such as qemu-minimal.
279 (configure-flags (list (string-append "--cc=" gcc)
280 (string-append "--host-cc=" gcc)
282 "--disable-debug-info")))
283 (mkdir-p "../user-static")
284 (with-directory-excursion "../user-static"
285 (apply invoke "../../configure"
287 "--disable-docs" ;already built
289 "--enable-linux-user"
290 (string-append "--prefix=" static)
292 (add-after 'build 'build-user-static
294 (with-directory-excursion "../user-static"
295 (apply (assoc-ref %standard-phases 'build) args))))
296 (add-after 'install 'install-user-static
297 (lambda* (#:key outputs #:allow-other-keys)
298 (let* ((static (assoc-ref outputs "static"))
299 (bin (string-append static "/bin")))
300 (with-directory-excursion "../user-static"
301 (for-each (cut install-file <> bin)
302 (append-map (cut find-files <> "^qemu-" #:stat stat)
305 "-linux-user" <>))))))))
306 ;; Create a wrapper for Samba. This allows QEMU to use Samba without
307 ;; pulling it in as an input. Note that you need to explicitly install
308 ;; Samba in your Guix profile for Samba support.
309 (add-after 'install 'create-samba-wrapper
310 (lambda* (#:key inputs outputs #:allow-other-keys)
311 (let* ((out (assoc-ref outputs "out"))
312 (libexec (string-append out "/libexec")))
313 (call-with-output-file "samba-wrapper"
315 (format port "#!/bin/sh
317 (chmod "samba-wrapper" #o755)
318 (install-file "samba-wrapper" libexec))))
319 (add-after 'install 'move-html-doc
320 (lambda* (#:key inputs outputs #:allow-other-keys)
321 (let* ((out (assoc-ref outputs "out"))
322 (doc (assoc-ref outputs "doc"))
323 (qemu-doc (string-append doc "/share/doc/qemu-" ,version)))
325 (rename-file (string-append out "/share/doc/qemu")
326 (string-append qemu-doc "/html"))))))))
333 libcacard ;smartcard support
334 attr libcap-ng ;VirtFS support
341 libusb ;USB pass-through support
344 ;; ("pciutils" ,pciutils)
354 ;; Formats to support for .qcow2 (and possibly other) compression.
358 (list gettext-minimal
359 `(,glib "bin") ;gtester, etc.
368 python-sphinx-rtd-theme
370 ;; The following static libraries are required to build
371 ;; the static output of QEMU.
375 (home-page "https://www.qemu.org")
376 (synopsis "Machine emulator and virtualizer")
378 "QEMU is a generic machine emulator and virtualizer.
380 When used as a machine emulator, QEMU can run OSes and programs made for one
381 machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
382 using dynamic translation, it achieves very good performance.
384 When used as a virtualizer, QEMU achieves near native performances by
385 executing the guest code directly on the host CPU. QEMU supports
386 virtualization when executing under the Xen hypervisor or using
387 the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
388 server and embedded PowerPC, and S390 guests.")
390 ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
391 (license license:gpl2)
393 ;; Several tests fail on MIPS; see <http://hydra.gnu.org/build/117914>.
394 (supported-systems (fold delete %supported-systems
395 '("mips64el-linux" "i586-gnu")))))
397 (define-public qemu-minimal
398 ;; QEMU without GUI support, only supporting the host's architecture
401 (name "qemu-minimal")
402 (outputs '("out" "doc"))
404 "Machine emulator and virtualizer (without GUI) for the host architecture")
406 (substitute-keyword-arguments (package-arguments qemu)
407 ((#:configure-flags configure-flags '(list))
408 ;; Restrict to the host's architecture.
409 (let* ((system (or (%current-target-system)
413 ((? (cut string-prefix? "i686" <>))
414 "--target-list=i386-softmmu")
415 ((? (cut string-prefix? "x86_64" <>))
416 "--target-list=i386-softmmu,x86_64-softmmu")
417 ((? (cut string-prefix? "mips64" <>))
418 (string-append "--target-list=mips-softmmu,mipsel-softmmu,"
419 "mips64-softmmu,mips64el-softmmu"))
420 ((? (cut string-prefix? "mips" <>))
421 "--target-list=mips-softmmu,mipsel-softmmu")
422 ((? (cut string-prefix? "aarch64" <>))
423 "--target-list=arm-softmmu,aarch64-softmmu")
424 ((? (cut string-prefix? "arm" <>))
425 "--target-list=arm-softmmu")
426 ((? (cut string-prefix? "alpha" <>))
427 "--target-list=alpha-softmmu")
428 ((? (cut string-prefix? "powerpc64" <>))
429 "--target-list=ppc-softmmu,ppc64-softmmu")
430 ((? (cut string-prefix? "powerpc" <>))
431 "--target-list=ppc-softmmu")
432 ((? (cut string-prefix? "s390" <>))
433 "--target-list=s390x-softmmu")
434 ((? (cut string-prefix? "riscv" <>))
435 "--target-list=riscv32-softmmu,riscv64-softmmu")
436 (else ; An empty list actually builds all the targets.
438 `(cons ,target-list-arg ,configure-flags)))
440 `(modify-phases ,phases
441 (delete 'configure-user-static)
442 (delete 'build-user-static)
443 (delete 'install-user-static)))))
445 ;; Remove dependencies on optional libraries, notably GUI libraries.
446 (native-inputs (filter (lambda (input)
448 ;; Work around the fact that modify-inputs can not
449 ;; delete specific outputs; i.e. here we should keep
450 ;; `(,glib "bin"), but not `(,glib "static").
451 ((label package output)
452 (not (string=? "static" output)))
454 (modify-inputs (package-native-inputs qemu)
455 (delete "gettext-minimal"))))
456 (inputs (modify-inputs (package-inputs qemu)
470 (define (system->qemu-target system)
472 ((string-prefix? "i686" system)
474 ((string-prefix? "arm" system)
477 (string-append "qemu-system-" (match (string-split system #\-)
481 (define-public libx86emu
485 (home-page "https://github.com/wfeldt/libx86emu")
493 (file-name (git-file-name name version))
495 (base32 "11nj3y7maz9ch15b1c2b69gd8d7mpaha377zpdbvfsmg5w9zz93l"))
497 '((guix build utils)))
500 ;; Remove git2log program file.
501 (delete-file "git2log")
502 ;; Remove variables that depends on git2log.
503 (substitute* "Makefile"
504 (("GIT2LOG.*=.*$") "")
505 (("GITDEPS.*=.*$") "")
506 (("BRANCH.*=.*$") ""))))))
507 (build-system gnu-build-system)
509 `(#:test-target "test"
511 (modify-phases %standard-phases
512 (add-after 'unpack 'patch
513 (lambda* (#:key outputs #:allow-other-keys)
514 (let* ((out (assoc-ref outputs "out"))
515 (include (string-append out "/include"))
516 (lib (string-append out "/lib")))
517 ;; Correct the values of version and install directories.
518 (substitute* "Makefile"
520 (string-append "VERSION := "
523 (string-append "PREFIX := " out "\n"))
524 (("MAJOR_VERSION.*=.*$")
525 (string-append "MAJOR_VERSION := "
526 ,(version-major version) "\n"))
528 (string-append "LIBDIR = " lib "\n"))
529 (("/usr/include") include)))))
530 (delete 'configure)))) ; no configure script
533 (synopsis "Library for x86 emulation")
534 (description "Libx86emu is a small library to emulate x86 instructions. The
535 focus here is not a complete emulation but to cover enough for typical
536 firmware blobs. You can
538 @item intercept any memory access or directly map real memory ranges
539 @item intercept any i/o access, map real i/o ports, or block any real i/o
540 @item intercept any interrupt
541 @item add a hook to run after each instruction
542 @item recognize a special x86 instruction that can trigger logging
543 @item use integrated logging
545 (license (license:x11-style "file://LICENSE"))))
547 (define-public ganeti
554 (url "https://github.com/ganeti/ganeti")
555 (commit (string-append "v" version))))
557 (base32 "1i7gx0sdx9316fnldbv738s0ihym1370nhc1chk0biandkl8vvq0"))
558 (file-name (git-file-name name version))
559 (patches (search-patches "ganeti-shepherd-support.patch"
560 "ganeti-shepherd-master-failover.patch"
561 "ganeti-sphinx-compat.patch"
562 "ganeti-haskell-compat.patch"
563 "ganeti-haskell-pythondir.patch"
564 "ganeti-disable-version-symlinks.patch"))))
565 (build-system gnu-build-system)
567 `(#:imported-modules (,@%gnu-build-system-modules
568 (guix build haskell-build-system)
569 (guix build python-build-system))
570 #:modules (,@%gnu-build-system-modules
571 ((guix build haskell-build-system) #:prefix haskell:)
572 ((guix build python-build-system) #:select (site-packages))
578 ;; The default test target includes a lot of checks that are only really
579 ;; relevant for developers such as NEWS file checking, line lengths, etc.
580 ;; We are only interested in the "py-tests" and "hs-tests" targets: this
581 ;; is the closest we've got even though it includes a little more.
582 #:test-target "check-TESTS"
585 (list "--localstatedir=/var"
586 "--sharedstatedir=/var"
588 "--enable-haskell-tests"
590 ;; By default, the build system installs everything to versioned
591 ;; directories such as $libdir/3.0 and relies on a $libdir/default
592 ;; symlink pointed from /etc/ganeti/{lib,share} to actually function.
593 ;; This is done to accommodate installing multiple versions in
594 ;; parallel, but is of little use to us as Guix users can just
595 ;; roll back and forth. Thus, disable it for simplicity.
596 "--disable-version-links"
598 ;; Ganeti can optionally take control over SSH host keys and
599 ;; distribute them to nodes as they are added, and also rotate keys
600 ;; with 'gnt-cluster renew-crypto --new-ssh-keys'. Thus it needs to
601 ;; know how to restart the SSH daemon.
602 "--with-sshd-restart-command='herd restart ssh-daemon'"
604 ;; Look for OS definitions in this directory by default. It can
605 ;; be changed in the cluster configuration.
606 "--with-os-search-path=/run/current-system/profile/share/ganeti/os"
608 ;; The default QEMU executable to use. We don't use the package
609 ;; here because this entry is stored in the cluster configuration.
610 (string-append "--with-kvm-path=/run/current-system/profile/bin/"
611 ,(system->qemu-target (%current-system))))
613 (modify-phases %standard-phases
614 (add-after 'unpack 'patch-version-constraints
616 ;; Loosen version constraints for compatibility with Stackage 18.10.
617 (substitute* "cabal/ganeti.template.cabal"
618 (("(.*base64-bytestring.*) < 1\\.1" _ match)
619 (string-append match " < 1.2"))
620 (("(.*QuickCheck.*) < 2\\.14" _ match)
621 (string-append match " < 2.15")))))
622 (add-after 'unpack 'pyparsing-compat
624 ;; Adjust for Pyparsing 3.0. Remove for Ganeti 3.0.2+.
625 (substitute* "lib/qlang.py"
626 (("operatorPrecedence")
628 (add-after 'unpack 'create-vcs-version
630 ;; If we are building from a git checkout, we need to create a
631 ;; 'vcs-version' file manually because the build system does
632 ;; not have access to the git repository information.
633 (unless (file-exists? "vcs-version")
634 (call-with-output-file "vcs-version"
636 (format port "v~a~%" ,version))))))
637 (add-after 'unpack 'patch-absolute-file-names
638 (lambda* (#:key inputs #:allow-other-keys)
639 (substitute* '("lib/utils/process.py"
641 "src/Ganeti/Constants.hs"
642 "src/Ganeti/HTools/CLI.hs"
643 "test/py/ganeti.config_unittest.py"
644 "test/py/ganeti.hooks_unittest.py"
645 "test/py/ganeti.utils.process_unittest.py"
646 "test/py/ganeti.utils.text_unittest.py"
647 "test/py/ganeti.utils.wrapper_unittest.py")
648 (("/bin/sh") (search-input-file inputs "/bin/sh"))
649 (("/bin/bash") (search-input-file inputs "/bin/bash"))
650 (("/usr/bin/env") (search-input-file inputs "/bin/env"))
651 (("/bin/true") (search-input-file inputs "/bin/true")))
653 ;; This script is called by the node daemon at startup to perform
654 ;; sanity checks on the cluster IP addresses, and it is also used
655 ;; in a master-failover scenario. Add absolute references to
656 ;; avoid propagating these executables.
657 (substitute* "tools/master-ip-setup"
658 (("arping") (search-input-file inputs "/bin/arping"))
659 (("ndisc6") (search-input-file inputs "/bin/ndisc6"))
660 (("fping") (search-input-file inputs "/sbin/fping"))
661 (("grep") (search-input-file inputs "/bin/grep"))
662 (("ip addr") (string-append (search-input-file inputs "/sbin/ip")
664 (add-after 'unpack 'override-builtin-PATH
666 ;; Ganeti runs OS install scripts and similar with a built-in
667 ;; hard coded PATH. Patch so it works on Guix System.
668 (substitute* "src/Ganeti/Constants.hs"
669 (("/sbin:/bin:/usr/sbin:/usr/bin")
670 "/run/setuid-programs:/run/current-system/profile/sbin:\
671 /run/current-system/profile/bin"))))
672 (add-after 'bootstrap 'patch-sphinx-version-detection
674 ;; The build system runs 'sphinx-build --version' to verify that
675 ;; the Sphinx is recent enough, but does not expect the
676 ;; .sphinx-build-real executable name created by the Sphinx wrapper.
677 (substitute* "configure"
678 (("\\$SPHINX --version 2>&1")
679 "$SPHINX --version 2>&1 \
680 | sed 's/.sphinx-build-real/sphinx-build/g'"))))
682 ;; The build system invokes Cabal and GHC, which do not work with
683 ;; GHC_PACKAGE_PATH: <https://github.com/haskell/cabal/issues/3728>.
684 ;; Tweak the build system to do roughly what haskell-build-system does.
685 (add-before 'configure 'configure-haskell
686 (assoc-ref haskell:%standard-phases 'setup-compiler))
687 (add-after 'configure 'do-not-use-GHC_PACKAGE_PATH
689 (unsetenv "GHC_PACKAGE_PATH")
690 (substitute* "Makefile"
692 "$(CABAL) --package-db=../package.conf.d")
694 "$(GHC) -package-db=../package.conf.d"))))
695 (add-after 'configure 'make-ghc-use-shared-libraries
697 (substitute* "Makefile"
698 (("HFLAGS =") "HFLAGS = -dynamic -fPIC"))))
699 (add-after 'configure 'fix-installation-directories
701 (substitute* "Makefile"
702 ;; Do not attempt to create /var during install.
703 (("\\$\\(DESTDIR\\)\\$\\{localstatedir\\}")
704 "$(DESTDIR)${prefix}${localstatedir}")
705 ;; Similarly, do not attempt to install the sample ifup scripts
707 (("\\$\\(DESTDIR\\)\\$\\(ifupdir\\)")
708 "$(DESTDIR)${prefix}$(ifupdir)"))))
709 (add-before 'build 'adjust-tests
711 ;; Disable tests that can not run. Do it early to prevent
712 ;; touching the Makefile later and triggering a needless rebuild.
713 (substitute* "Makefile"
714 ;; These tests expect the presence of a 'root' user (via
715 ;; ganeti/runtime.py), which fails in the build environment.
716 (("test/py/ganeti\\.asyncnotifier_unittest\\.py") "")
717 (("test/py/ganeti\\.backend_unittest\\.py") "")
718 (("test/py/ganeti\\.daemon_unittest\\.py") "")
719 (("test/py/ganeti\\.tools\\.ensure_dirs_unittest\\.py") "")
720 (("test/py/ganeti\\.utils\\.io_unittest-runasroot\\.py") "")
721 ;; Disable the bash_completion test, as it requires the full
722 ;; bash instead of bash-minimal.
723 (("test/py/bash_completion\\.bash")
725 ;; This test requires networking.
726 (("test/py/import-export_unittest\\.bash")
728 (add-after 'build 'build-bash-completions
730 (setenv "PYTHONPATH" ".")
731 (invoke "./autotools/build-bash-completion")
732 (unsetenv "PYTHONPATH")))
733 (add-before 'check 'pre-check
734 (lambda* (#:key inputs #:allow-other-keys)
735 ;; Set TZDIR so that time zones are found.
736 (setenv "TZDIR" (search-input-directory inputs "share/zoneinfo"))
738 (substitute* "test/py/ganeti.utils.process_unittest.py"
739 ;; This test attempts to run an executable with
740 ;; RunCmd(..., reset_env=True), which fails because the default
741 ;; PATH from Constants.hs does not exist in the build container.
742 ((".*def testResetEnv.*" all)
743 (string-append " @unittest.skipIf(True, "
744 "\"cannot reset env in the build container\")\n"
747 ;; XXX: Somehow this test fails in the build container, but
748 ;; works in 'guix environment -C', even without /bin/sh?
749 ((".*def testPidFile.*" all)
750 (string-append " @unittest.skipIf(True, "
751 "\"testPidFile fails in the build container\")\n"
754 ;; XXX: Why are these links not added automatically.
755 (with-directory-excursion "test/hs"
756 (for-each (lambda (file)
757 (symlink "../../src/htools" file))
758 '("hspace" "hscan" "hinfo" "hbal" "hroller"
759 "hcheck" "hail" "hsqueeze")))))
760 (add-after 'install 'install-bash-completions
761 (lambda* (#:key outputs #:allow-other-keys)
762 (let* ((out (assoc-ref outputs "out"))
763 (compdir (string-append out "/etc/bash_completion.d")))
765 (copy-file "doc/examples/bash_completion"
766 (string-append compdir "/ganeti"))
767 ;; The one file contains completions for many different
768 ;; executables. Create symlinks for found completions.
769 (with-directory-excursion compdir
771 (lambda (prog) (symlink "ganeti" prog))
772 (call-with-input-file "ganeti"
774 (let loop ((line (read-line port))
776 (if (eof-object? line)
778 (if (string-prefix? "complete" line)
779 (loop (read-line port)
780 ;; Extract "prog" from lines of the form:
781 ;; "complete -F _prog -o filenames prog".
782 ;; Note that 'burnin' is listed with the
783 ;; absolute file name, which is why we
784 ;; run everything through 'basename'.
785 (match (string-split line #\ )
787 (cons (basename prog) progs))))
788 (loop (read-line port) progs)))))))))))
789 ;; Wrap all executables with GUIX_PYTHONPATH. We can't borrow
790 ;; the phase from python-build-system because we also need to wrap
791 ;; the scripts in $out/lib/ganeti such as "node-daemon-setup".
792 (add-after 'install 'wrap
793 (lambda* (#:key inputs outputs #:allow-other-keys)
794 (let* ((out (assoc-ref outputs "out"))
795 (sbin (string-append out "/sbin"))
796 (lib (string-append out "/lib"))
797 (PYTHONPATH (string-append (site-packages inputs outputs)
798 ":" (getenv "GUIX_PYTHONPATH"))))
799 (define (shell-script? file)
800 (call-with-ascii-input-file file
802 (let ((shebang (false-if-exception (read-line port))))
804 (string-prefix? "#!" shebang)
805 (or (string-contains shebang "/bin/bash")
806 (string-contains shebang "/bin/sh")))))))
808 (define* (wrap? file #:rest _)
809 ;; Do not wrap shell scripts because some are meant to be
810 ;; sourced, which breaks if they are wrapped. We do wrap
811 ;; the Haskell executables because some call out to Python
813 (and (executable-file? file)
814 (not (symbolic-link? file))
815 (not (shell-script? file))))
817 (for-each (lambda (file)
819 `("GUIX_PYTHONPATH" ":" prefix
821 (append-map (cut find-files <> wrap?)
822 (list (string-append lib "/ganeti")
826 ("cabal" ,cabal-install)
829 ;; These inputs are necessary to bootstrap the package, because we
830 ;; have patched the build system.
831 ("autoconf" ,autoconf)
832 ("automake" ,automake)
834 ;; For the documentation.
835 ("python-docutils" ,python-docutils)
836 ("sphinx" ,python-sphinx)
840 ;; Test dependencies.
841 ("fakeroot" ,fakeroot)
842 ("ghc-temporary" ,ghc-temporary)
843 ("ghc-test-framework" ,ghc-test-framework)
844 ("ghc-test-framework-hunit" ,ghc-test-framework-hunit)
845 ("ghc-test-framework-quickcheck2" ,ghc-test-framework-quickcheck2)
846 ("python-mock" ,python-mock)
847 ("python-pyyaml" ,python-pyyaml)
850 ("shelltestrunner" ,shelltestrunner)
851 ("tzdata" ,tzdata-for-tests)))
853 (list iputils ;for 'arping'
859 qemu-minimal ;for qemu-img
861 ghc-base64-bytestring
875 ;; For the optional metadata daemon.
887 (home-page "https://www.ganeti.org/")
888 (synopsis "Cluster-based virtual machine management system")
890 "Ganeti is a virtual machine management tool built on top of existing
891 virtualization technologies such as Xen or KVM. Ganeti controls:
894 @item Disk creation management;
895 @item Operating system installation for instances (in co-operation with
896 OS-specific install scripts); and
897 @item Startup, shutdown, and failover between physical systems.
900 Ganeti is designed to facilitate cluster management of virtual servers and
901 to provide fast and simple recovery after physical failures, using
902 commodity hardware.")
903 (license license:bsd-2)))
905 (define-public ganeti-instance-guix
907 (name "ganeti-instance-guix")
909 (home-page "https://github.com/mbakke/ganeti-instance-guix")
912 (uri (git-reference (url home-page) (commit version)))
913 (file-name (git-file-name name version))
916 "18h8hdd38h1l89si8122v3ylzvvirs8hiypayklk1nr2wnfgbvff"))))
917 (build-system gnu-build-system)
919 '(#:configure-flags '("--sysconfdir=/etc" "--localstatedir=/var")))
921 (list autoconf automake))
923 (list util-linux qemu-minimal))
924 (synopsis "Guix OS integration for Ganeti")
926 "This package provides a guest OS definition for Ganeti that uses
927 Guix to build virtual machines.")
928 (license license:gpl3+)))
930 (define-public ganeti-instance-debootstrap
932 (name "ganeti-instance-debootstrap")
933 ;; We need two commits on top of the latest release for compatibility
934 ;; with newer sfdisk, as well as gnt-network integration.
935 (version "0.16-2-ge145396")
936 (home-page "https://github.com/ganeti/instance-debootstrap")
939 (uri (git-reference (url home-page) (commit version)))
940 (file-name (git-file-name name version))
943 "0f2isw9d8lawzj21rrq1q9xhq8xfa65rqbhqmrn59z201x9q1336"))))
944 (build-system gnu-build-system)
946 '(#:configure-flags '("--sysconfdir=/etc" "--localstatedir=/var")
947 #:phases (modify-phases %standard-phases
948 (add-after 'unpack 'add-absolute-references
950 (substitute* "common.sh.in"
951 (("/sbin/blkid") (which "blkid"))
953 (string-append (which "kpartx") " -")))
954 (substitute* "import"
956 (string-append (which "restore") " -r")))
957 (substitute* "export"
959 (string-append (which "dump") " -0")))
960 (substitute* "create"
961 (("debootstrap") (which "debootstrap"))
962 (("`which run-parts`") (which "run-parts"))
963 ;; Here we actually need to hard code /bin/passwd
964 ;; because it's called via chroot, which fails if
965 ;; "/bin" is not in PATH.
966 (("passwd") "/bin/passwd"))
968 (add-after 'unpack 'set-dpkg-arch
969 (lambda* (#:key system #:allow-other-keys)
970 ;; The create script passes --arch to debootstrap,
971 ;; and defaults to `dpkg --print-architecture` when
972 ;; ARCH is not set in variant.conf. Hard code the
973 ;; build-time architecture to avoid the dpkg dependency.
975 (cond ((string-prefix? "x86_64" system)
977 ((string-prefix? "i686" system)
979 ((string-prefix? "aarch64" system)
981 (else (car (string-split system #\-))))))
982 (substitute* "create"
983 (("`dpkg --print-architecture`")
986 (add-after 'configure 'adjust-Makefile
988 ;; Do not attempt to create /etc/ganeti/instance-debootstrap
989 ;; and /etc/default/ganeti-instance-debootstrap during install.
990 ;; They are created by the Ganeti service.
991 (substitute* "Makefile"
992 (("\\$\\(variantsdir\\)")
993 "$(prefix)/etc/ganeti/instance-debootstrap/variants")
994 (("\\$\\(defaultsdir\\)")
995 "$(prefix)/etc/default/ganeti-instance-debootstrap"))
997 (add-after 'install 'make-variants.list-symlink
998 (lambda* (#:key outputs #:allow-other-keys)
999 ;; The Ganeti OS API mandates a variants.list file that
1000 ;; describes all supported "variants" of this OS.
1001 ;; Guix generates this file, so make the original file
1003 (with-directory-excursion (string-append
1004 (assoc-ref outputs "out")
1005 "/share/ganeti/os/debootstrap")
1006 (delete-file "variants.list")
1007 (symlink "/etc/ganeti/instance-debootstrap/variants/variants.list"
1011 (list autoconf automake))
1013 `(("debianutils" ,debianutils)
1014 ("debootstrap" ,debootstrap)
1016 ("kpartx" ,multipath-tools)
1017 ("util-linux" ,util-linux)))
1018 (synopsis "Debian OS integration for Ganeti")
1020 "This package provides a guest OS definition for Ganeti. It installs
1021 Debian or a derivative using @command{debootstrap}.")
1022 (license license:gpl2+)))
1024 (define-public spike
1031 (url "https://github.com/riscv-software-src/riscv-isa-sim")
1032 (commit (string-append "v" version))))
1033 (file-name (git-file-name name version))
1035 (base32 "0cik2m0byfp9ppq0hpg3xyrlp5ag1i4dww7a7872mlm36xxqagg0"))))
1036 (build-system gnu-build-system)
1040 #~(modify-phases %standard-phases
1041 (add-before 'configure 'configure-dtc-path
1042 (lambda* (#:key inputs #:allow-other-keys)
1043 ;; Reference dtc by its absolute store path.
1044 (substitute* "riscv/dts.cc"
1046 (string-append "\"" (search-input-file inputs "/bin/dtc") "\""))))))))
1048 (list bash-minimal dtc))
1050 (list python-wrapper))
1051 (home-page "https://github.com/riscv-software-src/riscv-isa-sim")
1052 (synopsis "RISC-V ISA Simulator")
1053 (description "Spike, the RISC-V ISA Simulator, implements a functional model
1054 of one or more RISC-V harts.")
1055 (license license:bsd-3)))
1057 (define-public libosinfo
1064 (uri (string-append "https://releases.pagure.org/libosinfo/libosinfo-"
1068 "0193sdvv9yj3h6wwhj441d2fhccc7fh0m36sl0fv5pl0ql7y0lm2"))))
1069 (build-system meson-build-system)
1073 #~(list (string-append "-Dwith-usb-ids-path="
1074 (search-input-file %build-inputs
1075 "share/hwdata/usb.ids"))
1076 (string-append "-Dwith-pci-ids-path="
1077 (search-input-file %build-inputs
1078 "share/hwdata/pci.ids")))
1080 #~(modify-phases %standard-phases
1081 (add-after 'unpack 'patch-osinfo-path
1082 (lambda* (#:key native-inputs inputs #:allow-other-keys)
1083 (substitute* "osinfo/osinfo_loader.c"
1084 (("path = DATA_DIR.*")
1085 (format #f "path = ~s;"
1086 (search-input-directory (or native-inputs inputs)
1087 "share/osinfo")))))))))
1088 (inputs (list libsoup-minimal-2 libxml2 libxslt osinfo-db))
1090 (list `(,glib "bin") ;glib-mkenums, etc.
1091 gobject-introspection
1098 (home-page "https://libosinfo.org/")
1099 (synopsis "Operating system information database")
1100 (description "libosinfo is a GObject based library API for managing
1101 information about operating systems, hypervisors and the (virtual) hardware
1102 devices they can support. It includes a database containing device metadata
1103 and provides APIs to match/identify optimal devices for deploying an operating
1104 system on a hypervisor. Via GObject Introspection, the API is available in
1105 all common programming languages. Vala bindings are also provided.")
1106 ;; The library files are released under LGPLv2.1 or later; the source
1107 ;; files in the "tools" directory are released under GPLv2+.
1108 (license (list license:lgpl2.1+ license:gpl2+))))
1117 "https://linuxcontainers.org/downloads/lxc/lxc-"
1121 "0b7hv4n8b3lndhr0jf9j1gkbzxm8897a1myjsfgwzad9gkhq395g"))))
1122 (build-system gnu-build-system)
1124 (list pkg-config docbook2x))
1126 (list gnutls libcap libseccomp libselinux))
1128 (list #:configure-flags
1129 #~(list (string-append "--docdir=" #$output "/share/doc/"
1130 #$name "-" #$version)
1132 "--localstatedir=/var")
1134 #~(modify-phases %standard-phases
1137 (invoke "make" "install"
1138 (string-append "bashcompdir=" #$output
1139 "/etc/bash_completion.d")
1140 ;; Don't install files into /var and /etc.
1141 "LXCPATH=/tmp/var/lib/lxc"
1142 "localstatedir=/tmp/var"
1143 "sysconfdir=/tmp/etc"
1144 "sysconfigdir=/tmp/etc/default"))))))
1145 (synopsis "Linux container tools")
1146 (home-page "https://linuxcontainers.org/")
1148 "LXC is a userspace interface for the Linux kernel containment features.
1149 Through a powerful API and simple tools, it lets Linux users easily create and
1150 manage system or application containers.")
1151 (license license:lgpl2.1+)))
1153 (define-public lxcfs
1157 (home-page "https://github.com/lxc/lxcfs")
1160 (uri (git-reference (url home-page)
1161 (commit (string-append "lxcfs-" version))))
1162 (file-name (git-file-name name version))
1165 "02cgzh97cgxh9iyf7gkn5ikdc0sfzqfjj6al0hikdf9rbwcscqwd"))))
1167 '(#:configure-flags '("--localstatedir=/var")))
1169 (list autoconf automake libtool pkg-config))
1172 (build-system gnu-build-system)
1173 (synopsis "FUSE-based file system for LXC")
1174 (description "LXCFS is a small FUSE file system written with the intention
1175 of making Linux containers feel more like a virtual machine.
1176 It started as a side project of LXC but can be used by any run-time.")
1177 (license license:lgpl2.1+)))
1186 "https://github.com/lxc/lxd/releases/download/"
1187 "lxd-" version "/lxd-" version ".tar.gz"))
1190 "119345936fcm1vv06k82k9hvj5yjf9jdrwqm9ccphhl5mswf8xq9"))))
1191 (build-system go-build-system)
1193 `(#:import-path "github.com/lxc/lxd"
1194 #:tests? #f ;; tests fail due to missing /var, cgroups, etc.
1195 #:modules ((guix build go-build-system)
1200 (modify-phases %standard-phases
1201 (add-after 'unpack 'unpack-dist
1202 (lambda* (#:key import-path #:allow-other-keys)
1203 (with-directory-excursion (string-append "src/" import-path)
1204 ;; Move all the dependencies into the src directory.
1205 (copy-recursively "_dist/src" "../../.."))))
1207 (lambda* (#:key import-path #:allow-other-keys)
1208 (with-directory-excursion (string-append "src/" import-path)
1209 (invoke "make" "build" "CC=gcc" "TAG_SQLITE3=libsqlite3"))))
1211 (lambda* (#:key tests? import-path #:allow-other-keys)
1213 (with-directory-excursion (string-append "src/" import-path)
1214 (invoke "make" "check" "CC=gcc" "TAG_SQLITE3=libsqlite3")))))
1216 (lambda* (#:key inputs outputs import-path #:allow-other-keys)
1217 (let* ((out (assoc-ref outputs "out"))
1219 (string-append out "/bin/"))
1221 (string-append out "/share/doc/lxd-" ,version))
1223 (string-append out "/share/bash-completion/completions")))
1224 (with-directory-excursion (string-append "src/" import-path)
1225 ;; Wrap lxd with run-time dependencies.
1226 (wrap-program (string-append bin-dir "lxd")
1228 ,(fold (lambda (input paths)
1229 (let* ((in (assoc-ref inputs input))
1230 (bin (string-append in "/bin"))
1231 (sbin (string-append in "/sbin")))
1232 (append (filter file-exists?
1233 (list bin sbin)) paths)))
1235 '("bash" "acl" "rsync" "tar" "xz" "btrfs-progs"
1236 "gzip" "dnsmasq" "squashfs-tools" "iproute2"
1237 "criu" "iptables"))))
1238 ;; Remove unwanted binaries.
1239 (for-each (lambda (prog)
1240 (delete-file (string-append bin-dir prog)))
1241 '("deps" "macaroon-identity" "generate"))
1242 ;; Install documentation.
1243 (for-each (lambda (file)
1244 (install-file file doc-dir))
1246 ;; Install bash completion.
1247 (rename-file "scripts/bash/lxd-client" "scripts/bash/lxd")
1248 (install-file "scripts/bash/lxd" completions-dir))))))))
1250 (list ;; Test dependencies:
1251 ;; ("go-github-com-rogpeppe-godeps" ,go-github-com-rogpeppe-godeps)
1252 ;; ("go-github-com-tsenart-deadcode" ,go-github-com-tsenart-deadcode)
1253 ;; ("go-golang-org-x-lint" ,go-golang-org-x-lint)
1258 ("libdqlite" ,libdqlite)
1259 ("libraft" ,libraft)
1262 ;; Run-time dependencies.
1263 ("bash" ,bash-minimal)
1267 ("btrfs-progs" ,btrfs-progs)
1269 ("dnsmasq" ,dnsmasq)
1270 ("squashfs-tools" ,squashfs-tools)
1271 ("iproute2" ,iproute)
1273 ("iptables" ,iptables)))
1274 (synopsis "Daemon based on liblxc offering a REST API to manage containers")
1275 (home-page "https://linuxcontainers.org/lxd/")
1276 (description "LXD is a next generation system container manager. It
1277 offers a user experience similar to virtual machines but using Linux
1278 containers instead. It's image based with pre-made images available for a
1279 wide number of Linux distributions and is built around a very powerful, yet
1280 pretty simple, REST API.")
1281 (license license:asl2.0)))
1283 (define-public libvirt
1290 (uri (string-append "https://libvirt.org/sources/libvirt-"
1293 (base32 "131fyxb05rrcr9ih4mhhjyw3cgsxh5l12vj4y109q9vlynsz5742"))
1294 (patches (search-patches "libvirt-add-install-prefix.patch"))))
1295 (build-system meson-build-system)
1298 (list "-Ddriver_qemu=enabled"
1299 "-Dqemu_user=nobody"
1301 "-Dstorage_disk=enabled"
1302 "-Dstorage_dir=enabled"
1304 ;; XXX The default, but required to make -Dsasl ‘stick’.
1305 ;; See <https://gitlab.com/libvirt/libvirt/-/issues/185>
1306 "-Ddriver_remote=enabled"
1307 "-Dnls=enabled" ;translations
1308 (string-append "-Ddocdir=" (assoc-ref %outputs "out") "/share/doc/"
1310 "-Dbash_completion=enabled"
1311 (string-append "-Dinstall_prefix=" (assoc-ref %outputs "out"))
1313 "--localstatedir=/var")
1315 (modify-phases %standard-phases
1316 (add-after 'unpack 'skip-directory-confusion
1318 ;; Don't try to install an (unused) /var outside of the store.
1319 (substitute* "scripts/meson-install-dirs.py"
1321 "destdir = '/tmp'"))))
1322 (add-before 'configure 'disable-broken-tests
1324 (let ((tests (list "commandtest" ; hangs idly
1325 "qemuxml2argvtest" ; fails
1326 "virnetsockettest"))) ; tries to network
1327 (substitute* "tests/meson.build"
1328 (((format #f ".*'name': '(~a)'.*" (string-join tests "|")))
1334 ("libxml2" ,libxml2)
1336 ("libpciaccess" ,libpciaccess)
1339 ("libpcap" ,libpcap)
1341 ("libssh2" ,libssh2) ;optional
1342 ("libtirpc" ,libtirpc) ;for <rpc/rpc.h>
1343 ("libuuid" ,util-linux "lib")
1344 ("lvm2" ,lvm2) ;for libdevmapper
1346 ("openssl" ,openssl)
1347 ("readline" ,readline)
1348 ("cyrus-sasl" ,cyrus-sasl)
1349 ("libyajl" ,libyajl)
1351 ("dmidecode" ,dmidecode)
1352 ("dnsmasq" ,dnsmasq)
1353 ("ebtables" ,ebtables)
1355 ("iproute" ,iproute)
1356 ("iptables" ,iptables)))
1358 `(("bash-completion" ,bash-completion)
1359 ("gettext" ,gettext-minimal)
1360 ("xsltproc" ,libxslt)
1362 ("pkg-config" ,pkg-config)
1364 ("python" ,python-wrapper)
1365 ("python-docutils" ,python-docutils) ;for rst2html
1366 ("rpcsvc-proto" ,rpcsvc-proto))) ;for rpcgen
1367 (home-page "https://libvirt.org")
1368 (synopsis "Simple API for virtualization")
1369 (description "Libvirt is a C toolkit to interact with the virtualization
1370 capabilities of recent versions of Linux. The library aims at providing long
1371 term stable C API initially for the Xen paravirtualization but should be able
1372 to integrate other virtualization mechanisms if needed.")
1373 (license license:lgpl2.1+)))
1375 (define-public libvirt-glib
1377 (name "libvirt-glib")
1381 (uri (string-append "ftp://libvirt.org/libvirt/glib/"
1382 "libvirt-glib-" version ".tar.xz"))
1385 "1gdcvqz88qkp402zra9csc6391f2xki1270x683n6ixakl3gf8w4"))))
1386 (build-system meson-build-system)
1388 (list openssl cyrus-sasl lvm2 ; for libdevmapper
1391 (list pkg-config intltool
1392 `(,glib "bin") vala))
1394 ;; ‘Required:’ by the installed .pc files.
1395 (list glib libvirt libxml2 gobject-introspection))
1396 (home-page "https://libvirt.org")
1397 (synopsis "GLib wrapper around libvirt")
1398 (description "libvirt-glib wraps the libvirt library to provide a
1399 high-level object-oriented API better suited for glib-based applications, via
1403 @item libvirt-glib - GLib main loop integration & misc helper APIs
1404 @item libvirt-gconfig - GObjects for manipulating libvirt XML documents
1405 @item libvirt-gobject - GObjects for managing libvirt objects
1408 (license license:lgpl2.1+)))
1410 (define-public python-libvirt
1412 (name "python-libvirt")
1417 (uri (string-append "https://libvirt.org/sources/python/libvirt-python-"
1420 (base32 "0nakisj2ady5a41k4zc95k0kp749f4ppmxgr91b1h1dzbzxcydc5"))))
1421 (build-system python-build-system)
1424 (modify-phases %standard-phases
1426 (lambda* (#:key inputs outputs tests? #:allow-other-keys)
1428 ;; No reason to explicity invoke Python on a wrapped pytest.
1429 (substitute* "setup.py"
1430 (("sys\\.executable, pytest") "pytest"))
1431 (add-installed-pythonpath inputs outputs)
1432 (setenv "LIBVIRT_API_COVERAGE" "whynot")
1433 (invoke "python" "setup.py" "test")))))))
1439 (list pkg-config python-pytest))
1440 (home-page "https://libvirt.org")
1441 (synopsis "Python bindings to libvirt")
1442 (description "This package provides Python bindings to the libvirt
1443 virtualization library.")
1444 (license license:lgpl2.1+)))
1446 (define-public virt-manager
1448 (name "virt-manager")
1452 (uri (string-append "https://virt-manager.org/download/sources"
1453 "/virt-manager/virt-manager-"
1457 "11kvpzcmyir91qz0dsnk7748jbb4wr8mrc744w117qc91pcy6vrb"))))
1458 (build-system python-build-system)
1460 `(#:use-setuptools? #f ; uses custom distutils 'install' command
1461 #:tests? #f ; TODO The tests currently fail
1462 ; RuntimeError: Loop condition wasn't
1464 #:imported-modules ((guix build glib-or-gtk-build-system)
1465 ,@%python-build-system-modules)
1466 #:modules ((ice-9 match)
1468 (guix build python-build-system)
1469 ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
1472 (modify-phases %standard-phases
1473 (add-after 'unpack 'fix-setup
1474 (lambda* (#:key outputs #:allow-other-keys)
1475 (substitute* "virtinst/buildconfig.py"
1476 (("/usr") (assoc-ref outputs "out")))
1478 (add-after 'unpack 'fix-default-uri
1479 (lambda* (#:key inputs #:allow-other-keys)
1480 ;; Xen is not available for now - so only patch qemu.
1481 (substitute* "virtManager/createconn.py"
1482 (("/usr(/bin/qemu-system-[a-zA-Z0-9_-]+)" _ suffix)
1483 (search-input-file inputs suffix)))
1485 (add-before 'wrap 'wrap-with-GI_TYPELIB_PATH
1486 (lambda* (#:key inputs outputs #:allow-other-keys)
1487 (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
1488 (bin-files (find-files bin ".*"))
1489 (paths (map (match-lambda
1490 ((output . directory)
1491 (let* ((girepodir (string-append
1493 "/lib/girepository-1.0")))
1494 (if (file-exists? girepodir)
1497 (for-each (lambda (file)
1498 (format #t "wrapping ~a\n" file)
1500 `("GI_TYPELIB_PATH" ":" prefix
1501 ,(filter identity paths))))
1505 (lambda* (#:key tests? #:allow-other-keys)
1507 (setenv "HOME" "/tmp")
1508 (setenv "XDG_CACHE_HOME" "/tmp")
1509 (system "Xvfb :1 &")
1510 (setenv "DISPLAY" ":1")
1511 ;; Dogtail requires that Assistive Technology support be enabled
1512 (setenv "GTK_MODULES" "gail:atk-bridge")
1513 (invoke "dbus-run-session" "--" "pytest" "--uitests"))
1515 (add-after 'install 'glib-or-gtk-compile-schemas
1516 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
1517 (add-after 'wrap 'glib-or-gtk-wrap
1518 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
1534 ;; virt-manager searches for qemu-img or kvm-img in the PATH.
1538 `(("glib" ,glib "bin") ; glib-compile-schemas
1539 ("gobject-introspection" ,gobject-introspection)
1540 ("gtk+" ,gtk+ "bin") ; gtk-update-icon-cache
1541 ("perl" ,perl) ; pod2man
1542 ("intltool" ,intltool)
1543 ("rst2man" ,python-docutils)
1544 ;; The following are required for running the tests
1545 ;; ("python-pytest" ,python-pytest)
1546 ;; ("python-dogtail" ,python-dogtail)
1547 ;; ("xvfb" ,xorg-server-for-tests)
1549 ;; ("at-spi2-core" ,at-spi2-core)
1550 ;; ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
1552 (home-page "https://virt-manager.org/")
1553 (synopsis "Manage virtual machines")
1555 "The virt-manager application is a desktop user interface for managing
1556 virtual machines through libvirt. It primarily targets KVM VMs, but also
1557 manages Xen and LXC (Linux containers). It presents a summary view of running
1558 domains, their live performance and resource utilization statistics.")
1559 (license license:gpl2+)))
1569 (url "https://github.com/checkpoint-restore/criu")
1570 (commit (string-append "v" version))))
1571 (file-name (git-file-name name version))
1573 (base32 "1riw15197fnrs254jl7wks9x8bdml76kf1vnqkkgyypr13dnq55g"))))
1574 (build-system gnu-build-system)
1576 `(#:test-target "test"
1577 #:tests? #f ; tests require mounting as root
1579 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1580 (string-append "LIBDIR=" (assoc-ref %outputs "out")
1582 (string-append "ASCIIDOC="
1583 (search-input-file %build-inputs
1585 (string-append "PYTHON=python3")
1586 (string-append "XMLTO="
1587 (search-input-file %build-inputs
1590 (modify-phases %standard-phases
1591 (delete 'configure) ; no configure script
1592 (add-after 'unpack 'fix-documentation
1593 (lambda* (#:key inputs outputs #:allow-other-keys)
1594 (substitute* "Documentation/Makefile"
1597 "-m custom.xsl --skip-validation -x "
1598 (assoc-ref inputs "docbook-xsl") "/xml/xsl/"
1599 ,(package-name docbook-xsl) "-"
1600 ,(package-version docbook-xsl)
1601 "/manpages/docbook.xsl")))))
1602 (add-after 'unpack 'hardcode-variables
1603 (lambda* (#:key inputs #:allow-other-keys)
1604 ;; Hardcode arm version detection
1605 (substitute* "Makefile"
1606 (("ARMV.*:=.*") "ARMV := 7\n"))))
1607 (add-before 'build 'fix-symlink
1608 (lambda* (#:key inputs #:allow-other-keys)
1609 ;; The file 'images/google/protobuf/descriptor.proto' points to
1610 ;; /usr/include/..., which obviously does not exist.
1611 (let* ((file "google/protobuf/descriptor.proto")
1612 (target (string-append "images/" file))
1613 (source (search-input-file
1615 (string-append "include/" file))))
1616 (delete-file target)
1617 (symlink source target))))
1618 (add-after 'install 'wrap
1619 (lambda* (#:key inputs outputs #:allow-other-keys)
1620 ;; Make sure 'crit' runs with the correct PYTHONPATH.
1621 (let* ((out (assoc-ref outputs "out"))
1622 (site (string-append out "/lib/python"
1623 ,(version-major+minor
1624 (package-version python))
1626 (path (getenv "GUIX_PYTHONPATH")))
1627 (wrap-program (string-append out "/bin/crit")
1628 `("GUIX_PYTHONPATH" ":" prefix (,site ,path))))))
1629 (add-after 'install 'delete-static-libraries
1630 ;; Not building/installing these at all doesn't seem to be supported.
1631 (lambda* (#:key outputs #:allow-other-keys)
1632 (let ((out (assoc-ref outputs "out")))
1633 (for-each delete-file (find-files out "\\.a$"))))))))
1635 `(("protobuf" ,protobuf)
1637 ("python-protobuf" ,python-protobuf)
1638 ("iproute" ,iproute)
1644 ("nftables" ,nftables)))
1653 ;; included by 'rpc.pb-c.h'
1655 (home-page "https://criu.org")
1656 (synopsis "Checkpoint and restore in user space")
1657 (description "Using this tool, you can freeze a running application (or
1658 part of it) and checkpoint it to a hard drive as a collection of files. You
1659 can then use the files to restore and run the application from the point it
1660 was frozen at. The distinctive feature of the CRIU project is that it is
1661 mainly implemented in user space.")
1662 ;; The project is licensed under GPLv2; files in the lib/ directory are
1664 (license (list license:gpl2 license:lgpl2.1))))
1666 (define-public qmpbackup
1673 (url "https://github.com/abbbi/qmpbackup")
1675 (file-name (git-file-name name version))
1678 "0swhp5byz44brhyis1a39p11fyn9q84xz5q6v2fah29r7d71kmmx"))))
1679 (build-system python-build-system)
1681 `(#:python ,python-2))
1682 (home-page "https://github.com/abbbi/qmpbackup")
1683 (synopsis "Backup and restore QEMU machines")
1684 (description "qmpbackup is designed to create and restore full and
1685 incremental backups of running QEMU virtual machines via QMP, the QEMU
1687 (license license:gpl3+)))
1689 (define-public looking-glass-client
1691 (name "looking-glass-client")
1697 (url "https://github.com/gnif/LookingGlass")
1700 (file-name (git-file-name name version))
1703 "09mn544x5hg1z31l92ksk7fi7yj9r8xdk0dcl9fk56ivcr452ylm"))))
1704 (build-system cmake-build-system)
1730 (native-inputs (list libconfig nettle pkg-config))
1732 `(#:tests? #f ;; No tests are available.
1733 #:make-flags '("CC=gcc")
1734 #:phases (modify-phases %standard-phases
1735 (add-before 'configure 'chdir-to-client
1736 (lambda* (#:key outputs #:allow-other-keys)
1740 (lambda* (#:key outputs #:allow-other-keys)
1741 (install-file "looking-glass-client"
1742 (string-append (assoc-ref outputs "out")
1745 (add-after 'install 'wrapper
1746 (lambda* (#:key inputs outputs #:allow-other-keys)
1748 (string-append (assoc-ref outputs "out")
1749 "/bin/looking-glass-client")
1750 `("LD_LIBRARY_PATH" ":" prefix
1751 ,(map (lambda (name)
1752 (let ((input (assoc-ref inputs name)))
1753 (string-append input "/lib")))
1759 "fontconfig-minimal"
1766 (home-page "https://looking-glass.io/")
1767 (synopsis "KVM Frame Relay (KVMFR) implementation")
1768 (description "Looking Glass allows the use of a KVM (Kernel-based Virtual
1769 Machine) configured for VGA PCI Pass-through without an attached physical
1770 monitor, keyboard or mouse. It displays the VM's rendered contents on your
1772 ;; This package requires SSE instructions.
1773 (supported-systems '("i686-linux" "x86_64-linux"))
1774 (license license:gpl2+)))
1779 (version "1.0.0-rc93")
1783 "https://github.com/opencontainers/runc/releases/"
1784 "download/v" version "/runc.tar.xz"))
1785 (file-name (string-append name "-" version ".tar.xz"))
1788 "0b90r1bkvlqli53ca1yc1l488dba0isd3i6l7nlhszxi8p7hzvkh"))))
1789 (build-system go-build-system)
1791 '(#:import-path "github.com/opencontainers/runc"
1792 #:install-source? #f
1793 ;; XXX: 20/139 tests fail due to missing /var, cgroups and apparmor in
1794 ;; the build environment.
1797 (modify-phases %standard-phases
1799 (lambda* (#:key import-path #:allow-other-keys)
1800 (with-directory-excursion (string-append "src/" import-path)
1801 (invoke "make" "all" "man"))))
1803 (lambda* (#:key tests? #:allow-other-keys)
1805 (invoke "make" "localunittest"))))
1807 (lambda* (#:key import-path outputs #:allow-other-keys)
1808 (with-directory-excursion (string-append "src/" import-path)
1809 (let ((out (assoc-ref outputs "out")))
1810 (invoke "make" "install" "install-bash" "install-man"
1811 (string-append "PREFIX=" out)))))))))
1813 `(("go-md2man" ,go-github-com-go-md2man)
1814 ("pkg-config" ,pkg-config)))
1817 (synopsis "Open container initiative runtime")
1818 (home-page "https://opencontainers.org/")
1820 "@command{runc} is a command line client for running applications
1821 packaged according to the
1822 @uref{https://github.com/opencontainers/runtime-spec/blob/master/spec.md, Open
1823 Container Initiative (OCI) format} and is a compliant implementation of the
1824 Open Container Initiative specification.")
1825 (license license:asl2.0)))
1827 (define-public umoci
1835 "https://github.com/opencontainers/umoci/releases/download/v"
1836 version "/umoci.tar.xz"))
1837 (file-name (string-append "umoci-" version ".tar.xz"))
1839 (base32 "0fvljj9k4f83wbqzd8nbijz0p1zaq633f8yxyvl5sy3wjf03ffk9"))))
1840 (build-system go-build-system)
1842 '(#:import-path "github.com/opencontainers/umoci"
1843 #:install-source? #f
1845 (modify-phases %standard-phases
1847 (lambda* (#:key source import-path #:allow-other-keys)
1848 ;; Unpack the tarball into 'umoci' instead of "runc-${version}".
1849 (let ((dest (string-append "src/" import-path)))
1851 (invoke "tar" "-C" (string-append "src/" import-path)
1852 "--strip-components=1"
1855 (lambda* (#:key import-path #:allow-other-keys)
1856 (with-directory-excursion (string-append "src/" import-path)
1857 ;; TODO: build manpages with 'go-md2man'.
1858 (invoke "make" "SHELL=bash"))))
1860 (lambda* (#:key import-path outputs #:allow-other-keys)
1861 (let* ((out (assoc-ref outputs "out"))
1862 (bindir (string-append out "/bin")))
1863 (install-file (string-append "src/" import-path "/umoci")
1866 (home-page "https://umo.ci/")
1867 (synopsis "Tool for modifying Open Container images")
1869 "@command{umoci} is a tool that allows for high-level modification of an
1870 Open Container Initiative (OCI) image layout and its tagged images.")
1871 (license license:asl2.0)))
1873 (define-public skopeo
1880 (url "https://github.com/containers/skopeo")
1881 (commit (string-append "v" version))))
1882 (file-name (git-file-name name version))
1885 "0n22sdif437ddg5ch0ipwim3fg0n6ihc9bfi52qkhy3r1grz04hs"))))
1886 (build-system go-build-system)
1888 (list pkg-config go-github-com-go-md2man))
1899 '(#:import-path "github.com/containers/skopeo"
1900 #:install-source? #f
1901 #:tests? #f ; The tests require Docker
1903 (modify-phases %standard-phases
1905 (lambda* (#:key import-path #:allow-other-keys)
1906 (with-directory-excursion (string-append "src/" import-path)
1907 (invoke "make" "bin/skopeo"))))
1908 (add-after 'build 'build-docs
1909 (lambda* (#:key import-path #:allow-other-keys)
1910 (with-directory-excursion (string-append "src/" import-path)
1911 (invoke "make" "docs"))))
1913 (lambda* (#:key import-path outputs #:allow-other-keys)
1914 (with-directory-excursion (string-append "src/" import-path)
1915 (let ((out (assoc-ref outputs "out")))
1916 (install-file "default-policy.json"
1917 (string-append out "/etc/containers"))
1918 (invoke "make" "install-binary" "install-completions" "install-docs"
1919 (string-append "PREFIX=" out)))))))))
1920 (home-page "https://github.com/containers/skopeo")
1921 (synopsis "Interact with container images and container image registries")
1923 "@command{skopeo} is a command line utility providing various operations
1924 with container images and container image registries. It can:
1927 @item Copy container images between various containers image stores,
1928 converting them as necessary.
1930 @item Convert a Docker schema 2 or schema 1 container image to an OCI image.
1932 @item Inspect a repository on a container registry without needlessly pulling
1935 @item Sign and verify container images.
1937 @item Delete container images from a remote container registry.
1940 (license license:asl2.0)))
1942 (define-public python-vagrant
1944 (name "python-vagrant")
1949 (uri (pypi-uri "python-vagrant" version))
1952 "1ikrh6canhcxg5y7pzmkcnnydikppv7s6sm9prfx90nk0ac8m6mg"))))
1953 (build-system python-build-system)
1955 '(#:tests? #f)) ; tests involve running vagrant.
1956 (home-page "https://github.com/todddeluca/python-vagrant")
1957 (synopsis "Python bindings for Vagrant")
1959 "Python-vagrant is a Python module that provides a thin wrapper around the
1960 @code{vagrant} command line executable, allowing programmatic control of Vagrant
1962 (license license:expat)))
1964 (define-public bubblewrap
1970 (uri (string-append "https://github.com/containers/bubblewrap/"
1971 "releases/download/v" version "/bubblewrap-"
1975 "0608l2sjwhnb1c0mslah1h6yjvqr17wk60by6i710qwxg4rszz8n"))
1976 (patches (search-patches "bubblewrap-fix-locale-in-tests.patch"))))
1977 (build-system gnu-build-system)
1980 (modify-phases %standard-phases
1981 (add-after 'unpack 'fix-test
1982 (lambda* (#:key outputs #:allow-other-keys)
1983 ;; Tests try to access /var/tmp, which is not possible in our build
1984 ;; environment. Let's give them another directory.
1985 ;; /tmp gets overriden in some tests, so we need another directory.
1986 ;; the only possibility is the output directory.
1987 (let ((tmp-dir (string-append (assoc-ref outputs "out") "/tmp")))
1989 (substitute* "tests/test-run.sh"
1990 (("/var/tmp") tmp-dir)
1991 ;; Tests create a temporary python script, so fix its shebang.
1992 (("/usr/bin/env python3") (which "python3"))
1993 ;; Tests call /usr/bin/env, so fix its path.
1994 (("/usr/bin/env") (which "env"))
1995 ;; Some tests try to access /usr, but that doesn't exist.
1996 ;; Give them /gnu instead.
1998 (("--ro-bind /bin /bin") "--ro-bind /gnu /bin")
1999 (("--ro-bind /sbin /sbin") "--ro-bind /gnu /sbin")
2000 (("--ro-bind /lib /lib") "--ro-bind /gnu /lib")
2001 ((" */bin/bash") (which "bash"))
2002 (("/bin/sh") (which "sh"))
2003 (("findmnt") (which "findmnt")))
2004 (substitute* "tests/libtest.sh"
2005 (("/var/tmp") tmp-dir)
2007 (("--ro-bind /bin /bin") "--ro-bind /gnu /bin")
2008 (("--ro-bind /sbin /sbin") "--ro-bind /gnu /sbin")
2009 (("--ro-bind /lib /lib") "--ro-bind /gnu /lib")))
2011 ;; Remove the directory we gave to tests to have a clean package.
2012 (add-after 'check 'remove-tmp-dir
2013 (lambda* (#:key outputs #:allow-other-keys)
2014 (delete-file-recursively (string-append (assoc-ref outputs "out") "/tmp"))
2016 (inputs (list libcap))
2017 (native-inputs (list python-wrapper util-linux))
2018 (home-page "https://github.com/containers/bubblewrap")
2019 (synopsis "Unprivileged sandboxing tool")
2020 (description "Bubblewrap is aimed at running applications in a sandbox,
2021 restricting their access to parts of the operating system or user data such as
2022 the home directory. Bubblewrap always creates a new mount namespace, and the
2023 user can specify exactly what parts of the file system should be made visible
2024 in the sandbox. These directories are mounted with the @code{nodev} option
2025 by default and can be made read-only.")
2026 (license license:lgpl2.0+)))
2028 (define-public bochs
2035 (uri (string-append "https://sourceforge.net/projects/bochs/files/bochs/"
2036 version "/bochs-" version ".tar.gz"))
2038 (base32 "0ymiwnfqg5npq2dk9ngidbbfn3qw8z6i491finhcaan7zldsn450"))))
2039 (build-system gnu-build-system)
2041 `(#:tests? #f)) ; no tests exist
2044 (home-page "http://bochs.sourceforge.net/")
2045 (synopsis "Emulator for x86 PC")
2047 "Bochs is an emulator which can emulate Intel x86 CPU, common I/O
2048 devices, and a custom BIOS. It can also be compiled to emulate many different
2049 x86 CPUs, from early 386 to the most recent x86-64 Intel and AMD processors.
2050 Bochs can run most Operating Systems inside the emulation including Linux,
2051 DOS or Microsoft Windows.")
2052 (license license:lgpl2.0+)))
2057 (version "4.14.1") ; please update the mini-os input as well
2061 (url "https://xenbits.xen.org/git-http/xen.git")
2062 (commit (string-append "RELEASE-" version))))
2063 (file-name (git-file-name name version))
2066 "1r90rvypw76ya9clqw5p02gm1k8hxz73f7gr95ca778nnzvb7xjw"))))
2067 (build-system gnu-build-system)
2070 (list "--enable-rpath"
2071 "--disable-qemu-traditional" ; It tries to do "git clone"
2072 "--disable-rombios" ; would try to "git clone" via etherboot.
2073 ;; TODO: Re-enable stubdom (it's "more secure" to use it).
2074 "--disable-stubdom" ; tries to "git clone" old patched newlib.
2075 (string-append "--with-initddir="
2076 (assoc-ref %outputs "out")
2078 (string-append "--with-system-qemu="
2079 (assoc-ref %build-inputs "qemu")
2080 "/bin/qemu-system-i386")
2081 (string-append "--with-system-seabios="
2082 (assoc-ref %build-inputs "seabios")
2083 "/share/firmware/bios.bin")
2084 (string-append "--with-system-ovmf="
2085 (assoc-ref %build-inputs "ovmf")
2086 "/share/firmware/ovmf_ia32.bin"))
2087 #:make-flags (list "-j" "1"
2088 "XEN_BUILD_DATE=Thu Jan 1 01:00:01 CET 1970"
2089 "XEN_BUILD_TIME=01:00:01"
2092 "SMBIOS_REL_DATE=01/01/1970"
2093 "VGABIOS_REL_DATE=01 Jan 1970"
2094 ; QEMU_TRADITIONAL_LOC
2096 "SYSCONFIG_DIR=/tmp/etc/default"
2097 (string-append "BASH_COMPLETION_DIR="
2098 (assoc-ref %outputs "out")
2099 "/etc/bash_completion.d")
2100 (string-append "BOOT_DIR="
2101 (assoc-ref %outputs "out")
2103 (string-append "DEBUG_DIR="
2104 (assoc-ref %outputs "out")
2106 (string-append "EFI_DIR="
2107 (assoc-ref %outputs "out")
2108 "/lib/efi") ; TODO lib64 ?
2109 "MINIOS_UPSTREAM_URL="
2110 ;(string-append "DISTDIR="
2111 ; (assoc-ref %outputs "out"))
2113 #:test-target "test"
2115 (modify-phases %standard-phases
2116 (add-after 'unpack 'unpack-mini-os
2117 (lambda* (#:key inputs #:allow-other-keys)
2118 (copy-recursively (assoc-ref inputs "mini-os") "extras/mini-os")
2120 (add-after 'unpack-mini-os 'patch
2121 (lambda* (#:key inputs outputs #:allow-other-keys)
2122 (substitute* "tools/firmware/Rules.mk"
2123 (("override XEN_TARGET_ARCH = x86_32")
2124 (string-append "override XEN_TARGET_ARCH = x86_32
2125 override CC = " (assoc-ref inputs "cross-gcc") "/bin/i686-linux-gnu-gcc"))
2127 (string-append "CFLAGS=-I" (assoc-ref inputs "cross-libc")
2129 (substitute* "config/x86_32.mk"
2130 (("CFLAGS += -m32 -march=i686")
2131 (string-append "CFLAGS += -march=i686 -I"
2132 (assoc-ref inputs "cross-libc")
2134 ;; /var is not in /gnu/store , so don't try to create it.
2135 (substitute* '("tools/Makefile"
2136 "tools/xenstore/Makefile"
2137 "tools/xenpaging/Makefile")
2138 (("\\$\\(INSTALL_DIR\\) .*XEN_(DUMP|LOG|RUN|LIB|PAGING)_DIR.*")
2140 (("\\$\\(INSTALL_DIR\\) .*XEN_(RUN|LIB)_STORED.*")
2142 ;; Prevent xen from creating /etc .
2143 (substitute* "tools/examples/Makefile"
2144 ((" install-readmes") "")
2145 ((" install-configs") ""))
2147 (substitute* "tools/pygrub/setup.py"
2149 ; TODO: extra_link_args = ['-Wl,-rpath=/opt/foo'],
2150 (string-append "runtime_library_dirs = ['"
2151 (assoc-ref outputs "out")
2152 "/lib'],\nlibrary_dirs =")))
2154 ;; This needs to be quoted:
2155 ;; <https://lists.gnu.org/archive/html/guix-devel/2022-03/msg00113.html>.
2156 (substitute* "xen/arch/x86/xen.lds.S"
2157 ((".note.gnu.build-id")
2158 "\".note.gnu.build-id\""))))
2159 (add-before 'configure 'patch-xen-script-directory
2160 (lambda* (#:key outputs #:allow-other-keys)
2161 (substitute* '("configure"
2164 (("XEN_SCRIPT_DIR=.*")
2165 (string-append "XEN_SCRIPT_DIR="
2166 (assoc-ref outputs "out")
2167 "/etc/xen/scripts")))
2169 (add-before 'configure 'set-environment-up
2170 (lambda* (#:key make-flags #:allow-other-keys)
2172 (string-contains x "cross-i686-linux"))
2173 (define (filter-environment! filter-predicate
2174 environment-variable-names)
2177 (let* ((env-value (getenv env-name))
2178 (search-path (search-path-as-string->list env-value))
2179 (new-search-path (filter filter-predicate
2181 (new-env-value (list->search-path-as-string
2182 new-search-path ":")))
2183 (setenv env-name new-env-value)))
2184 environment-variable-names))
2185 (setenv "CROSS_C_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
2186 (setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
2187 (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
2188 (filter-environment! cross?
2189 '("CROSS_C_INCLUDE_PATH" "CROSS_CPLUS_INCLUDE_PATH"
2190 "CROSS_LIBRARY_PATH"))
2191 (filter-environment! (lambda (e) (not (cross? e)))
2192 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
2194 ;; Guix tries to be helpful and automatically adds
2195 ;; mini-os-git-checkout/include to the include path,
2196 ;; but actually we don't want it to be there (yet).
2197 (filter-environment! (lambda (e)
2200 "mini-os-git-checkout")))
2201 '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
2203 (setenv "EFI_VENDOR" "guix")
2206 (lambda* (#:key make-flags #:allow-other-keys)
2207 (apply invoke "make" "world" make-flags))))))
2209 `(("acpica" ,acpica) ; TODO: patch iasl invocation.
2210 ("bridge-utils" ,bridge-utils) ; TODO: patch invocations.
2212 ("iproute" ,iproute) ; TODO: patch invocations.
2215 ("libyajl" ,libyajl)
2216 ("ncurses" ,ncurses)
2217 ("openssl" ,openssl)
2220 ("qemu" ,qemu-minimal)
2221 ("seabios" ,seabios)
2222 ("util-linux" ,util-linux "lib") ; uuid
2223 ; TODO: ocaml-findlib, ocaml-nox.
2224 ("xz" ,xz) ; for liblzma
2229 ("cmake" ,cmake-minimal)
2232 ("gettext" ,gettext-minimal)
2238 (url "https://xenbits.xen.org/git-http/mini-os.git")
2239 ;; This corresponds to (string-append "xen-RELEASE-" version))
2240 ;; at time of packaging, but upstream has unfortunately modified
2241 ;; existing tags in the past.
2242 (commit "0b4b7897e08b967a09bed2028a79fabff82342dd")))
2244 (base32 "1i8pcl19n60i2m9vlg79q3nknpj209c9ic5x10wxaicx45kc107f"))
2245 (file-name "mini-os-git-checkout")))
2248 ("pkg-config" ,pkg-config)
2249 ("python" ,python-2)
2251 ("cross-gcc" ,(cross-gcc "i686-linux-gnu"
2252 #:xbinutils (cross-binutils "i686-linux-gnu")
2253 #:libc (cross-libc "i686-linux-gnu")))
2254 ("cross-libc" ,(cross-libc "i686-linux-gnu")) ; header files
2255 ("cross-libc-static" ,(cross-libc "i686-linux-gnu") "static")))
2256 (home-page "https://xenproject.org/")
2257 (synopsis "Xen Virtual Machine Monitor")
2258 (description "This package provides the Xen Virtual Machine Monitor
2259 which is a hypervisor.")
2260 ;; TODO: Some files are licensed differently. List those.
2261 (license license:gpl2)
2262 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))))
2264 (define-public osinfo-db-tools
2266 (name "osinfo-db-tools")
2270 (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-tools-"
2275 "1h23a8nzdxjyvw44dwh903563n3b1z5skx8g0b1p1v5cif3iqpr5"))))
2276 (build-system meson-build-system)
2278 (list libsoup-minimal-2 libxml2 libxslt json-glib libarchive))
2281 gobject-introspection
2288 (home-page "https://gitlab.com/libosinfo/osinfo-db-tools")
2289 (synopsis "Tools for managing the osinfo database")
2290 (description "This package contains a set of tools to assist
2291 administrators and developers in managing the database.")
2292 (license license:lgpl2.0+)))
2294 (define-public osinfo-db
2297 (version "20211216")
2300 (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-"
2304 "10hhpciqk4lzsj66zkdvghd1i5zh6hg1fn9as4qhwcr1wnqfgv09"))))
2305 (build-system trivial-build-system)
2307 `(#:modules ((guix build utils))
2310 (use-modules (guix build utils))
2311 (let* ((out (assoc-ref %outputs "out"))
2312 (osinfo-dir (string-append out "/share/osinfo"))
2313 (source (assoc-ref %build-inputs "source"))
2315 (string-append (assoc-ref %build-inputs "osinfo-db-tools")
2316 "/bin/osinfo-db-import")))
2317 (mkdir-p osinfo-dir)
2318 (invoke osinfo-db-import "--dir" osinfo-dir source)))))
2320 (list intltool osinfo-db-tools))
2321 (home-page "https://gitlab.com/libosinfo/osinfo-db")
2322 (synopsis "Database of information about operating systems")
2323 (description "Osinfo-db provides the database files for use with the
2324 libosinfo library. It provides information about guest operating systems for
2325 use with virtualization provisioning tools")
2326 (license license:lgpl2.0+)))
2328 (define-public python-transient
2330 (name "python-transient")
2335 (uri (pypi-uri "transient" version))
2338 "148yiqrmcscsi6787y0f27i1y9cf0gcw3mqfv5frhpmsmv62mv5z"))))
2339 (build-system python-build-system)
2341 `(#:tests? #f ; Requires behave
2342 #:phases (modify-phases %standard-phases
2343 (add-after 'unpack 'fix-dependencies
2345 (substitute* "setup.py"
2350 (list python-beautifultable
2352 python-importlib-resources
2359 (list python-black python-mypy python-pyhamcrest python-twine))
2361 "https://github.com/ALSchwalm/transient")
2363 "QEMU Wrapper written in Python")
2365 "@code{transient} is a wrapper for QEMU allowing the creation of virtual
2366 machines with shared folder, ssh, and disk creation support.")
2367 (license license:expat)))