Commit | Line | Data |
---|---|---|
b15fcf9e | 1 | ;;; GNU Guix --- Functional package management for GNU |
4fc21327 | 2 | ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2020 Ludovic Courtès <ludo@gnu.org> |
ecfe88b7 | 3 | ;;; Copyright © 2015, 2016, 2017, 2018 Mark H Weaver <mhw@netris.org> |
355892e1 | 4 | ;;; Copyright © 2016, 2017, 2018. 2019, 2020 Efraim Flashner <efraim@flashner.co.il> |
fe420383 | 5 | ;;; Copyright © 2016, 2017 Ricardo Wurmus <rekado@elephly.net> |
f152208b | 6 | ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com> |
b376ec57 | 7 | ;;; Copyright © 2017 Andy Patterson <ajpatter@uwaterloo.ca> |
64b632f8 | 8 | ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com> |
f17bd3c6 | 9 | ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr> |
0def9120 | 10 | ;;; Copyright © 2018 Danny Milosavljevic <dannym@scratchpost.org> |
de7f03ce | 11 | ;;; Copyright © 2018 Sou Bunnbu <iyzsong@member.fsf.org> |
f6e55da0 | 12 | ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu> |
17043677 | 13 | ;;; Copyright © 2019 Guy Fleury Iteriteka <hoonandon@gmail.com> |
f468df9f | 14 | ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net> |
e9126381 | 15 | ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re> |
08cf730a | 16 | ;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com> |
35c43fcd | 17 | ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com> |
b15fcf9e LC |
18 | ;;; |
19 | ;;; This file is part of GNU Guix. | |
20 | ;;; | |
21 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
22 | ;;; under the terms of the GNU General Public License as published by | |
23 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
24 | ;;; your option) any later version. | |
25 | ;;; | |
26 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
27 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
28 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
29 | ;;; GNU General Public License for more details. | |
30 | ;;; | |
31 | ;;; You should have received a copy of the GNU General Public License | |
32 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
33 | ||
59132b80 | 34 | (define-module (gnu packages virtualization) |
161ed547 | 35 | #:use-module (gnu packages) |
309693e0 | 36 | #:use-module (gnu packages admin) |
35e8900d | 37 | #:use-module (gnu packages assembly) |
efcada41 | 38 | #:use-module (gnu packages attr) |
309693e0 | 39 | #:use-module (gnu packages autotools) |
e9126381 | 40 | #:use-module (gnu packages backup) |
ecfe88b7 | 41 | #:use-module (gnu packages bison) |
a0f6c3b3 | 42 | #:use-module (gnu packages check) |
35e8900d | 43 | #:use-module (gnu packages cmake) |
b15fcf9e | 44 | #:use-module (gnu packages compression) |
35e8900d | 45 | #:use-module (gnu packages cross-base) |
309693e0 RW |
46 | #:use-module (gnu packages curl) |
47 | #:use-module (gnu packages cyrus-sasl) | |
48 | #:use-module (gnu packages disk) | |
8fc7bd23 | 49 | #:use-module (gnu packages dns) |
fe420383 RW |
50 | #:use-module (gnu packages docbook) |
51 | #:use-module (gnu packages documentation) | |
35e8900d DM |
52 | #:use-module (gnu packages figlet) |
53 | #:use-module (gnu packages firmware) | |
ecfe88b7 | 54 | #:use-module (gnu packages flex) |
fb9472a3 | 55 | #:use-module (gnu packages fontutils) |
16a47f23 | 56 | #:use-module (gnu packages freedesktop) |
90a8ef8c | 57 | #:use-module (gnu packages gettext) |
efcada41 DC |
58 | #:use-module (gnu packages gl) |
59 | #:use-module (gnu packages glib) | |
a0f6c3b3 | 60 | #:use-module (gnu packages gnome) |
7714a069 | 61 | #:use-module (gnu packages gnupg) |
de7f03ce | 62 | #:use-module (gnu packages golang) |
a0f6c3b3 | 63 | #:use-module (gnu packages gtk) |
e55354b8 | 64 | #:use-module (gnu packages image) |
5d1601ea | 65 | #:use-module (gnu packages libbsd) |
fb9d7865 | 66 | #:use-module (gnu packages libusb) |
efcada41 DC |
67 | #:use-module (gnu packages linux) |
68 | #:use-module (gnu packages ncurses) | |
71d4ba52 | 69 | #:use-module (gnu packages nettle) |
fe420383 | 70 | #:use-module (gnu packages networking) |
308af634 | 71 | #:use-module (gnu packages onc-rpc) |
7714a069 | 72 | #:use-module (gnu packages package-management) |
06da1a6b | 73 | #:use-module (gnu packages perl) |
efcada41 | 74 | #:use-module (gnu packages pkg-config) |
309693e0 | 75 | #:use-module (gnu packages polkit) |
fe420383 | 76 | #:use-module (gnu packages protobuf) |
efcada41 | 77 | #:use-module (gnu packages python) |
589e3f4e | 78 | #:use-module (gnu packages python-web) |
44d10b1f | 79 | #:use-module (gnu packages python-xyz) |
28e3569f | 80 | #:use-module (gnu packages pulseaudio) |
5d4a8f9b | 81 | #:use-module (gnu packages selinux) |
efcada41 | 82 | #:use-module (gnu packages sdl) |
0411aca8 | 83 | #:use-module (gnu packages sphinx) |
38b9ce44 | 84 | #:use-module (gnu packages spice) |
efcada41 | 85 | #:use-module (gnu packages texinfo) |
71d4ba52 | 86 | #:use-module (gnu packages textutils) |
309693e0 RW |
87 | #:use-module (gnu packages tls) |
88 | #:use-module (gnu packages web) | |
35e8900d | 89 | #:use-module (gnu packages wget) |
efcada41 | 90 | #:use-module (gnu packages xdisorg) |
309693e0 | 91 | #:use-module (gnu packages xml) |
8981465b | 92 | #:use-module (gnu packages xorg) |
6da90719 | 93 | #:use-module (guix build-system cmake) |
efcada41 | 94 | #:use-module (guix build-system gnu) |
de7f03ce | 95 | #:use-module (guix build-system go) |
cfd9913f | 96 | #:use-module (guix build-system meson) |
7cd2032f | 97 | #:use-module (guix build-system python) |
a838fa28 | 98 | #:use-module (guix build-system trivial) |
efcada41 | 99 | #:use-module (guix download) |
7714a069 | 100 | #:use-module (guix git-download) |
b23b9667 | 101 | #:use-module ((guix licenses) #:prefix license:) |
efcada41 DC |
102 | #:use-module (guix packages) |
103 | #:use-module (guix utils) | |
355892e1 EF |
104 | #:use-module (srfi srfi-1) |
105 | #:use-module (ice-9 match)) | |
b15fcf9e | 106 | |
ce0be567 | 107 | (define (qemu-patch commit file-name sha256-bv) |
e38a71ee LC |
108 | "Return an origin for COMMIT." |
109 | (origin | |
110 | (method url-fetch) | |
111 | (uri (string-append | |
112 | "http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h=" | |
113 | commit)) | |
ce0be567 | 114 | (hash (content-hash sha256-bv sha256)) |
e38a71ee LC |
115 | (file-name file-name))) |
116 | ||
06da1a6b | 117 | (define-public qemu |
b15fcf9e | 118 | (package |
06da1a6b | 119 | (name "qemu") |
35c43fcd | 120 | (version "5.0.0") |
b15fcf9e LC |
121 | (source (origin |
122 | (method url-fetch) | |
2de7d137 | 123 | (uri (string-append "https://download.qemu.org/qemu-" |
fbd6fb1a | 124 | version ".tar.xz")) |
b15fcf9e LC |
125 | (sha256 |
126 | (base32 | |
35c43fcd | 127 | "1dlcwyshdp94fwd30pddxf9bn2q8dfw5jsvry2gvdj551wmaj4rg")))) |
b15fcf9e LC |
128 | (build-system gnu-build-system) |
129 | (arguments | |
08cf730a | 130 | `(;; Running tests in parallel can occasionally lead to failures, like: |
219b4556 LC |
131 | ;; boot_sector_test: assertion failed (signature == SIGNATURE): (0x00000000 == 0x0000dead) |
132 | #:parallel-tests? #f | |
4fc21327 LC |
133 | |
134 | ;; FIXME: Disable tests on i686 to work around | |
135 | ;; <https://bugs.gnu.org/40527>. | |
136 | #:tests? ,(or (%current-target-system) | |
137 | (not (string=? "i686-linux" (%current-system)))) | |
138 | ||
0e5d0f66 | 139 | #:configure-flags (list "--enable-usb-redir" "--enable-opengl" |
0411aca8 | 140 | "--enable-docs" |
0e5d0f66 RH |
141 | (string-append "--smbd=" |
142 | (assoc-ref %outputs "out") | |
28e3569f OP |
143 | "/libexec/samba-wrapper") |
144 | "--audio-drv-list=alsa,pa,sdl") | |
a1570c89 MB |
145 | ;; Make build and test output verbose to facilitate investigation upon failure. |
146 | #:make-flags '("V=1") | |
08cf730a MO |
147 | #:modules ((srfi srfi-1) |
148 | (ice-9 match) | |
149 | ,@%gnu-build-system-modules) | |
05051e8b LC |
150 | #:phases |
151 | (modify-phases %standard-phases | |
08cf730a MO |
152 | (add-after 'set-paths 'hide-glibc |
153 | (lambda* (#:key inputs #:allow-other-keys) | |
154 | ;; Work around https://issues.guix.info/issue/36882. We need to | |
155 | ;; remove glibc from C_INCLUDE_PATH so that the one hardcoded in GCC, | |
156 | ;; at the bottom of GCC include search-path is used. | |
157 | (let* ((filters '("libc")) | |
158 | (input-directories | |
159 | (filter-map (lambda (input) | |
160 | (match input | |
161 | ((name . dir) | |
162 | (and (not (member name filters)) | |
163 | dir)))) | |
164 | inputs))) | |
165 | (set-path-environment-variable "C_INCLUDE_PATH" | |
166 | '("include") | |
167 | input-directories) | |
168 | #t))) | |
35c43fcd MB |
169 | (add-after 'patch-source-shebangs 'patch-/bin/sh-references |
170 | (lambda _ | |
171 | ;; Ensure the executables created by these source files reference | |
172 | ;; /bin/sh from the store so they work inside the build container. | |
173 | (substitute* '("block/cloop.c" "migration/exec.c" | |
174 | "net/tap.c" "tests/qtest/libqtest.c") | |
175 | (("/bin/sh") (which "sh"))) | |
176 | #t)) | |
05051e8b LC |
177 | (replace 'configure |
178 | (lambda* (#:key inputs outputs (configure-flags '()) | |
20c263b0 | 179 | #:allow-other-keys) |
05051e8b LC |
180 | ;; The `configure' script doesn't understand some of the |
181 | ;; GNU options. Thus, add a new phase that's compatible. | |
182 | (let ((out (assoc-ref outputs "out"))) | |
183 | (setenv "SHELL" (which "bash")) | |
b15fcf9e | 184 | |
05051e8b | 185 | ;; While we're at it, patch for tests. |
35c43fcd MB |
186 | (substitute* "tests/qemu-iotests/check" |
187 | (("#!/usr/bin/env python3") | |
188 | (string-append "#!" (which "python3")))) | |
189 | ||
190 | ;; Ensure config.status gets the correct shebang off the bat. | |
191 | ;; The build system gets confused if we change it later and | |
192 | ;; attempts to re-run the whole configury, and fails. | |
193 | (substitute* "configure" | |
194 | (("#!/bin/sh") | |
195 | (string-append "#!" (which "sh")))) | |
50731c51 | 196 | |
05051e8b LC |
197 | ;; The binaries need to be linked against -lrt. |
198 | (setenv "LDFLAGS" "-lrt") | |
642d2db5 TGR |
199 | (apply invoke |
200 | `("./configure" | |
201 | ,(string-append "--cc=" (which "gcc")) | |
202 | ;; Some architectures insist on using HOST_CC | |
203 | ,(string-append "--host-cc=" (which "gcc")) | |
204 | "--disable-debug-info" ; save build space | |
205 | "--enable-virtfs" ; just to be sure | |
206 | ,(string-append "--prefix=" out) | |
207 | ,(string-append "--sysconfdir=/etc") | |
208 | ,@configure-flags))))) | |
05051e8b LC |
209 | (add-after 'install 'install-info |
210 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
211 | ;; Install the Info manual, unless Texinfo is missing. | |
642d2db5 TGR |
212 | (when (assoc-ref inputs "texinfo") |
213 | (let* ((out (assoc-ref outputs "out")) | |
214 | (dir (string-append out "/share/info"))) | |
215 | (invoke "make" "info") | |
216 | (for-each (lambda (info) | |
217 | (install-file info dir)) | |
218 | (find-files "." "\\.info")))) | |
219 | #t)) | |
0e5d0f66 RH |
220 | ;; Create a wrapper for Samba. This allows QEMU to use Samba without |
221 | ;; pulling it in as an input. Note that you need to explicitly install | |
222 | ;; Samba in your Guix profile for Samba support. | |
223 | (add-after 'install-info 'create-samba-wrapper | |
224 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
225 | (let* ((out (assoc-ref %outputs "out")) | |
226 | (libexec (string-append out "/libexec"))) | |
227 | (call-with-output-file "samba-wrapper" | |
228 | (lambda (port) | |
229 | (format port "#!/bin/sh | |
230 | exec smbd $@"))) | |
231 | (chmod "samba-wrapper" #o755) | |
232 | (install-file "samba-wrapper" libexec)) | |
233 | #t)) | |
04b9b7bb RH |
234 | (add-before 'check 'disable-unusable-tests |
235 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
43bec6d0 | 236 | (substitute* "tests/Makefile.include" |
05051e8b LC |
237 | ;; Comment out the test-qga test, which needs /sys and |
238 | ;; fails within the build environment. | |
239 | (("check-unit-.* tests/test-qga" all) | |
240 | (string-append "# " all))) | |
04b9b7bb RH |
241 | (substitute* "tests/Makefile.include" |
242 | ;; Comment out the test-char test, which needs networking and | |
243 | ;; fails within the build environment. | |
244 | (("check-unit-.* tests/test-char" all) | |
245 | (string-append "# " all))) | |
05051e8b | 246 | #t))))) |
b15fcf9e | 247 | (inputs ; TODO: Add optional inputs. |
2f042822 DC |
248 | `(("alsa-lib" ,alsa-lib) |
249 | ("attr" ,attr) | |
b15fcf9e | 250 | ("glib" ,glib) |
90a8ef8c | 251 | ("gtk+" ,gtk+) |
fa65e84a | 252 | ("libaio" ,libaio) |
2f042822 | 253 | ("libattr" ,attr) |
a06051e1 | 254 | ("libcacard" ,libcacard) ; smartcard support |
35c43fcd | 255 | ("libcap-ng" ,libcap-ng) ; virtfs support requires libcap-ng & libattr |
9a187b39 AP |
256 | ("libdrm" ,libdrm) |
257 | ("libepoxy" ,libepoxy) | |
513885b5 | 258 | ("libjpeg" ,libjpeg-turbo) |
2f042822 | 259 | ("libpng" ,libpng) |
34a28c13 | 260 | ("libseccomp" ,libseccomp) |
2f042822 DC |
261 | ("libusb" ,libusb) ;USB pass-through support |
262 | ("mesa" ,mesa) | |
263 | ("ncurses" ,ncurses) | |
264 | ;; ("pciutils" ,pciutils) | |
2b2fdd45 | 265 | ("pixman" ,pixman) |
28e3569f | 266 | ("pulseaudio" ,pulseaudio) |
27b52c1f | 267 | ("sdl2" ,sdl2) |
38b9ce44 | 268 | ("spice" ,spice) |
b376ec57 | 269 | ("usbredir" ,usbredir) |
b15fcf9e | 270 | ("util-linux" ,util-linux) |
1e2640ba | 271 | ("vde2" ,vde2) |
38b9ce44 | 272 | ("virglrenderer" ,virglrenderer) |
2f042822 | 273 | ("zlib" ,zlib))) |
90a8ef8c RH |
274 | (native-inputs `(("gettext" ,gettext-minimal) |
275 | ("glib:bin" ,glib "bin") ; gtester, etc. | |
2f042822 | 276 | ("perl" ,perl) |
ecfe88b7 MW |
277 | ("flex" ,flex) |
278 | ("bison" ,bison) | |
2f042822 | 279 | ("pkg-config" ,pkg-config) |
27b52c1f | 280 | ("python-wrapper" ,python-wrapper) |
0411aca8 | 281 | ("python-sphinx" ,python-sphinx) |
2f042822 | 282 | ("texinfo" ,texinfo))) |
ce9fbae1 | 283 | (home-page "https://www.qemu.org") |
06da1a6b | 284 | (synopsis "Machine emulator and virtualizer") |
72b9eebf | 285 | (description |
50731c51 | 286 | "QEMU is a generic machine emulator and virtualizer. |
72b9eebf LC |
287 | |
288 | When used as a machine emulator, QEMU can run OSes and programs made for one | |
50731c51 LC |
289 | machine (e.g. an ARM board) on a different machine---e.g., your own PC. By |
290 | using dynamic translation, it achieves very good performance. | |
72b9eebf LC |
291 | |
292 | When used as a virtualizer, QEMU achieves near native performances by | |
293 | executing the guest code directly on the host CPU. QEMU supports | |
294 | virtualization when executing under the Xen hypervisor or using | |
295 | the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86, | |
50731c51 LC |
296 | server and embedded PowerPC, and S390 guests.") |
297 | ||
298 | ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'. | |
b23b9667 | 299 | (license license:gpl2) |
f47638a3 LC |
300 | |
301 | ;; Several tests fail on MIPS; see <http://hydra.gnu.org/build/117914>. | |
654de94e JN |
302 | (supported-systems (fold delete %supported-systems |
303 | '("mips64el-linux" "i586-gnu"))))) | |
50731c51 | 304 | |
06da1a6b | 305 | (define-public qemu-minimal |
355892e1 | 306 | ;; QEMU without GUI support, only supporting the host's architecture |
06da1a6b LC |
307 | (package (inherit qemu) |
308 | (name "qemu-minimal") | |
355892e1 EF |
309 | (synopsis |
310 | "Machine emulator and virtualizer (without GUI) for the host architecture") | |
06da1a6b | 311 | (arguments |
b376ec57 AP |
312 | (substitute-keyword-arguments (package-arguments qemu) |
313 | ((#:configure-flags _ '(list)) | |
355892e1 | 314 | ;; Restrict to the host's architecture. |
a7e6ec18 EF |
315 | (match (car (string-split (or (%current-target-system) |
316 | (%current-system)) | |
317 | #\-)) | |
318 | ("i686" | |
319 | '(list "--target-list=i386-softmmu")) | |
320 | ("x86_64" | |
321 | '(list "--target-list=i386-softmmu,x86_64-softmmu")) | |
322 | ("mips64" | |
323 | '(list (string-append "--target-list=mips-softmmu,mipsel-softmmu," | |
324 | "mips64-softmmu,mips64el-softmmu"))) | |
325 | ("mips" | |
326 | '(list "--target-list=mips-softmmu,mipsel-softmmu")) | |
327 | ("aarch64" | |
328 | '(list "--target-list=arm-softmmu,aarch64-softmmu")) | |
329 | ("arm" | |
330 | '(list "--target-list=arm-softmmu")) | |
331 | ("alpha" | |
332 | '(list "--target-list=alpha-softmmu")) | |
333 | ("powerpc64" | |
334 | '(list "--target-list=ppc-softmmu,ppc64-softmmu")) | |
335 | ("powerpc" | |
336 | '(list "--target-list=ppc-softmmu")) | |
337 | ("s390" | |
338 | '(list "--target-list=s390x-softmmu")) | |
339 | ("riscv" | |
340 | '(list "--target-list=riscv32-softmmu,riscv64-softmmu")) | |
341 | (else ; An empty list actually builds all the targets. | |
342 | ''()))))) | |
06da1a6b LC |
343 | |
344 | ;; Remove dependencies on optional libraries, notably GUI libraries. | |
90a8ef8c RH |
345 | (native-inputs (fold alist-delete (package-native-inputs qemu) |
346 | '("gettext"))) | |
06da1a6b | 347 | (inputs (fold alist-delete (package-inputs qemu) |
90a8ef8c | 348 | '("libusb" "mesa" "sdl2" "spice" "virglrenderer" "gtk+" |
a414d6ac CB |
349 | "usbredir" "libdrm" "libepoxy" "pulseaudio" "vde2" |
350 | "libcacard"))))) | |
309693e0 | 351 | |
a0f6c3b3 RW |
352 | (define-public libosinfo |
353 | (package | |
354 | (name "libosinfo") | |
cfd9913f | 355 | (version "1.7.1") |
a0f6c3b3 RW |
356 | (source |
357 | (origin | |
358 | (method url-fetch) | |
d701f8bd | 359 | (uri (string-append "https://releases.pagure.org/libosinfo/libosinfo-" |
cfd9913f | 360 | version ".tar.xz")) |
a0f6c3b3 RW |
361 | (sha256 |
362 | (base32 | |
cfd9913f CB |
363 | "1s97sv24bybggjx6hgqba2qdqz3ivfpd4cmkh4zm5y59sim109mv")))) |
364 | (build-system meson-build-system) | |
a0f6c3b3 | 365 | (arguments |
d701f8bd | 366 | `(#:configure-flags |
cfd9913f | 367 | (list (string-append "-Dwith-usb-ids-path=" |
d701f8bd | 368 | (assoc-ref %build-inputs "usb.ids")) |
cfd9913f | 369 | (string-append "-Dwith-pci-ids-path=" |
da6f9ace BW |
370 | (assoc-ref %build-inputs "pci.ids"))) |
371 | #:phases | |
372 | (modify-phases %standard-phases | |
373 | (add-after 'unpack 'patch-osinfo-path | |
374 | (lambda* (#:key inputs #:allow-other-keys) | |
375 | (substitute* "osinfo/osinfo_loader.c" | |
376 | (("path = DATA_DIR.*") | |
377 | (string-append "path = \"" (assoc-ref inputs "osinfo-db") | |
378 | "/share/osinfo\";"))) | |
379 | #t))))) | |
a0f6c3b3 RW |
380 | (inputs |
381 | `(("libsoup" ,libsoup) | |
382 | ("libxml2" ,libxml2) | |
383 | ("libxslt" ,libxslt) | |
da6f9ace | 384 | ("osinfo-db" ,osinfo-db))) |
a0f6c3b3 | 385 | (native-inputs |
d1e766e5 | 386 | `(("glib" ,glib "bin") ; glib-mkenums, etc. |
da6f9ace | 387 | ("gobject-introspection" ,gobject-introspection) |
a0f6c3b3 RW |
388 | ("gtk-doc" ,gtk-doc) |
389 | ("vala" ,vala) | |
390 | ("intltool" ,intltool) | |
391 | ("pkg-config" ,pkg-config) | |
392 | ("pci.ids" | |
393 | ,(origin | |
394 | (method url-fetch) | |
d701f8bd | 395 | (uri "https://github.com/pciutils/pciids/raw/ad02084f0bc143e3c15e31a6152a3dfb1d7a3156/pci.ids") |
a0f6c3b3 RW |
396 | (sha256 |
397 | (base32 | |
d701f8bd | 398 | "0kfhpj5rnh24hz2714qhfmxk281vwc2w50sm73ggw5d15af7zfsw")))) |
a0f6c3b3 RW |
399 | ("usb.ids" |
400 | ,(origin | |
401 | (method url-fetch) | |
0d73f148 | 402 | (uri "https://svn.code.sf.net/p/linux-usb/repo/trunk/htdocs/usb.ids?r=2681") |
b02733d4 | 403 | (file-name "usb.ids") |
a0f6c3b3 RW |
404 | (sha256 |
405 | (base32 | |
0d73f148 | 406 | "1m6yhvz5k8aqzxgk7xj3jkk8frl1hbv0h3vgj4wbnvnx79qnvz3r")))))) |
a0f6c3b3 RW |
407 | (home-page "https://libosinfo.org/") |
408 | (synopsis "Operating system information database") | |
409 | (description "libosinfo is a GObject based library API for managing | |
410 | information about operating systems, hypervisors and the (virtual) hardware | |
411 | devices they can support. It includes a database containing device metadata | |
412 | and provides APIs to match/identify optimal devices for deploying an operating | |
413 | system on a hypervisor. Via GObject Introspection, the API is available in | |
414 | all common programming languages. Vala bindings are also provided.") | |
415 | ;; The library files are released under LGPLv2.1 or later; the source | |
416 | ;; files in the "tools" directory are released under GPLv2+. | |
b23b9667 | 417 | (license (list license:lgpl2.1+ license:gpl2+)))) |
a0f6c3b3 | 418 | |
5d4a8f9b SB |
419 | (define-public lxc |
420 | (package | |
421 | (name "lxc") | |
cc7058b2 | 422 | (version "3.1.0") |
5d4a8f9b SB |
423 | (source (origin |
424 | (method url-fetch) | |
425 | (uri (string-append | |
426 | "https://linuxcontainers.org/downloads/lxc/lxc-" | |
427 | version ".tar.gz")) | |
428 | (sha256 | |
429 | (base32 | |
cc7058b2 | 430 | "1igxqgx8q9cp15mcp1y8j564bl85ijw04jcmgb1s5bmfbg1751sd")))) |
5d4a8f9b SB |
431 | (build-system gnu-build-system) |
432 | (native-inputs | |
433 | `(("pkg-config" ,pkg-config))) | |
434 | (inputs | |
435 | `(("gnutls" ,gnutls) | |
436 | ("libcap" ,libcap) | |
437 | ("libseccomp" ,libseccomp) | |
438 | ("libselinux" ,libselinux))) | |
439 | (arguments | |
2e625ef7 TGR |
440 | `(#:configure-flags |
441 | (list (string-append "--docdir=" (assoc-ref %outputs "out") | |
442 | "/share/doc/" ,name "-" ,version) | |
443 | "--sysconfdir=/etc" | |
444 | "--localstatedir=/var") | |
5d4a8f9b SB |
445 | #:phases |
446 | (modify-phases %standard-phases | |
447 | (replace 'install | |
448 | (lambda* (#:key outputs #:allow-other-keys) | |
449 | (let* ((out (assoc-ref outputs "out")) | |
450 | (bashcompdir (string-append out "/etc/bash_completion.d"))) | |
d6870d10 | 451 | (invoke "make" "install" |
5d4a8f9b SB |
452 | (string-append "bashcompdir=" bashcompdir) |
453 | ;; Don't install files into /var and /etc. | |
454 | "LXCPATH=/tmp/var/lib/lxc" | |
455 | "localstatedir=/tmp/var" | |
456 | "sysconfdir=/tmp/etc" | |
d6870d10 | 457 | "sysconfigdir=/tmp/etc/default"))))))) |
5d4a8f9b SB |
458 | (synopsis "Linux container tools") |
459 | (home-page "https://linuxcontainers.org/") | |
460 | (description | |
461 | "LXC is a userspace interface for the Linux kernel containment features. | |
462 | Through a powerful API and simple tools, it lets Linux users easily create and | |
463 | manage system or application containers.") | |
b23b9667 | 464 | (license license:lgpl2.1+))) |
5d4a8f9b | 465 | |
309693e0 RW |
466 | (define-public libvirt |
467 | (package | |
468 | (name "libvirt") | |
aa1f0896 | 469 | (version "5.8.0") |
41097b2d TGR |
470 | (source |
471 | (origin | |
472 | (method url-fetch) | |
473 | (uri (string-append "https://libvirt.org/sources/libvirt-" | |
474 | version ".tar.xz")) | |
475 | (sha256 | |
aa1f0896 MÁAV |
476 | (base32 "0m8cqaqflvys5kaqpvb0qr4k365j09jc5xk6x70yvg8qkcl2hcz2")) |
477 | (patches | |
478 | (search-patches "libvirt-create-machine-cgroup.patch")))) | |
309693e0 RW |
479 | (build-system gnu-build-system) |
480 | (arguments | |
bd9eb384 | 481 | `(#:configure-flags |
ef640db2 SB |
482 | (list "--with-qemu" |
483 | "--with-qemu-user=nobody" | |
484 | "--with-qemu-group=kvm" | |
485 | "--with-polkit" | |
175047cd TGR |
486 | (string-append "--docdir=" (assoc-ref %outputs "out") "/share/doc/" |
487 | ,name "-" ,version) | |
a4b93921 | 488 | "--sysconfdir=/etc" |
309693e0 RW |
489 | "--localstatedir=/var") |
490 | #:phases | |
491 | (modify-phases %standard-phases | |
bd9eb384 TGR |
492 | (add-before 'configure 'fix-BOURNE_SHELL-definition |
493 | ;; BOURNE_SHELL is hard-#defined to ‘/bin/sh’, causing test failures. | |
309693e0 | 494 | (lambda _ |
bd9eb384 | 495 | (substitute* "config.h.in" |
309693e0 RW |
496 | (("/bin/sh") (which "sh"))) |
497 | #t)) | |
308af634 MB |
498 | (add-before 'configure 'patch-libtirpc-file-names |
499 | (lambda* (#:key inputs #:allow-other-keys) | |
500 | ;; libvirt uses an m4 macro instead of pkg-config to determine where | |
501 | ;; the RPC headers are located. Tell it to look in the right place. | |
502 | (substitute* "configure" | |
503 | (("/usr/include/tirpc") ;defined in m4/virt-xdr.m4 | |
504 | (string-append (assoc-ref inputs "libtirpc") | |
505 | "/include/tirpc"))) | |
506 | #t)) | |
bd9eb384 TGR |
507 | (add-before 'configure 'disable-broken-tests |
508 | (lambda _ | |
509 | (let ((tests (list "commandtest" ; hangs idly | |
b905ebed JK |
510 | "qemuxml2argvtest" ; fails |
511 | "qemuhotplugtest" ; fails | |
bd9eb384 TGR |
512 | "virnetsockettest" ; tries to network |
513 | "virshtest"))) ; fails | |
514 | (substitute* "tests/Makefile.in" | |
515 | (((format #f "(~a)\\$\\(EXEEXT\\)" (string-join tests "|"))) | |
516 | "")) | |
517 | #t))) | |
a4b93921 SB |
518 | (replace 'install |
519 | ;; Since the sysconfdir and localstatedir should be /etc and /var | |
520 | ;; at runtime, we must prevent writing to them at installation | |
521 | ;; time. | |
7aee2f57 TGR |
522 | (lambda* (#:key make-flags #:allow-other-keys) |
523 | (apply invoke "make" "install" | |
524 | "sysconfdir=/tmp/etc" | |
525 | "localstatedir=/tmp/var" | |
ef640db2 | 526 | make-flags)))))) |
309693e0 RW |
527 | (inputs |
528 | `(("libxml2" ,libxml2) | |
8981465b RH |
529 | ("eudev" ,eudev) |
530 | ("libpciaccess" ,libpciaccess) | |
309693e0 RW |
531 | ("gnutls" ,gnutls) |
532 | ("dbus" ,dbus) | |
309693e0 RW |
533 | ("libpcap" ,libpcap) |
534 | ("libnl" ,libnl) | |
308af634 | 535 | ("libtirpc" ,libtirpc) ;for <rpc/rpc.h> |
bb93042c | 536 | ("libuuid" ,util-linux "lib") |
308af634 | 537 | ("lvm2" ,lvm2) ;for libdevmapper |
309693e0 RW |
538 | ("curl" ,curl) |
539 | ("openssl" ,openssl) | |
540 | ("cyrus-sasl" ,cyrus-sasl) | |
309693e0 | 541 | ("libyajl" ,libyajl) |
8fc7bd23 SB |
542 | ("audit" ,audit) |
543 | ("dmidecode" ,dmidecode) | |
544 | ("dnsmasq" ,dnsmasq) | |
545 | ("ebtables" ,ebtables) | |
546 | ("iproute" ,iproute) | |
547 | ("iptables" ,iptables))) | |
309693e0 | 548 | (native-inputs |
2f110b32 | 549 | `(("xsltproc" ,libxslt) |
b8fb94d5 TGR |
550 | ("perl" ,perl) |
551 | ("pkg-config" ,pkg-config) | |
552 | ("polkit" ,polkit) | |
aa1f0896 | 553 | ("python" ,python-wrapper))) |
2e508b6d | 554 | (home-page "https://libvirt.org") |
309693e0 RW |
555 | (synopsis "Simple API for virtualization") |
556 | (description "Libvirt is a C toolkit to interact with the virtualization | |
557 | capabilities of recent versions of Linux. The library aims at providing long | |
558 | term stable C API initially for the Xen paravirtualization but should be able | |
559 | to integrate other virtualization mechanisms if needed.") | |
b23b9667 | 560 | (license license:lgpl2.1+))) |
597ea122 RW |
561 | |
562 | (define-public libvirt-glib | |
563 | (package | |
564 | (name "libvirt-glib") | |
a9838ee0 | 565 | (version "3.0.0") |
597ea122 RW |
566 | (source (origin |
567 | (method url-fetch) | |
568 | (uri (string-append "ftp://libvirt.org/libvirt/glib/" | |
569 | "libvirt-glib-" version ".tar.gz")) | |
570 | (sha256 | |
571 | (base32 | |
a9838ee0 | 572 | "1zpbv4ninc57c9rw4zmmkvvqn7154iv1qfr20kyxn8xplalqrzvz")))) |
597ea122 | 573 | (build-system gnu-build-system) |
597ea122 | 574 | (inputs |
7e2c050a | 575 | `(("openssl" ,openssl) |
597ea122 | 576 | ("cyrus-sasl" ,cyrus-sasl) |
7e2c050a | 577 | ("lvm2" ,lvm2) ; for libdevmapper |
597ea122 RW |
578 | ("libyajl" ,libyajl))) |
579 | (native-inputs | |
580 | `(("pkg-config" ,pkg-config) | |
581 | ("intltool" ,intltool) | |
582 | ("glib" ,glib "bin") | |
583 | ("vala" ,vala))) | |
7e2c050a TGR |
584 | (propagated-inputs |
585 | ;; ‘Required:’ by the installed .pc files. | |
586 | `(("glib" ,glib) | |
587 | ("libvirt" ,libvirt) | |
588 | ("libxml2" ,libxml2) | |
589 | ("gobject-introspection" ,gobject-introspection))) | |
b3fee5c1 | 590 | (home-page "https://libvirt.org") |
597ea122 RW |
591 | (synopsis "GLib wrapper around libvirt") |
592 | (description "libvirt-glib wraps the libvirt library to provide a | |
593 | high-level object-oriented API better suited for glib-based applications, via | |
594 | three libraries: | |
595 | ||
596 | @enumerate | |
597 | @item libvirt-glib - GLib main loop integration & misc helper APIs | |
598 | @item libvirt-gconfig - GObjects for manipulating libvirt XML documents | |
599 | @item libvirt-gobject - GObjects for managing libvirt objects | |
600 | @end enumerate | |
601 | ") | |
b23b9667 | 602 | (license license:lgpl2.1+))) |
7cd2032f RW |
603 | |
604 | (define-public python-libvirt | |
605 | (package | |
606 | (name "python-libvirt") | |
0e00c1c4 | 607 | (version "5.8.0") |
cb94ae38 TGR |
608 | (source |
609 | (origin | |
610 | (method url-fetch) | |
cb94ae38 TGR |
611 | (uri (string-append "https://libvirt.org/sources/python/libvirt-python-" |
612 | version ".tar.gz")) | |
613 | (sha256 | |
0e00c1c4 | 614 | (base32 "0kyz3lx49d8p75mvbzinxc1zgs8g7adn77y9bm15b8b4ad9zl5s6")))) |
7cd2032f RW |
615 | (build-system python-build-system) |
616 | (arguments | |
617 | `(#:phases | |
618 | (modify-phases %standard-phases | |
619 | (add-after 'unpack 'patch-nosetests-path | |
620 | (lambda* (#:key inputs #:allow-other-keys) | |
621 | (substitute* "setup.py" | |
9271dfdd SB |
622 | (("\"/usr/bin/nosetests\"") |
623 | (string-append "\"" (which "nosetests") "\"")) | |
624 | (("self\\.spawn\\(\\[sys\\.executable, nose\\]\\)") | |
625 | (format #f "self.spawn([\"~a\", nose])" (which "bash")))) | |
7cd2032f RW |
626 | #t))))) |
627 | (inputs | |
482d9591 HG |
628 | `(("libvirt" ,libvirt))) |
629 | (propagated-inputs | |
630 | `(("python-lxml" ,python-lxml))) | |
7cd2032f RW |
631 | (native-inputs |
632 | `(("pkg-config" ,pkg-config) | |
633 | ("python-nose" ,python-nose))) | |
b3fee5c1 | 634 | (home-page "https://libvirt.org") |
7cd2032f RW |
635 | (synopsis "Python bindings to libvirt") |
636 | (description "This package provides Python bindings to the libvirt | |
637 | virtualization library.") | |
b23b9667 | 638 | (license license:lgpl2.1+))) |
7cd2032f RW |
639 | |
640 | (define-public python2-libvirt | |
641 | (package-with-python2 python-libvirt)) | |
2f82b53b RW |
642 | |
643 | (define-public virt-manager | |
644 | (package | |
645 | (name "virt-manager") | |
845bf4f4 | 646 | (version "2.2.1") |
2f82b53b RW |
647 | (source (origin |
648 | (method url-fetch) | |
649 | (uri (string-append "https://virt-manager.org/download/sources" | |
650 | "/virt-manager/virt-manager-" | |
651 | version ".tar.gz")) | |
652 | (sha256 | |
653 | (base32 | |
845bf4f4 | 654 | "06ws0agxlip6p6n3n43knsnjyd91gqhh2dadgc33wl9lx1k8vn6g")))) |
2f82b53b RW |
655 | (build-system python-build-system) |
656 | (arguments | |
af7014a1 | 657 | `(#:use-setuptools? #f ; uses custom distutils 'install' command |
20f524a4 CB |
658 | #:test-target "test_ui" |
659 | #:tests? #f ; TODO The tests currently fail | |
660 | ; RuntimeError: Loop condition wasn't | |
661 | ; met | |
f023685d AP |
662 | #:imported-modules ((guix build glib-or-gtk-build-system) |
663 | ,@%python-build-system-modules) | |
2f82b53b RW |
664 | #:modules ((ice-9 match) |
665 | (srfi srfi-26) | |
666 | (guix build python-build-system) | |
f023685d | 667 | ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:) |
2f82b53b RW |
668 | (guix build utils)) |
669 | #:phases | |
670 | (modify-phases %standard-phases | |
671 | (add-after 'unpack 'fix-setup | |
672 | (lambda* (#:key outputs #:allow-other-keys) | |
845bf4f4 | 673 | (substitute* "virtinst/buildconfig.py" |
2f82b53b RW |
674 | (("/usr") (assoc-ref outputs "out"))) |
675 | #t)) | |
845bf4f4 MÁAV |
676 | (add-after 'unpack 'fix-qemu-img-reference |
677 | (lambda* (#:key inputs #:allow-other-keys) | |
678 | (substitute* "virtconv/formats.py" | |
b905ebed JK |
679 | (("/usr(/bin/qemu-img)" _ suffix) |
680 | (string-append (assoc-ref inputs "qemu") suffix))) | |
845bf4f4 | 681 | #t)) |
4ad8fbd1 AP |
682 | (add-after 'unpack 'fix-default-uri |
683 | (lambda* (#:key inputs #:allow-other-keys) | |
af7014a1 | 684 | ;; Xen is not available for now - so only patch qemu. |
845bf4f4 | 685 | (substitute* "virtManager/createconn.py" |
4ad8fbd1 AP |
686 | (("/usr(/bin/qemu-system)" _ suffix) |
687 | (string-append (assoc-ref inputs "qemu") suffix))) | |
688 | #t)) | |
2f82b53b RW |
689 | (add-before 'wrap 'wrap-with-GI_TYPELIB_PATH |
690 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
691 | (let* ((bin (string-append (assoc-ref outputs "out") "/bin")) | |
692 | (bin-files (find-files bin ".*")) | |
693 | (paths (map (match-lambda | |
694 | ((output . directory) | |
695 | (let* ((girepodir (string-append | |
696 | directory | |
697 | "/lib/girepository-1.0"))) | |
698 | (if (file-exists? girepodir) | |
699 | girepodir #f)))) | |
700 | inputs))) | |
701 | (for-each (lambda (file) | |
702 | (format #t "wrapping ~a\n" file) | |
703 | (wrap-program file | |
704 | `("GI_TYPELIB_PATH" ":" prefix | |
705 | ,(filter identity paths)))) | |
706 | bin-files)) | |
f023685d | 707 | #t)) |
20f524a4 CB |
708 | (replace 'check |
709 | (lambda* (#:key tests? #:allow-other-keys) | |
710 | (when tests? | |
711 | (setenv "HOME" "/tmp") | |
712 | (system "Xvfb :1 &") | |
713 | (setenv "DISPLAY" ":1") | |
714 | ;; Dogtail requires that Assistive Technology support be enabled | |
715 | (setenv "GTK_MODULES" "gail:atk-bridge") | |
716 | (invoke "dbus-run-session" "--" "python" "setup.py" "test_ui")) | |
717 | #t)) | |
f023685d AP |
718 | (add-after 'install 'glib-or-gtk-compile-schemas |
719 | (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas)) | |
720 | (add-after 'install 'glib-or-gtk-wrap | |
721 | (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap))))) | |
2f82b53b | 722 | (inputs |
b1e9837a AP |
723 | `(("dconf" ,dconf) |
724 | ("gtk+" ,gtk+) | |
45214efe | 725 | ("gtk-vnc" ,gtk-vnc) |
845bf4f4 | 726 | ("gtksourceview" ,gtksourceview) |
2f82b53b RW |
727 | ("libvirt" ,libvirt) |
728 | ("libvirt-glib" ,libvirt-glib) | |
729 | ("libosinfo" ,libosinfo) | |
45214efe | 730 | ("vte" ,vte) |
f8be7664 RH |
731 | ("python-libvirt" ,python-libvirt) |
732 | ("python-requests" ,python-requests) | |
733 | ("python-ipaddress" ,python-ipaddress) | |
734 | ("python-pycairo" ,python-pycairo) | |
735 | ("python-pygobject" ,python-pygobject) | |
736 | ("python-libxml2" ,python-libxml2) | |
8da7f792 | 737 | ("spice-gtk" ,spice-gtk))) |
2f82b53b RW |
738 | ;; virt-manager searches for qemu-img or kvm-img in the PATH. |
739 | (propagated-inputs | |
740 | `(("qemu" ,qemu))) | |
741 | (native-inputs | |
af7014a1 | 742 | `(("glib" ,glib "bin") ; glib-compile-schemas |
f468df9f | 743 | ("gobject-introspection" ,gobject-introspection) |
e6efcd58 | 744 | ("gtk+" ,gtk+ "bin") ; gtk-update-icon-cache |
2f82b53b | 745 | ("perl" ,perl) ; pod2man |
20f524a4 CB |
746 | ("intltool" ,intltool) |
747 | ;; The following are required for running the tests | |
748 | ;; ("python-dogtail" ,python-dogtail) | |
749 | ;; ("xvfb" ,xorg-server-for-tests) | |
750 | ;; ("dbus" ,dbus) | |
751 | ;; ("at-spi2-core" ,at-spi2-core) | |
752 | ;; ("gsettings-desktop-schemas" ,gsettings-desktop-schemas) | |
753 | )) | |
2f82b53b RW |
754 | (home-page "https://virt-manager.org/") |
755 | (synopsis "Manage virtual machines") | |
756 | (description | |
757 | "The virt-manager application is a desktop user interface for managing | |
758 | virtual machines through libvirt. It primarily targets KVM VMs, but also | |
759 | manages Xen and LXC (Linux containers). It presents a summary view of running | |
760 | domains, their live performance and resource utilization statistics.") | |
b23b9667 | 761 | (license license:gpl2+))) |
fe420383 RW |
762 | |
763 | (define-public criu | |
764 | (package | |
765 | (name "criu") | |
102fd8c7 | 766 | (version "3.14") |
fe420383 RW |
767 | (source (origin |
768 | (method url-fetch) | |
1ee8b719 | 769 | (uri (string-append "https://download.openvz.org/criu/criu-" |
fe420383 RW |
770 | version ".tar.bz2")) |
771 | (sha256 | |
772 | (base32 | |
102fd8c7 | 773 | "1jrr3v99g18gc0hriz0avq6ccdvyya0j6wwz888sdsc4icc30gzn")))) |
fe420383 RW |
774 | (build-system gnu-build-system) |
775 | (arguments | |
776 | `(#:test-target "test" | |
777 | #:tests? #f ; tests require mounting as root | |
778 | #:make-flags | |
779 | (list (string-append "PREFIX=" (assoc-ref %outputs "out")) | |
780 | (string-append "LIBDIR=" (assoc-ref %outputs "out") | |
5d1601ea | 781 | "/lib") |
782 | (string-append "ASCIIDOC=" (assoc-ref %build-inputs "asciidoc") | |
783 | "/bin/asciidoc") | |
784 | (string-append "XMLTO=" (assoc-ref %build-inputs "xmlto") | |
785 | "/bin/xmlto")) | |
fe420383 RW |
786 | #:phases |
787 | (modify-phases %standard-phases | |
788 | (replace 'configure | |
789 | (lambda* (#:key inputs #:allow-other-keys) | |
790 | ;; The includes for libnl are located in a sub-directory. | |
791 | (setenv "C_INCLUDE_PATH" | |
792 | (string-append (assoc-ref inputs "libnl") | |
ab2a1aed | 793 | "/include/libnl3:" |
41cb710f | 794 | (or (getenv "C_INCLUDE_PATH") ""))) |
5d1601ea | 795 | #t)) |
796 | (add-after 'configure 'fix-documentation | |
797 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
fe420383 | 798 | (substitute* "Documentation/Makefile" |
5d1601ea | 799 | (("-m custom.xsl") |
800 | (string-append | |
801 | "-m custom.xsl --skip-validation -x " | |
802 | (assoc-ref inputs "docbook-xsl") "/xml/xsl/" | |
803 | ,(package-name docbook-xsl) "-" | |
804 | ,(package-version docbook-xsl) | |
805 | "/manpages/docbook.xsl"))) | |
580f33e1 EF |
806 | #t)) |
807 | (add-after 'unpack 'hardcode-variables | |
808 | (lambda* (#:key inputs #:allow-other-keys) | |
809 | ;; Hardcode arm version detection | |
810 | (substitute* "Makefile" | |
811 | (("ARMV.*:=.*") "ARMV := 7\n")) | |
812 | ;; We are currently using python-2 | |
813 | (substitute* "crit/Makefile" | |
814 | (("\\$\\(PYTHON\\)") "python2")) | |
815 | (substitute* "lib/Makefile" | |
816 | (("\\$\\(PYTHON\\)") | |
817 | (string-append (assoc-ref inputs "python") | |
818 | "/bin/python"))) | |
fe420383 RW |
819 | #t)) |
820 | (add-before 'build 'fix-symlink | |
821 | (lambda* (#:key inputs #:allow-other-keys) | |
822 | ;; The file 'images/google/protobuf/descriptor.proto' points to | |
823 | ;; /usr/include/..., which obviously does not exist. | |
824 | (let* ((file "google/protobuf/descriptor.proto") | |
825 | (target (string-append "images/" file)) | |
826 | (source (string-append (assoc-ref inputs "protobuf") | |
827 | "/include/" file))) | |
828 | (delete-file target) | |
829 | (symlink source target) | |
830 | #t))) | |
831 | (add-after 'install 'wrap | |
832 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
833 | ;; Make sure 'crit' runs with the correct PYTHONPATH. | |
834 | (let* ((out (assoc-ref outputs "out")) | |
835 | (path (string-append out | |
836 | "/lib/python" | |
837 | (string-take (string-take-right | |
838 | (assoc-ref inputs "python") 5) 3) | |
839 | "/site-packages:" | |
840 | (getenv "PYTHONPATH")))) | |
841 | (wrap-program (string-append out "/bin/crit") | |
842 | `("PYTHONPATH" ":" prefix (,path)))) | |
843 | #t))))) | |
844 | (inputs | |
845 | `(("protobuf" ,protobuf) | |
846 | ("python" ,python-2) | |
847 | ("python2-protobuf" ,python2-protobuf) | |
848 | ("python2-ipaddr" ,python2-ipaddr) | |
849 | ("iproute" ,iproute) | |
850 | ("libaio" ,libaio) | |
851 | ("libcap" ,libcap) | |
852 | ("libnet" ,libnet) | |
5d1601ea | 853 | ("libnl" ,libnl) |
854 | ("libbsd" ,libbsd))) | |
fe420383 RW |
855 | (native-inputs |
856 | `(("pkg-config" ,pkg-config) | |
3bf94bc8 | 857 | ("perl" ,perl) |
fe420383 RW |
858 | ("protobuf-c" ,protobuf-c) |
859 | ("asciidoc" ,asciidoc) | |
860 | ("xmlto" ,xmlto) | |
861 | ("docbook-xml" ,docbook-xml) | |
862 | ("docbook-xsl" ,docbook-xsl))) | |
863 | (home-page "https://criu.org") | |
864 | (synopsis "Checkpoint and restore in user space") | |
865 | (description "Using this tool, you can freeze a running application (or | |
866 | part of it) and checkpoint it to a hard drive as a collection of files. You | |
867 | can then use the files to restore and run the application from the point it | |
868 | was frozen at. The distinctive feature of the CRIU project is that it is | |
869 | mainly implemented in user space.") | |
870 | ;; The project is licensed under GPLv2; files in the lib/ directory are | |
871 | ;; LGPLv2.1. | |
b23b9667 | 872 | (license (list license:gpl2 license:lgpl2.1)))) |
f46a3523 RH |
873 | |
874 | (define-public qmpbackup | |
875 | (package | |
876 | (name "qmpbackup") | |
877 | (version "0.2") | |
878 | (source (origin | |
7be834d5 EF |
879 | (method git-fetch) |
880 | (uri (git-reference | |
b0e7b699 | 881 | (url "https://github.com/abbbi/qmpbackup") |
7be834d5 EF |
882 | (commit version))) |
883 | (file-name (git-file-name name version)) | |
f46a3523 RH |
884 | (sha256 |
885 | (base32 | |
7be834d5 | 886 | "0swhp5byz44brhyis1a39p11fyn9q84xz5q6v2fah29r7d71kmmx")))) |
f46a3523 RH |
887 | (build-system python-build-system) |
888 | (arguments | |
889 | `(#:python ,python-2)) | |
890 | (home-page "https://github.com/abbbi/qmpbackup") | |
891 | (synopsis "Backup and restore QEMU machines") | |
892 | (description "qmpbackup is designed to create and restore full and | |
893 | incremental backups of running QEMU virtual machines via QMP, the QEMU | |
894 | Machine Protocol.") | |
b23b9667 | 895 | (license license:gpl3+))) |
fb9472a3 | 896 | |
c9d2d310 RH |
897 | (define-public looking-glass-client |
898 | (let ((commit "182c4752d57690da7f99d5e788de9b8baea33895")) | |
16a47f23 | 899 | (package |
c9d2d310 | 900 | (name "looking-glass-client") |
16a47f23 RH |
901 | (version (string-append "a12-" (string-take commit 7))) |
902 | (source | |
903 | (origin | |
904 | (method git-fetch) | |
905 | (uri (git-reference (url "https://github.com/gnif/LookingGlass") | |
906 | (commit commit))) | |
907 | (file-name (git-file-name name version)) | |
908 | (sha256 | |
909 | (base32 | |
43beec19 MB |
910 | "02bq46ndmzq9cihazzn7xq1x7q5nzm7iw4l9lqzihxcxp9famkhw")) |
911 | (modules '((guix build utils))) | |
912 | (snippet | |
913 | '(begin | |
914 | ;; Do not create binaries optimized for the CPU of the build machine, | |
915 | ;; for reproducibility and compatibility. TODO: in the next version | |
916 | ;; of looking glass, this is exposed as a CMake configure option. | |
917 | (substitute* "client/CMakeLists.txt" | |
918 | (("-march=native") | |
919 | "")) | |
920 | #t)))) | |
16a47f23 RH |
921 | (build-system cmake-build-system) |
922 | (inputs `(("fontconfig" ,fontconfig) | |
923 | ("glu" ,glu) | |
924 | ("mesa" ,mesa) | |
925 | ("openssl" ,openssl) | |
926 | ("sdl2" ,sdl2) | |
927 | ("sdl2-ttf" ,sdl2-ttf) | |
928 | ("spice-protocol" ,spice-protocol) | |
929 | ("wayland" ,wayland))) | |
930 | (native-inputs `(("libconfig" ,libconfig) | |
931 | ("nettle" ,nettle) | |
932 | ("pkg-config" ,pkg-config))) | |
933 | (arguments | |
934 | `(#:tests? #f ;; No tests are available. | |
935 | #:make-flags '("CC=gcc") | |
936 | #:phases (modify-phases %standard-phases | |
937 | (add-before 'configure 'chdir-to-client | |
938 | (lambda* (#:key outputs #:allow-other-keys) | |
939 | (chdir "client") | |
940 | #t)) | |
a5ef1bcd MB |
941 | (add-after 'chdir-to-client 'add-missing-include |
942 | (lambda _ | |
943 | ;; Mimic upstream commit b9797529893, required since the | |
944 | ;; update to Mesa 19.2. | |
945 | (substitute* "renderers/egl/shader.h" | |
946 | (("#include <stdbool\\.h>") | |
947 | "#include <stdbool.h>\n#include <stddef.h>")) | |
948 | #t)) | |
16a47f23 RH |
949 | (replace 'install |
950 | (lambda* (#:key outputs #:allow-other-keys) | |
951 | (install-file "looking-glass-client" | |
952 | (string-append (assoc-ref outputs "out") | |
953 | "/bin")) | |
a5ef1bcd | 954 | #t))))) |
16a47f23 RH |
955 | (home-page "https://looking-glass.hostfission.com") |
956 | (synopsis "KVM Frame Relay (KVMFR) implementation") | |
957 | (description "Looking Glass allows the use of a KVM (Kernel-based Virtual | |
fb9472a3 RH |
958 | Machine) configured for VGA PCI Pass-through without an attached physical |
959 | monitor, keyboard or mouse. It displays the VM's rendered contents on your main | |
960 | monitor/GPU.") | |
16a47f23 RH |
961 | ;; This package requires SSE instructions. |
962 | (supported-systems '("i686-linux" "x86_64-linux")) | |
963 | (license license:gpl2+)))) | |
de7f03ce SB |
964 | |
965 | (define-public runc | |
966 | (package | |
967 | (name "runc") | |
ce4593ec | 968 | (version "1.0.0-rc6") |
de7f03ce SB |
969 | (source (origin |
970 | (method url-fetch) | |
971 | (uri (string-append | |
972 | "https://github.com/opencontainers/runc/releases/" | |
973 | "download/v" version "/runc.tar.xz")) | |
ce4593ec LF |
974 | (file-name (string-append name "-" version ".tar.xz")) |
975 | (patches (search-patches "runc-CVE-2019-5736.patch")) | |
de7f03ce SB |
976 | (sha256 |
977 | (base32 | |
ce4593ec | 978 | "1c7832dq70slkjh8qp2civ1wxhhdd2hrx84pq7db1mmqc9fdr3cc")))) |
de7f03ce SB |
979 | (build-system go-build-system) |
980 | (arguments | |
981 | '(#:import-path "github.com/opencontainers/runc" | |
982 | #:install-source? #f | |
03e45891 SB |
983 | ;; XXX: 20/139 tests fail due to missing /var, cgroups and apparmor in |
984 | ;; the build environment. | |
985 | #:tests? #f | |
de7f03ce SB |
986 | #:phases |
987 | (modify-phases %standard-phases | |
988 | (replace 'unpack | |
989 | (lambda* (#:key source import-path #:allow-other-keys) | |
990 | ;; Unpack the tarball into 'runc' instead of 'runc-1.0.0-rc5'. | |
991 | (let ((dest (string-append "src/" import-path))) | |
992 | (mkdir-p dest) | |
993 | (invoke "tar" "-C" (string-append "src/" import-path) | |
994 | "--strip-components=1" | |
995 | "-xvf" source)))) | |
996 | (replace 'build | |
997 | (lambda* (#:key import-path #:allow-other-keys) | |
998 | (chdir (string-append "src/" import-path)) | |
999 | ;; XXX: requires 'go-md2man'. | |
1000 | ;; (invoke "make" "man") | |
1001 | (invoke "make"))) | |
1002 | ;; (replace 'check | |
1003 | ;; (lambda _ | |
1004 | ;; (invoke "make" "localunittest"))) | |
1005 | (replace 'install | |
1006 | (lambda* (#:key outputs #:allow-other-keys) | |
1007 | (let ((out (assoc-ref outputs "out"))) | |
1008 | (invoke "make" "install" "install-bash" | |
1009 | (string-append "PREFIX=" out)))))))) | |
1010 | (native-inputs | |
1011 | `(("pkg-config" ,pkg-config))) | |
1012 | (inputs | |
1013 | `(("libseccomp" ,libseccomp))) | |
1014 | (synopsis "Open container initiative runtime") | |
1015 | (home-page "https://www.opencontainers.org/") | |
1016 | (description | |
1017 | "@command{runc} is a command line client for running applications | |
1018 | packaged according to the | |
1019 | @uref{https://github.com/opencontainers/runtime-spec/blob/master/spec.md, Open | |
1020 | Container Initiative (OCI) format} and is a compliant implementation of the | |
1021 | Open Container Initiative specification.") | |
b23b9667 | 1022 | (license license:asl2.0))) |
efdaf8de SB |
1023 | |
1024 | (define-public umoci | |
1025 | (package | |
1026 | (name "umoci") | |
3468737c TGR |
1027 | (version "0.4.6") |
1028 | (source | |
1029 | (origin | |
1030 | (method url-fetch) | |
1031 | (uri (string-append | |
1032 | "https://github.com/opencontainers/umoci/releases/download/v" | |
1033 | version "/umoci.tar.xz")) | |
1034 | (file-name (string-append "umoci-" version ".tar.xz")) | |
1035 | (sha256 | |
1036 | (base32 "06q7xfwnqysc013hapx31jhlzmyg8qb467qfkynj673qc7p9bd6h")))) | |
efdaf8de SB |
1037 | (build-system go-build-system) |
1038 | (arguments | |
3468737c | 1039 | '(#:import-path "github.com/opencontainers/umoci" |
efdaf8de SB |
1040 | #:install-source? #f |
1041 | #:phases | |
1042 | (modify-phases %standard-phases | |
1043 | (replace 'unpack | |
1044 | (lambda* (#:key source import-path #:allow-other-keys) | |
1045 | ;; Unpack the tarball into 'umoci' instead of "runc-${version}". | |
1046 | (let ((dest (string-append "src/" import-path))) | |
1047 | (mkdir-p dest) | |
1048 | (invoke "tar" "-C" (string-append "src/" import-path) | |
1049 | "--strip-components=1" | |
1050 | "-xvf" source)))) | |
1051 | (replace 'build | |
1052 | (lambda* (#:key import-path #:allow-other-keys) | |
1053 | (chdir (string-append "src/" import-path)) | |
1054 | ;; TODO: build manpages with 'go-md2man'. | |
1055 | (invoke "make" "SHELL=bash"))) | |
1056 | (replace 'install | |
1057 | (lambda* (#:key outputs #:allow-other-keys) | |
1058 | (let* ((out (assoc-ref outputs "out")) | |
1059 | (bindir (string-append out "/bin"))) | |
1060 | (install-file "umoci" bindir) | |
1061 | #t)))))) | |
1062 | (home-page "https://umo.ci/") | |
1063 | (synopsis "Tool for modifying Open Container images") | |
1064 | (description | |
1065 | "@command{umoci} is a tool that allows for high-level modification of an | |
1066 | Open Container Initiative (OCI) image layout and its tagged images.") | |
b23b9667 | 1067 | (license license:asl2.0))) |
7714a069 SB |
1068 | |
1069 | (define-public skopeo | |
1070 | (package | |
1071 | (name "skopeo") | |
e8156383 | 1072 | (version "0.1.40") |
7714a069 SB |
1073 | (source (origin |
1074 | (method git-fetch) | |
1075 | (uri (git-reference | |
1076 | (url "https://github.com/projectatomic/skopeo") | |
1077 | (commit (string-append "v" version)))) | |
1078 | (file-name (git-file-name name version)) | |
1079 | (sha256 | |
1080 | (base32 | |
e8156383 | 1081 | "1bagirzdzjhicn5dr691092ac3q6lhz3xngjzgqiqkxnvpz7p6cn")))) |
7714a069 SB |
1082 | (build-system go-build-system) |
1083 | (native-inputs | |
1084 | `(("pkg-config" ,pkg-config))) | |
1085 | (inputs | |
1086 | `(("btrfs-progs" ,btrfs-progs) | |
1087 | ("eudev" ,eudev) | |
1088 | ("libassuan" ,libassuan) | |
1089 | ("libselinux" ,libselinux) | |
1090 | ("libostree" ,libostree) | |
1091 | ("lvm2" ,lvm2) | |
1092 | ("glib" ,glib) | |
1093 | ("gpgme" ,gpgme))) | |
1094 | (arguments | |
1095 | '(#:import-path "github.com/projectatomic/skopeo" | |
1096 | #:install-source? #f | |
e409879a | 1097 | #:tests? #f ; The tests require Docker |
7714a069 SB |
1098 | #:phases |
1099 | (modify-phases %standard-phases | |
1100 | (replace 'build | |
1101 | (lambda* (#:key import-path #:allow-other-keys) | |
1102 | (chdir (string-append "src/" import-path)) | |
1103 | ;; TODO: build manpages with 'go-md2man'. | |
1104 | (invoke "make" "binary-local"))) | |
1105 | (replace 'install | |
1106 | (lambda* (#:key outputs #:allow-other-keys) | |
1107 | (let ((out (assoc-ref outputs "out"))) | |
1108 | (invoke "make" "install-binary" "install-completions" | |
1109 | (string-append "PREFIX=" out)))))))) | |
1110 | (home-page "https://github.com/projectatomic/skopeo") | |
1111 | (synopsis "Interact with container images and container image registries") | |
1112 | (description | |
1113 | "@command{skopeo} is a command line utility providing various operations | |
1114 | with container images and container image registries. It can: | |
1115 | @enumerate | |
1116 | ||
1117 | @item Copy container images between various containers image stores, | |
1118 | converting them as necessary. | |
1119 | ||
1120 | @item Convert a Docker schema 2 or schema 1 container image to an OCI image. | |
1121 | ||
1122 | @item Inspect a repository on a container registry without needlessly pulling | |
1123 | the image. | |
1124 | ||
1125 | @item Sign and verify container images. | |
1126 | ||
1127 | @item Delete container images from a remote container registry. | |
1128 | ||
1129 | @end enumerate") | |
b23b9667 | 1130 | (license license:asl2.0))) |
5e95181b EF |
1131 | |
1132 | (define-public python-vagrant | |
1133 | (package | |
1134 | (name "python-vagrant") | |
1135 | (version "0.5.15") | |
1136 | (source | |
1137 | (origin | |
1138 | (method url-fetch) | |
1139 | (uri (pypi-uri "python-vagrant" version)) | |
1140 | (sha256 | |
1141 | (base32 | |
1142 | "1ikrh6canhcxg5y7pzmkcnnydikppv7s6sm9prfx90nk0ac8m6mg")))) | |
1143 | (build-system python-build-system) | |
1144 | (arguments | |
1145 | '(#:tests? #f)) ; tests involve running vagrant. | |
1146 | (home-page "https://github.com/todddeluca/python-vagrant") | |
1147 | (synopsis "Python bindings for Vagrant") | |
1148 | (description | |
1149 | "Python-vagrant is a Python module that provides a thin wrapper around the | |
1150 | @code{vagrant} command line executable, allowing programmatic control of Vagrant | |
1151 | virtual machines.") | |
1152 | (license license:expat))) | |
f6e55da0 JL |
1153 | |
1154 | (define-public bubblewrap | |
1155 | (package | |
1156 | (name "bubblewrap") | |
40613055 | 1157 | (version "0.4.1") |
f6e55da0 JL |
1158 | (source (origin |
1159 | (method url-fetch) | |
546c9fa6 | 1160 | (uri (string-append "https://github.com/containers/bubblewrap/" |
f6e55da0 JL |
1161 | "releases/download/v" version "/bubblewrap-" |
1162 | version ".tar.xz")) | |
1163 | (sha256 | |
1164 | (base32 | |
40613055 | 1165 | "00ycgi6q2yngh06bnz50wkvar6r2jnjf3j158grhi9k13jdrpimr")))) |
f6e55da0 JL |
1166 | (build-system gnu-build-system) |
1167 | (arguments | |
1168 | `(#:phases | |
1169 | (modify-phases %standard-phases | |
1170 | (add-after 'unpack 'fix-test | |
1171 | (lambda* (#:key outputs #:allow-other-keys) | |
1172 | ;; Tests try to access /var/tmp, which is not possible in our build | |
1173 | ;; environment. Let's give them another directory. | |
1174 | ;; /tmp gets overriden in some tests, so we need another directory. | |
1175 | ;; the only possibility is the output directory. | |
1176 | (let ((tmp-dir (string-append (assoc-ref outputs "out") "/tmp"))) | |
1177 | (mkdir-p tmp-dir) | |
1178 | (substitute* "tests/test-run.sh" | |
1179 | (("/var/tmp") tmp-dir) | |
1180 | ;; Tests create a temporary python script, so fix its shebang. | |
1181 | (("/usr/bin/env python") (which "python")) | |
1182 | ;; Some tests try to access /usr, but that doesn't exist. | |
1183 | ;; Give them /gnu instead. | |
1184 | (("/usr") "/gnu") | |
2d03201a MB |
1185 | (("--ro-bind /bin /bin") "--ro-bind /gnu /bin") |
1186 | (("--ro-bind /sbin /sbin") "--ro-bind /gnu /sbin") | |
1187 | (("--ro-bind /lib /lib") "--ro-bind /gnu /lib") | |
f6e55da0 JL |
1188 | ((" */bin/bash") (which "bash")) |
1189 | (("/bin/sh") (which "sh")) | |
1190 | (("findmnt") (which "findmnt")))) | |
1191 | #t)) | |
1192 | ;; Remove the directory we gave to tests to have a clean package. | |
1193 | (add-after 'check 'remove-tmp-dir | |
1194 | (lambda* (#:key outputs #:allow-other-keys) | |
1195 | (delete-file-recursively (string-append (assoc-ref outputs "out") "/tmp")) | |
1196 | #t))))) | |
1197 | (inputs | |
1198 | `(("libcap" ,libcap))) | |
1199 | (native-inputs | |
1200 | `(("python-2" ,python-2) | |
1201 | ("util-linux" ,util-linux))) | |
546c9fa6 | 1202 | (home-page "https://github.com/containers/bubblewrap") |
f6e55da0 JL |
1203 | (synopsis "Unprivileged sandboxing tool") |
1204 | (description "Bubblewrap is aimed at running applications in a sandbox, | |
7ecd1761 TGR |
1205 | restricting their access to parts of the operating system or user data such as |
1206 | the home directory. Bubblewrap always creates a new mount namespace, and the | |
1207 | user can specify exactly what parts of the file system should be made visible | |
ef1f1ca7 | 1208 | in the sandbox. These directories are mounted with the @code{nodev} option |
7ecd1761 | 1209 | by default and can be made read-only.") |
f6e55da0 | 1210 | (license license:lgpl2.0+))) |
17043677 | 1211 | |
1212 | (define-public bochs | |
1213 | (package | |
1214 | (name "bochs") | |
f17bd3c6 | 1215 | (version "2.6.11") |
17043677 | 1216 | (source |
1217 | (origin | |
1218 | (method url-fetch) | |
1219 | (uri (string-append "https://sourceforge.net/projects/bochs/files/bochs/" | |
1220 | version "/bochs-" version ".tar.gz")) | |
1221 | (sha256 | |
f17bd3c6 | 1222 | (base32 "0ql8q6y1k356li1g9gbvl21448mlxphxxi6kjb2b3pxvzd0pp2b3")))) |
17043677 | 1223 | (build-system gnu-build-system) |
1224 | (arguments | |
f17bd3c6 | 1225 | `(#:tests? #f)) ; no tests exist |
17043677 | 1226 | (inputs |
1227 | `(("libxrandr" ,libxrandr))) | |
1228 | (home-page "http://bochs.sourceforge.net/") | |
1229 | (synopsis "Emulator for x86 PC") | |
1230 | (description | |
1231 | "Bochs is an emulator which can emulate Intel x86 CPU, common I/O | |
1232 | devices, and a custom BIOS. It can also be compiled to emulate many different | |
1233 | x86 CPUs, from early 386 to the most recent x86-64 Intel and AMD processors. | |
1234 | Bochs can run most Operating Systems inside the emulation including Linux, | |
1235 | DOS or Microsoft Windows.") | |
1236 | (license license:lgpl2.0+))) | |
35e8900d | 1237 | |
35e8900d DM |
1238 | (define-public xen |
1239 | (package | |
1240 | (name "xen") | |
45c54093 | 1241 | (version "4.13.0") |
35e8900d DM |
1242 | (source (origin |
1243 | (method git-fetch) | |
1244 | (uri (git-reference | |
1245 | (url "git://xenbits.xenproject.org/xen.git") | |
1246 | (commit (string-append "RELEASE-" version)))) | |
1247 | (file-name (git-file-name name version)) | |
1248 | (sha256 | |
1249 | (base32 | |
45c54093 | 1250 | "0py50n995gv909i0d1lfdcj9wcp5g1d5z6m2291jqqlfyany138g")))) |
35e8900d DM |
1251 | (build-system gnu-build-system) |
1252 | (arguments | |
1253 | `(#:configure-flags | |
1254 | (list "--enable-rpath" | |
1255 | "--disable-qemu-traditional" ; It tries to do "git clone" | |
1256 | "--disable-rombios" ; would try to "git clone" via etherboot. | |
35e8900d DM |
1257 | ;; TODO: Re-enable stubdom (it's "more secure" to use it). |
1258 | "--disable-stubdom" ; tries to "git clone" old patched newlib. | |
1259 | (string-append "--with-initddir=" | |
1260 | (assoc-ref %outputs "out") | |
1261 | "/etc/init.d") | |
1262 | (string-append "--with-system-qemu=" | |
1263 | (assoc-ref %build-inputs "qemu") | |
1264 | "/bin/qemu-system-i386") | |
1265 | (string-append "--with-system-seabios=" | |
1266 | (assoc-ref %build-inputs "seabios") | |
1267 | "/share/firmware/bios.bin") | |
1268 | (string-append "--with-system-ovmf=" | |
1269 | (assoc-ref %build-inputs "ovmf") | |
1270 | "/share/firmware/ovmf_ia32.bin")) | |
1271 | #:make-flags (list "-j" "1" | |
1272 | "XEN_BUILD_DATE=Thu Jan 1 01:00:01 CET 1970" | |
1273 | "XEN_BUILD_TIME=01:00:01" | |
1274 | "XEN_BUILD_HOST=" | |
1275 | "ETHERBOOT_NICS=" | |
1276 | "SMBIOS_REL_DATE=01/01/1970" | |
1277 | "VGABIOS_REL_DATE=01 Jan 1970" | |
1278 | ; QEMU_TRADITIONAL_LOC | |
1279 | ; QEMU_UPSTREAM_LOC | |
1280 | "SYSCONFIG_DIR=/tmp/etc/default" | |
1281 | (string-append "BASH_COMPLETION_DIR=" | |
1282 | (assoc-ref %outputs "out") | |
1283 | "/etc/bash_completion.d") | |
1284 | (string-append "BOOT_DIR=" | |
1285 | (assoc-ref %outputs "out") | |
1286 | "/boot") | |
1287 | (string-append "DEBUG_DIR=" | |
1288 | (assoc-ref %outputs "out") | |
1289 | "/lib/debug") | |
1290 | (string-append "EFI_DIR=" | |
1291 | (assoc-ref %outputs "out") | |
1292 | "/lib/efi") ; TODO lib64 ? | |
1293 | "MINIOS_UPSTREAM_URL=" | |
1294 | ;(string-append "DISTDIR=" | |
1295 | ; (assoc-ref %outputs "out")) | |
1296 | ) | |
1297 | #:test-target "test" | |
1298 | #:phases | |
1299 | (modify-phases %standard-phases | |
1300 | (add-after 'unpack 'unpack-mini-os | |
1301 | (lambda* (#:key inputs #:allow-other-keys) | |
1302 | (copy-recursively (assoc-ref inputs "mini-os") "extras/mini-os") | |
1303 | #t)) | |
1304 | (add-after 'unpack-mini-os 'patch | |
1305 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
1306 | (substitute* "tools/firmware/Rules.mk" | |
1307 | (("override XEN_TARGET_ARCH = x86_32") | |
1308 | (string-append "override XEN_TARGET_ARCH = x86_32 | |
1309 | override CC = " (assoc-ref inputs "cross-gcc") "/bin/i686-linux-gnu-gcc")) | |
1310 | (("^CFLAGS =$") | |
1311 | (string-append "CFLAGS=-I" (assoc-ref inputs "cross-libc") | |
1312 | "/include\n"))) | |
1313 | (substitute* "config/x86_32.mk" | |
1314 | (("CFLAGS += -m32 -march=i686") | |
1315 | (string-append "CFLAGS += -march=i686 -I" | |
1316 | (assoc-ref inputs "cross-libc") | |
1317 | "/include"))) | |
35e8900d DM |
1318 | ;; /var is not in /gnu/store , so don't try to create it. |
1319 | (substitute* '("tools/Makefile" | |
1320 | "tools/xenstore/Makefile" | |
1321 | "tools/xenpaging/Makefile") | |
1322 | (("\\$\\(INSTALL_DIR\\) .*XEN_(DUMP|LOG|RUN|LIB|PAGING)_DIR.*") | |
1323 | "\n") | |
1324 | (("\\$\\(INSTALL_DIR\\) .*XEN_(RUN|LIB)_STORED.*") | |
1325 | "\n")) | |
1326 | ;; Prevent xen from creating /etc . | |
1327 | (substitute* "tools/examples/Makefile" | |
1328 | ((" install-readmes") "") | |
1329 | ((" install-configs") "")) | |
1330 | ;; Set rpath. | |
1331 | (substitute* "tools/pygrub/setup.py" | |
1332 | (("library_dirs =") | |
1333 | ; TODO: extra_link_args = ['-Wl,-rpath=/opt/foo'], | |
1334 | (string-append "runtime_library_dirs = ['" | |
1335 | (assoc-ref outputs "out") | |
1336 | "/lib'],\nlibrary_dirs ="))) | |
1337 | #t)) | |
1338 | (add-before 'configure 'patch-xen-script-directory | |
1339 | (lambda* (#:key outputs #:allow-other-keys) | |
1340 | (substitute* '("configure" | |
1341 | "tools/configure" | |
1342 | "docs/configure") | |
1343 | (("XEN_SCRIPT_DIR=.*") | |
1344 | (string-append "XEN_SCRIPT_DIR=" | |
1345 | (assoc-ref outputs "out") | |
1346 | "/etc/xen/scripts"))) | |
1347 | #t)) | |
1348 | (add-before 'configure 'set-environment-up | |
1349 | (lambda* (#:key make-flags #:allow-other-keys) | |
1350 | (define (cross? x) | |
1351 | (string-contains x "cross-i686-linux")) | |
1352 | (define (filter-environment! filter-predicate | |
1353 | environment-variable-names) | |
1354 | (for-each | |
1355 | (lambda (env-name) | |
1356 | (let* ((env-value (getenv env-name)) | |
1357 | (search-path (search-path-as-string->list env-value)) | |
1358 | (new-search-path (filter filter-predicate | |
1359 | search-path)) | |
1360 | (new-env-value (list->search-path-as-string | |
1361 | new-search-path ":"))) | |
1362 | (setenv env-name new-env-value))) | |
1363 | environment-variable-names)) | |
6177320d | 1364 | (setenv "CROSS_CPATH" (getenv "CPATH")) |
35e8900d DM |
1365 | (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH")) |
1366 | (filter-environment! cross? | |
6177320d | 1367 | '("CROSS_CPATH" |
35e8900d DM |
1368 | "CROSS_LIBRARY_PATH")) |
1369 | (filter-environment! (lambda (e) (not (cross? e))) | |
6177320d | 1370 | '("CPATH" |
35e8900d DM |
1371 | "LIBRARY_PATH")) |
1372 | ;; Guix tries to be helpful and automatically adds | |
1373 | ;; mini-os-git-checkout/include to the include path, | |
1374 | ;; but actually we don't want it to be there (yet). | |
1375 | (filter-environment! (lambda (e) | |
1376 | (not | |
1377 | (string-contains e | |
1378 | "mini-os-git-checkout"))) | |
6177320d | 1379 | '("CPATH" |
35e8900d DM |
1380 | "LIBRARY_PATH")) |
1381 | (setenv "EFI_VENDOR" "guix") | |
1382 | #t)) | |
1383 | (replace 'build | |
1384 | (lambda* (#:key make-flags #:allow-other-keys) | |
1385 | (apply invoke "make" "world" make-flags)))))) | |
1386 | (inputs | |
1387 | `(("acpica" ,acpica) ; TODO: patch iasl invocation. | |
1388 | ("bridge-utils" ,bridge-utils) ; TODO: patch invocations. | |
1389 | ("glib" ,glib) | |
1390 | ("iproute" ,iproute) ; TODO: patch invocations. | |
1391 | ("libaio" ,libaio) | |
1392 | ("libx11" ,libx11) | |
1393 | ("libyajl" ,libyajl) | |
1394 | ("ncurses" ,ncurses) | |
1395 | ("openssl" ,openssl) | |
1396 | ("ovmf" ,ovmf) | |
1397 | ("pixman" ,pixman) | |
1398 | ("qemu" ,qemu-minimal) | |
1399 | ("seabios" ,seabios) | |
bb93042c | 1400 | ("util-linux" ,util-linux "lib") ; uuid |
35e8900d DM |
1401 | ; TODO: ocaml-findlib, ocaml-nox. |
1402 | ("xz" ,xz) ; for liblzma | |
1403 | ("zlib" ,zlib))) | |
1404 | (native-inputs | |
1405 | `(("dev86" ,dev86) | |
1406 | ("bison" ,bison) | |
c69959f0 | 1407 | ("cmake" ,cmake-minimal) |
35e8900d DM |
1408 | ("figlet" ,figlet) |
1409 | ("flex" ,flex) | |
1410 | ("gettext" ,gettext-minimal) | |
1411 | ("libnl" ,libnl) | |
1412 | ("mini-os" | |
1413 | ,(origin | |
1414 | (method git-fetch) | |
1415 | (uri (git-reference | |
1416 | (url "http://xenbits.xen.org/git-http/mini-os.git") | |
1417 | (commit (string-append "xen-RELEASE-" version)))) | |
1418 | (sha256 | |
1419 | (base32 | |
1420 | "1i8pcl19n60i2m9vlg79q3nknpj209c9ic5x10wxaicx45kc107f")) | |
1421 | (file-name "mini-os-git-checkout"))) | |
1422 | ("perl" ,perl) | |
1423 | ; TODO: markdown | |
1424 | ("pkg-config" ,pkg-config) | |
1425 | ("python" ,python-2) | |
1426 | ("wget" ,wget) | |
1427 | ("cross-gcc" ,(cross-gcc "i686-linux-gnu" | |
1428 | #:xbinutils (cross-binutils "i686-linux-gnu") | |
1429 | #:libc (cross-libc "i686-linux-gnu"))) | |
1430 | ("cross-libc" ,(cross-libc "i686-linux-gnu")) ; header files | |
1431 | ("cross-libc-static" ,(cross-libc "i686-linux-gnu") "static"))) | |
1432 | (home-page "https://xenproject.org/") | |
1433 | (synopsis "Xen Virtual Machine Monitor") | |
1434 | (description "This package provides the Xen Virtual Machine Monitor | |
1435 | which is a hypervisor.") | |
1436 | ;; TODO: Some files are licensed differently. List those. | |
1437 | (license license:gpl2) | |
1438 | (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux")))) | |
e9126381 BW |
1439 | |
1440 | (define-public osinfo-db-tools | |
1441 | (package | |
1442 | (name "osinfo-db-tools") | |
5c8a59e6 | 1443 | (version "1.8.0") |
e9126381 BW |
1444 | (source (origin |
1445 | (method url-fetch) | |
1446 | (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-tools-" | |
1447 | version ".tar.xz")) | |
1448 | ||
1449 | (sha256 | |
1450 | (base32 | |
5c8a59e6 | 1451 | "038q3gzdbkfkhpicj0755mw1q4gbvn57pslpw8n2dp3lds9im0g9")))) |
e9126381 BW |
1452 | (build-system meson-build-system) |
1453 | (inputs | |
1454 | `(("libsoup" ,libsoup) | |
1455 | ("libxml2" ,libxml2) | |
1456 | ("libxslt" ,libxslt) | |
1457 | ("json-glib" ,json-glib) | |
1458 | ("libarchive" ,libarchive))) | |
1459 | (native-inputs | |
1460 | `(("perl" ,perl) | |
1461 | ("gobject-introspection" ,gobject-introspection) | |
1462 | ("gettext" ,gettext-minimal) | |
1463 | ("pkg-config" ,pkg-config) | |
1464 | ;; Tests | |
1465 | ("python" ,python) | |
1466 | ("pytest" ,python-pytest) | |
1467 | ("requests" ,python-requests))) | |
1468 | (home-page "https://gitlab.com/libosinfo/osinfo-db-tools") | |
1469 | (synopsis "Tools for managing the osinfo database") | |
1470 | (description "This package contains a set of tools to assist | |
1471 | administrators and developers in managing the database.") | |
1472 | (license license:lgpl2.0+))) | |
a838fa28 BW |
1473 | |
1474 | (define-public osinfo-db | |
1475 | (package | |
1476 | (name "osinfo-db") | |
16cf7d47 | 1477 | (version "20200529") |
a838fa28 BW |
1478 | (source (origin |
1479 | (method url-fetch) | |
1480 | (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-" | |
1481 | version ".tar.xz")) | |
1482 | (sha256 | |
1483 | (base32 | |
16cf7d47 | 1484 | "0mbrf9j5wmjhc6jixvhp4jqyxixh1717lqrmzmipdg99xnzba81n")))) |
a838fa28 BW |
1485 | (build-system trivial-build-system) |
1486 | (arguments | |
1487 | `(#:modules ((guix build utils)) | |
1488 | #:builder | |
1489 | (begin | |
1490 | (use-modules (guix build utils)) | |
1491 | (let* ((out (assoc-ref %outputs "out")) | |
1492 | (osinfo-dir (string-append out "/share/osinfo")) | |
1493 | (source (assoc-ref %build-inputs "source")) | |
1494 | (osinfo-db-import | |
1495 | (string-append (assoc-ref %build-inputs "osinfo-db-tools") | |
1496 | "/bin/osinfo-db-import"))) | |
1497 | (mkdir-p osinfo-dir) | |
1498 | (invoke osinfo-db-import "--dir" osinfo-dir source) | |
1499 | #t)))) | |
1500 | (native-inputs | |
1501 | `(("intltool" ,intltool) | |
1502 | ("osinfo-db-tools" ,osinfo-db-tools))) | |
1503 | (home-page "https://gitlab.com/libosinfo/osinfo-db") | |
1504 | (synopsis "Database of information about operating systems") | |
1505 | (description "Osinfo-db provides the database files for use with the | |
1506 | libosinfo library. It provides information about guest operating systems for | |
1507 | use with virtualization provisioning tools") | |
1508 | (license license:lgpl2.0+))) |