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