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> |
b02733d4 | 3 | ;;; Copyright © 2015, 2016, 2017 Mark H Weaver <mhw@netris.org> |
9ca19727 | 4 | ;;; Copyright © 2016, 2017 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> |
b15fcf9e LC |
8 | ;;; |
9 | ;;; This file is part of GNU Guix. | |
10 | ;;; | |
11 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
12 | ;;; under the terms of the GNU General Public License as published by | |
13 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
14 | ;;; your option) any later version. | |
15 | ;;; | |
16 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
17 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | ;;; GNU General Public License for more details. | |
20 | ;;; | |
21 | ;;; You should have received a copy of the GNU General Public License | |
22 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
23 | ||
59132b80 | 24 | (define-module (gnu packages virtualization) |
161ed547 | 25 | #:use-module (gnu packages) |
309693e0 | 26 | #:use-module (gnu packages admin) |
efcada41 | 27 | #:use-module (gnu packages attr) |
309693e0 | 28 | #:use-module (gnu packages autotools) |
a0f6c3b3 | 29 | #:use-module (gnu packages check) |
b15fcf9e | 30 | #:use-module (gnu packages compression) |
309693e0 RW |
31 | #:use-module (gnu packages curl) |
32 | #:use-module (gnu packages cyrus-sasl) | |
33 | #:use-module (gnu packages disk) | |
8fc7bd23 | 34 | #:use-module (gnu packages dns) |
fe420383 RW |
35 | #:use-module (gnu packages docbook) |
36 | #:use-module (gnu packages documentation) | |
efcada41 DC |
37 | #:use-module (gnu packages gl) |
38 | #:use-module (gnu packages glib) | |
a0f6c3b3 RW |
39 | #:use-module (gnu packages gnome) |
40 | #:use-module (gnu packages gtk) | |
e55354b8 | 41 | #:use-module (gnu packages image) |
fb9d7865 | 42 | #:use-module (gnu packages libusb) |
efcada41 DC |
43 | #:use-module (gnu packages linux) |
44 | #:use-module (gnu packages ncurses) | |
fe420383 | 45 | #:use-module (gnu packages networking) |
06da1a6b | 46 | #:use-module (gnu packages perl) |
efcada41 | 47 | #:use-module (gnu packages pkg-config) |
309693e0 | 48 | #:use-module (gnu packages polkit) |
fe420383 | 49 | #:use-module (gnu packages protobuf) |
efcada41 | 50 | #:use-module (gnu packages python) |
589e3f4e | 51 | #:use-module (gnu packages python-web) |
5d4a8f9b | 52 | #:use-module (gnu packages selinux) |
efcada41 | 53 | #:use-module (gnu packages sdl) |
38b9ce44 | 54 | #:use-module (gnu packages spice) |
efcada41 | 55 | #:use-module (gnu packages texinfo) |
309693e0 RW |
56 | #:use-module (gnu packages tls) |
57 | #:use-module (gnu packages web) | |
efcada41 | 58 | #:use-module (gnu packages xdisorg) |
309693e0 | 59 | #:use-module (gnu packages xml) |
efcada41 | 60 | #:use-module (guix build-system gnu) |
7cd2032f | 61 | #:use-module (guix build-system python) |
efcada41 | 62 | #:use-module (guix download) |
fe420383 | 63 | #:use-module ((guix licenses) #:select (gpl2 gpl2+ lgpl2.1 lgpl2.1+)) |
efcada41 DC |
64 | #:use-module (guix packages) |
65 | #:use-module (guix utils) | |
06da1a6b | 66 | #:use-module (srfi srfi-1)) |
b15fcf9e | 67 | |
e38a71ee LC |
68 | (define (qemu-patch commit file-name sha256) |
69 | "Return an origin for COMMIT." | |
70 | (origin | |
71 | (method url-fetch) | |
72 | (uri (string-append | |
73 | "http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h=" | |
74 | commit)) | |
75 | (sha256 sha256) | |
76 | (file-name file-name))) | |
77 | ||
06da1a6b | 78 | (define-public qemu |
b15fcf9e | 79 | (package |
06da1a6b | 80 | (name "qemu") |
f9bd2051 | 81 | (version "2.10.1") |
b15fcf9e LC |
82 | (source (origin |
83 | (method url-fetch) | |
2de7d137 | 84 | (uri (string-append "https://download.qemu.org/qemu-" |
fbd6fb1a | 85 | version ".tar.xz")) |
adf7e69c LF |
86 | (patches (search-patches "qemu-CVE-2017-15038.patch" |
87 | "qemu-CVE-2017-15268.patch" | |
88 | "qemu-CVE-2017-15289.patch")) | |
b15fcf9e LC |
89 | (sha256 |
90 | (base32 | |
f9bd2051 | 91 | "1ahwl7r18iw2ds0q3c51nlivqsan9hcgnc8bbf9pv366iy81mm8x")))) |
b15fcf9e LC |
92 | (build-system gnu-build-system) |
93 | (arguments | |
219b4556 LC |
94 | '(;; Running tests in parallel can occasionally lead to failures, like: |
95 | ;; boot_sector_test: assertion failed (signature == SIGNATURE): (0x00000000 == 0x0000dead) | |
96 | #:parallel-tests? #f | |
9a187b39 | 97 | #:configure-flags '("--enable-usb-redir" "--enable-opengl") |
05051e8b LC |
98 | #:phases |
99 | (modify-phases %standard-phases | |
100 | (replace 'configure | |
101 | (lambda* (#:key inputs outputs (configure-flags '()) | |
20c263b0 | 102 | #:allow-other-keys) |
05051e8b LC |
103 | ;; The `configure' script doesn't understand some of the |
104 | ;; GNU options. Thus, add a new phase that's compatible. | |
105 | (let ((out (assoc-ref outputs "out"))) | |
106 | (setenv "SHELL" (which "bash")) | |
b15fcf9e | 107 | |
05051e8b LC |
108 | ;; While we're at it, patch for tests. |
109 | (substitute* "tests/libqtest.c" | |
110 | (("/bin/sh") (which "sh"))) | |
50731c51 | 111 | |
05051e8b LC |
112 | ;; The binaries need to be linked against -lrt. |
113 | (setenv "LDFLAGS" "-lrt") | |
114 | (zero? | |
115 | (apply system* | |
116 | `("./configure" | |
117 | ,(string-append "--cc=" (which "gcc")) | |
d229ba95 EF |
118 | ;; Some architectures insist on using HOST_CC |
119 | ,(string-append "--host-cc=" (which "gcc")) | |
05051e8b LC |
120 | "--disable-debug-info" ; save build space |
121 | "--enable-virtfs" ; just to be sure | |
122 | ,(string-append "--prefix=" out) | |
aaba1204 | 123 | ,(string-append "--sysconfdir=/etc") |
05051e8b LC |
124 | ,@configure-flags)))))) |
125 | (add-after 'install 'install-info | |
126 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
127 | ;; Install the Info manual, unless Texinfo is missing. | |
128 | (or (not (assoc-ref inputs "texinfo")) | |
129 | (let ((out (assoc-ref outputs "out"))) | |
130 | (and (zero? (system* "make" "info")) | |
131 | (let ((infodir (string-append out "/share/info"))) | |
05051e8b | 132 | (for-each (lambda (info) |
8489d79d | 133 | (install-file info infodir)) |
1e347214 | 134 | (find-files "." "\\.info")) |
05051e8b | 135 | #t)))))) |
de3bbf65 LC |
136 | (add-before 'check 'make-gtester-verbose |
137 | (lambda _ | |
138 | ;; Make GTester verbose to facilitate investigation upon failure. | |
d229ba95 | 139 | (setenv "V" "1") #t)) |
05051e8b LC |
140 | (add-before 'check 'disable-test-qga |
141 | (lambda _ | |
43bec6d0 | 142 | (substitute* "tests/Makefile.include" |
05051e8b LC |
143 | ;; Comment out the test-qga test, which needs /sys and |
144 | ;; fails within the build environment. | |
145 | (("check-unit-.* tests/test-qga" all) | |
146 | (string-append "# " all))) | |
147 | #t))))) | |
b15fcf9e | 148 | (inputs ; TODO: Add optional inputs. |
2f042822 DC |
149 | `(("alsa-lib" ,alsa-lib) |
150 | ("attr" ,attr) | |
b15fcf9e | 151 | ("glib" ,glib) |
fa65e84a | 152 | ("libaio" ,libaio) |
2f042822 DC |
153 | ("libattr" ,attr) |
154 | ("libcap" ,libcap) ; virtfs support requires libcap & libattr | |
9a187b39 AP |
155 | ("libdrm" ,libdrm) |
156 | ("libepoxy" ,libepoxy) | |
513885b5 | 157 | ("libjpeg" ,libjpeg-turbo) |
2f042822 DC |
158 | ("libpng" ,libpng) |
159 | ("libusb" ,libusb) ;USB pass-through support | |
160 | ("mesa" ,mesa) | |
161 | ("ncurses" ,ncurses) | |
162 | ;; ("pciutils" ,pciutils) | |
2b2fdd45 | 163 | ("pixman" ,pixman) |
2f042822 | 164 | ("sdl" ,sdl) |
38b9ce44 | 165 | ("spice" ,spice) |
b376ec57 | 166 | ("usbredir" ,usbredir) |
b15fcf9e | 167 | ("util-linux" ,util-linux) |
2f042822 | 168 | ;; ("vde2" ,vde2) |
38b9ce44 | 169 | ("virglrenderer" ,virglrenderer) |
2f042822 DC |
170 | ("zlib" ,zlib))) |
171 | (native-inputs `(("glib:bin" ,glib "bin") ; gtester, etc. | |
172 | ("perl" ,perl) | |
173 | ("pkg-config" ,pkg-config) | |
c4c4cc05 | 174 | ("python" ,python-2) ; incompatible with Python 3 according to error message |
2f042822 | 175 | ("texinfo" ,texinfo))) |
2b2fdd45 | 176 | (home-page "http://www.qemu-project.org") |
06da1a6b | 177 | (synopsis "Machine emulator and virtualizer") |
72b9eebf | 178 | (description |
50731c51 | 179 | "QEMU is a generic machine emulator and virtualizer. |
72b9eebf LC |
180 | |
181 | When used as a machine emulator, QEMU can run OSes and programs made for one | |
50731c51 LC |
182 | machine (e.g. an ARM board) on a different machine---e.g., your own PC. By |
183 | using dynamic translation, it achieves very good performance. | |
72b9eebf LC |
184 | |
185 | When used as a virtualizer, QEMU achieves near native performances by | |
186 | executing the guest code directly on the host CPU. QEMU supports | |
187 | virtualization when executing under the Xen hypervisor or using | |
188 | the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86, | |
50731c51 LC |
189 | server and embedded PowerPC, and S390 guests.") |
190 | ||
191 | ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'. | |
f47638a3 LC |
192 | (license gpl2) |
193 | ||
194 | ;; Several tests fail on MIPS; see <http://hydra.gnu.org/build/117914>. | |
195 | (supported-systems (delete "mips64el-linux" %supported-systems)))) | |
50731c51 | 196 | |
06da1a6b LC |
197 | (define-public qemu-minimal |
198 | ;; QEMU without GUI support. | |
199 | (package (inherit qemu) | |
200 | (name "qemu-minimal") | |
201 | (synopsis "Machine emulator and virtualizer (without GUI)") | |
202 | (arguments | |
b376ec57 AP |
203 | (substitute-keyword-arguments (package-arguments qemu) |
204 | ((#:configure-flags _ '(list)) | |
205 | ;; Restrict to the targets supported by Guix. | |
206 | ''("--target-list=i386-softmmu,x86_64-softmmu,mips64el-softmmu,arm-softmmu,aarch64-softmmu")))) | |
06da1a6b LC |
207 | |
208 | ;; Remove dependencies on optional libraries, notably GUI libraries. | |
209 | (inputs (fold alist-delete (package-inputs qemu) | |
b376ec57 | 210 | '("libusb" "mesa" "sdl" "spice" "virglrenderer" |
9a187b39 | 211 | "usbredir" "libdrm" "libepoxy"))))) |
309693e0 | 212 | |
a0f6c3b3 RW |
213 | (define-public libosinfo |
214 | (package | |
215 | (name "libosinfo") | |
d701f8bd | 216 | (version "1.0.0") |
a0f6c3b3 RW |
217 | (source |
218 | (origin | |
219 | (method url-fetch) | |
d701f8bd | 220 | (uri (string-append "https://releases.pagure.org/libosinfo/libosinfo-" |
a0f6c3b3 RW |
221 | version ".tar.gz")) |
222 | (sha256 | |
223 | (base32 | |
d701f8bd | 224 | "0srrs2m6irqd4f867g8ls6jp2dq3ql0l9d0fh80d55sivvn2bd7p")))) |
a0f6c3b3 RW |
225 | (build-system gnu-build-system) |
226 | (arguments | |
d701f8bd RW |
227 | `(#:configure-flags |
228 | (list (string-append "--with-usb-ids-path=" | |
229 | (assoc-ref %build-inputs "usb.ids")) | |
230 | (string-append "--with-pci-ids-path=" | |
231 | (assoc-ref %build-inputs "pci.ids"))) | |
232 | #:phases | |
a0f6c3b3 | 233 | (modify-phases %standard-phases |
d701f8bd RW |
234 | ;; This odd test fails for unknown reasons. |
235 | (add-after 'unpack 'disable-broken-test | |
236 | (lambda _ | |
237 | (substitute* "test/Makefile.in" | |
238 | (("test-isodetect\\$\\(EXEEXT\\)") "")) | |
a0f6c3b3 RW |
239 | #t))))) |
240 | (inputs | |
241 | `(("libsoup" ,libsoup) | |
242 | ("libxml2" ,libxml2) | |
243 | ("libxslt" ,libxslt) | |
244 | ("gobject-introspection" ,gobject-introspection))) | |
245 | (native-inputs | |
246 | `(("check" ,check) | |
247 | ("glib" ,glib "bin") ; glib-mkenums, etc. | |
248 | ("gtk-doc" ,gtk-doc) | |
249 | ("vala" ,vala) | |
250 | ("intltool" ,intltool) | |
251 | ("pkg-config" ,pkg-config) | |
252 | ("pci.ids" | |
253 | ,(origin | |
254 | (method url-fetch) | |
d701f8bd | 255 | (uri "https://github.com/pciutils/pciids/raw/ad02084f0bc143e3c15e31a6152a3dfb1d7a3156/pci.ids") |
a0f6c3b3 RW |
256 | (sha256 |
257 | (base32 | |
d701f8bd | 258 | "0kfhpj5rnh24hz2714qhfmxk281vwc2w50sm73ggw5d15af7zfsw")))) |
a0f6c3b3 RW |
259 | ("usb.ids" |
260 | ,(origin | |
261 | (method url-fetch) | |
d701f8bd | 262 | (uri "http://linux-usb.cvs.sourceforge.net/viewvc/linux-usb/htdocs/usb.ids?revision=1.551") |
b02733d4 | 263 | (file-name "usb.ids") |
a0f6c3b3 RW |
264 | (sha256 |
265 | (base32 | |
d701f8bd | 266 | "17rg5i0wbyk289gr8v4kgvnc9q5bidz7ldcvv9x58l083wn16hq3")))))) |
a0f6c3b3 RW |
267 | (home-page "https://libosinfo.org/") |
268 | (synopsis "Operating system information database") | |
269 | (description "libosinfo is a GObject based library API for managing | |
270 | information about operating systems, hypervisors and the (virtual) hardware | |
271 | devices they can support. It includes a database containing device metadata | |
272 | and provides APIs to match/identify optimal devices for deploying an operating | |
273 | system on a hypervisor. Via GObject Introspection, the API is available in | |
274 | all common programming languages. Vala bindings are also provided.") | |
275 | ;; The library files are released under LGPLv2.1 or later; the source | |
276 | ;; files in the "tools" directory are released under GPLv2+. | |
277 | (license (list lgpl2.1+ gpl2+)))) | |
278 | ||
5d4a8f9b SB |
279 | (define-public lxc |
280 | (package | |
281 | (name "lxc") | |
56295c51 | 282 | (version "2.1.1") |
5d4a8f9b SB |
283 | (source (origin |
284 | (method url-fetch) | |
285 | (uri (string-append | |
286 | "https://linuxcontainers.org/downloads/lxc/lxc-" | |
287 | version ".tar.gz")) | |
288 | (sha256 | |
289 | (base32 | |
56295c51 | 290 | "1xpghrinxhm2072fwmn42pxhjwh7qx6cbsipw4s6g38a8mkklrk8")))) |
5d4a8f9b SB |
291 | (build-system gnu-build-system) |
292 | (native-inputs | |
293 | `(("pkg-config" ,pkg-config))) | |
294 | (inputs | |
295 | `(("gnutls" ,gnutls) | |
296 | ("libcap" ,libcap) | |
297 | ("libseccomp" ,libseccomp) | |
298 | ("libselinux" ,libselinux))) | |
299 | (arguments | |
300 | '(#:configure-flags | |
301 | '("--sysconfdir=/etc" | |
302 | "--localstatedir=/var") | |
303 | #:phases | |
304 | (modify-phases %standard-phases | |
305 | (replace 'install | |
306 | (lambda* (#:key outputs #:allow-other-keys) | |
307 | (let* ((out (assoc-ref outputs "out")) | |
308 | (bashcompdir (string-append out "/etc/bash_completion.d"))) | |
309 | (zero? (system* | |
310 | "make" "install" | |
311 | (string-append "bashcompdir=" bashcompdir) | |
312 | ;; Don't install files into /var and /etc. | |
313 | "LXCPATH=/tmp/var/lib/lxc" | |
314 | "localstatedir=/tmp/var" | |
315 | "sysconfdir=/tmp/etc" | |
316 | "sysconfigdir=/tmp/etc/default")))))))) | |
317 | (synopsis "Linux container tools") | |
318 | (home-page "https://linuxcontainers.org/") | |
319 | (description | |
320 | "LXC is a userspace interface for the Linux kernel containment features. | |
321 | Through a powerful API and simple tools, it lets Linux users easily create and | |
322 | manage system or application containers.") | |
323 | (license lgpl2.1+))) | |
324 | ||
309693e0 RW |
325 | (define-public libvirt |
326 | (package | |
327 | (name "libvirt") | |
2f110b32 | 328 | (version "3.7.0") |
309693e0 RW |
329 | (source (origin |
330 | (method url-fetch) | |
2e508b6d | 331 | (uri (string-append "https://libvirt.org/sources/libvirt-" |
309693e0 | 332 | version ".tar.xz")) |
7827032a | 333 | (patches (search-patches "libvirt-CVE-2017-1000256.patch")) |
309693e0 RW |
334 | (sha256 |
335 | (base32 | |
2f110b32 | 336 | "1fk75cdzg59y9hnfdpdwv83fsc1yffy3lac4ch19zygfkqhcnysf")))) |
309693e0 RW |
337 | (build-system gnu-build-system) |
338 | (arguments | |
339 | `(;; FAIL: virshtest | |
340 | ;; FAIL: virfirewalltest | |
341 | ;; FAIL: virkmodtest | |
342 | ;; FAIL: virnetsockettest | |
343 | ;; FAIL: networkxml2firewalltest | |
344 | ;; FAIL: nwfilterebiptablestest | |
345 | ;; FAIL: nwfilterxml2firewalltest | |
ced2d2b7 | 346 | ;; Times while running commandest. |
309693e0 RW |
347 | #:tests? #f |
348 | #:configure-flags | |
349 | (list "--with-polkit" | |
a4b93921 | 350 | "--sysconfdir=/etc" |
309693e0 RW |
351 | "--localstatedir=/var") |
352 | #:phases | |
353 | (modify-phases %standard-phases | |
354 | (add-after 'unpack 'fix-tests | |
355 | (lambda _ | |
356 | (substitute* '("tests/commandtest.c" | |
357 | "gnulib/tests/test-posix_spawn1.c" | |
358 | "gnulib/tests/test-posix_spawn2.c") | |
359 | (("/bin/sh") (which "sh"))) | |
360 | #t)) | |
a4b93921 SB |
361 | (replace 'install |
362 | ;; Since the sysconfdir and localstatedir should be /etc and /var | |
363 | ;; at runtime, we must prevent writing to them at installation | |
364 | ;; time. | |
365 | (lambda _ | |
366 | (zero? (system* "make" "install" | |
367 | "sysconfdir=/tmp/etc" | |
903e051a CB |
368 | "localstatedir=/tmp/var")))) |
369 | (add-after 'install 'wrap-libvirtd | |
370 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
371 | (let ((out (assoc-ref outputs "out"))) | |
372 | (wrap-program (string-append out "/sbin/libvirtd") | |
373 | `("PATH" = (,(string-append (assoc-ref inputs "iproute") | |
374 | "/sbin") | |
375 | ,(string-append (assoc-ref inputs "qemu") | |
376 | "/bin")))) | |
377 | #t)))))) | |
309693e0 RW |
378 | (inputs |
379 | `(("libxml2" ,libxml2) | |
380 | ("gnutls" ,gnutls) | |
381 | ("dbus" ,dbus) | |
382 | ("qemu" ,qemu) | |
309693e0 RW |
383 | ("libpcap" ,libpcap) |
384 | ("libnl" ,libnl) | |
385 | ("libuuid" ,util-linux) | |
386 | ("lvm2" ,lvm2) ; for libdevmapper | |
387 | ("curl" ,curl) | |
388 | ("openssl" ,openssl) | |
389 | ("cyrus-sasl" ,cyrus-sasl) | |
309693e0 | 390 | ("libyajl" ,libyajl) |
8fc7bd23 SB |
391 | ("audit" ,audit) |
392 | ("dmidecode" ,dmidecode) | |
393 | ("dnsmasq" ,dnsmasq) | |
394 | ("ebtables" ,ebtables) | |
395 | ("iproute" ,iproute) | |
396 | ("iptables" ,iptables))) | |
309693e0 | 397 | (native-inputs |
2f110b32 | 398 | `(("xsltproc" ,libxslt) |
b8fb94d5 TGR |
399 | ("perl" ,perl) |
400 | ("pkg-config" ,pkg-config) | |
401 | ("polkit" ,polkit) | |
402 | ("python" ,python-2))) | |
2e508b6d | 403 | (home-page "https://libvirt.org") |
309693e0 RW |
404 | (synopsis "Simple API for virtualization") |
405 | (description "Libvirt is a C toolkit to interact with the virtualization | |
406 | capabilities of recent versions of Linux. The library aims at providing long | |
407 | term stable C API initially for the Xen paravirtualization but should be able | |
408 | to integrate other virtualization mechanisms if needed.") | |
409 | (license lgpl2.1+))) | |
597ea122 RW |
410 | |
411 | (define-public libvirt-glib | |
412 | (package | |
413 | (name "libvirt-glib") | |
c3c03162 | 414 | (version "1.0.0") |
597ea122 RW |
415 | (source (origin |
416 | (method url-fetch) | |
417 | (uri (string-append "ftp://libvirt.org/libvirt/glib/" | |
418 | "libvirt-glib-" version ".tar.gz")) | |
419 | (sha256 | |
420 | (base32 | |
c3c03162 | 421 | "0iwa5sdbii52pjpdm5j37f67sdmf0kpcky4liwhy1nf43k85i4fa")))) |
597ea122 RW |
422 | (build-system gnu-build-system) |
423 | (arguments | |
424 | `(#:phases | |
425 | (modify-phases %standard-phases | |
426 | (add-after 'unpack 'fix-tests | |
427 | (lambda _ | |
428 | (substitute* "tests/test-events.c" | |
429 | (("/bin/true") (which "true"))) | |
430 | #t))))) | |
431 | (inputs | |
432 | `(("libxml2" ,libxml2) | |
433 | ("libvirt" ,libvirt) | |
434 | ("gobject-introspection" ,gobject-introspection) | |
435 | ("glib" ,glib) | |
436 | ("openssl" ,openssl) | |
437 | ("cyrus-sasl" ,cyrus-sasl) | |
438 | ("lvm2" ,lvm2) ; for libdevmapper | |
439 | ("libyajl" ,libyajl))) | |
440 | (native-inputs | |
441 | `(("pkg-config" ,pkg-config) | |
442 | ("intltool" ,intltool) | |
443 | ("glib" ,glib "bin") | |
444 | ("vala" ,vala))) | |
b3fee5c1 | 445 | (home-page "https://libvirt.org") |
597ea122 RW |
446 | (synopsis "GLib wrapper around libvirt") |
447 | (description "libvirt-glib wraps the libvirt library to provide a | |
448 | high-level object-oriented API better suited for glib-based applications, via | |
449 | three libraries: | |
450 | ||
451 | @enumerate | |
452 | @item libvirt-glib - GLib main loop integration & misc helper APIs | |
453 | @item libvirt-gconfig - GObjects for manipulating libvirt XML documents | |
454 | @item libvirt-gobject - GObjects for managing libvirt objects | |
455 | @end enumerate | |
456 | ") | |
457 | (license lgpl2.1+))) | |
7cd2032f RW |
458 | |
459 | (define-public python-libvirt | |
460 | (package | |
461 | (name "python-libvirt") | |
864f2f0e | 462 | (version "3.7.0") |
7cd2032f RW |
463 | (source (origin |
464 | (method url-fetch) | |
465 | (uri (pypi-uri "libvirt-python" version)) | |
466 | (sha256 | |
467 | (base32 | |
864f2f0e | 468 | "0vy0ai8z88yhzqfk1n08z1gda5flrqxcw9lg1012b3zg125qljhy")))) |
7cd2032f RW |
469 | (build-system python-build-system) |
470 | (arguments | |
471 | `(#:phases | |
472 | (modify-phases %standard-phases | |
473 | (add-after 'unpack 'patch-nosetests-path | |
474 | (lambda* (#:key inputs #:allow-other-keys) | |
475 | (substitute* "setup.py" | |
9271dfdd SB |
476 | (("\"/usr/bin/nosetests\"") |
477 | (string-append "\"" (which "nosetests") "\"")) | |
478 | (("self\\.spawn\\(\\[sys\\.executable, nose\\]\\)") | |
479 | (format #f "self.spawn([\"~a\", nose])" (which "bash")))) | |
7cd2032f RW |
480 | #t))))) |
481 | (inputs | |
482d9591 HG |
482 | `(("libvirt" ,libvirt))) |
483 | (propagated-inputs | |
484 | `(("python-lxml" ,python-lxml))) | |
7cd2032f RW |
485 | (native-inputs |
486 | `(("pkg-config" ,pkg-config) | |
487 | ("python-nose" ,python-nose))) | |
b3fee5c1 | 488 | (home-page "https://libvirt.org") |
7cd2032f RW |
489 | (synopsis "Python bindings to libvirt") |
490 | (description "This package provides Python bindings to the libvirt | |
491 | virtualization library.") | |
492 | (license lgpl2.1+))) | |
493 | ||
494 | (define-public python2-libvirt | |
495 | (package-with-python2 python-libvirt)) | |
2f82b53b RW |
496 | |
497 | (define-public virt-manager | |
498 | (package | |
499 | (name "virt-manager") | |
3b5870aa | 500 | (version "1.4.3") |
2f82b53b RW |
501 | (source (origin |
502 | (method url-fetch) | |
503 | (uri (string-append "https://virt-manager.org/download/sources" | |
504 | "/virt-manager/virt-manager-" | |
505 | version ".tar.gz")) | |
506 | (sha256 | |
507 | (base32 | |
3b5870aa | 508 | "093azs8p4p7y4nf5j25xpsvdxww7gky1g0hs8mkcvmpxl2wjd0jj")))) |
2f82b53b RW |
509 | (build-system python-build-system) |
510 | (arguments | |
511 | `(#:python ,python-2 | |
5834a405 | 512 | #:use-setuptools? #f ; Uses custom distutils 'install' command. |
2f82b53b RW |
513 | ;; Some of the tests seem to require network access to install virtual |
514 | ;; machines. | |
515 | #:tests? #f | |
f023685d AP |
516 | #:imported-modules ((guix build glib-or-gtk-build-system) |
517 | ,@%python-build-system-modules) | |
2f82b53b RW |
518 | #:modules ((ice-9 match) |
519 | (srfi srfi-26) | |
520 | (guix build python-build-system) | |
f023685d | 521 | ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:) |
2f82b53b RW |
522 | (guix build utils)) |
523 | #:phases | |
524 | (modify-phases %standard-phases | |
525 | (add-after 'unpack 'fix-setup | |
526 | (lambda* (#:key outputs #:allow-other-keys) | |
527 | (substitute* "virtcli/cliconfig.py" | |
528 | (("/usr") (assoc-ref outputs "out"))) | |
529 | #t)) | |
4ad8fbd1 AP |
530 | (add-after 'unpack 'fix-default-uri |
531 | (lambda* (#:key inputs #:allow-other-keys) | |
532 | ;; xen is not available for now - so only patch qemu | |
533 | (substitute* "virtManager/connect.py" | |
534 | (("/usr(/bin/qemu-system)" _ suffix) | |
535 | (string-append (assoc-ref inputs "qemu") suffix))) | |
536 | #t)) | |
2f82b53b RW |
537 | (add-before 'wrap 'wrap-with-GI_TYPELIB_PATH |
538 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
539 | (let* ((bin (string-append (assoc-ref outputs "out") "/bin")) | |
540 | (bin-files (find-files bin ".*")) | |
541 | (paths (map (match-lambda | |
542 | ((output . directory) | |
543 | (let* ((girepodir (string-append | |
544 | directory | |
545 | "/lib/girepository-1.0"))) | |
546 | (if (file-exists? girepodir) | |
547 | girepodir #f)))) | |
548 | inputs))) | |
549 | (for-each (lambda (file) | |
550 | (format #t "wrapping ~a\n" file) | |
551 | (wrap-program file | |
552 | `("GI_TYPELIB_PATH" ":" prefix | |
553 | ,(filter identity paths)))) | |
554 | bin-files)) | |
f023685d AP |
555 | #t)) |
556 | (add-after 'install 'glib-or-gtk-compile-schemas | |
557 | (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas)) | |
558 | (add-after 'install 'glib-or-gtk-wrap | |
559 | (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap))))) | |
2f82b53b | 560 | (inputs |
b1e9837a AP |
561 | `(("dconf" ,dconf) |
562 | ("gtk+" ,gtk+) | |
45214efe | 563 | ("gtk-vnc" ,gtk-vnc) |
2f82b53b RW |
564 | ("libvirt" ,libvirt) |
565 | ("libvirt-glib" ,libvirt-glib) | |
566 | ("libosinfo" ,libosinfo) | |
45214efe | 567 | ("vte" ,vte) |
2f82b53b RW |
568 | ("gobject-introspection" ,gobject-introspection) |
569 | ("python2-libvirt" ,python2-libvirt) | |
570 | ("python2-requests" ,python2-requests) | |
571 | ("python2-ipaddr" ,python2-ipaddr) | |
b764a9f5 | 572 | ("python2-pycairo" ,python2-pycairo) |
2f82b53b | 573 | ("python2-pygobject" ,python2-pygobject) |
8da7f792 AP |
574 | ("python2-libxml2" ,python2-libxml2) |
575 | ("spice-gtk" ,spice-gtk))) | |
2f82b53b RW |
576 | ;; virt-manager searches for qemu-img or kvm-img in the PATH. |
577 | (propagated-inputs | |
578 | `(("qemu" ,qemu))) | |
579 | (native-inputs | |
580 | `(("glib" ,glib "bin") ; glib-compile-schemas. | |
e6efcd58 | 581 | ("gtk+" ,gtk+ "bin") ; gtk-update-icon-cache |
2f82b53b RW |
582 | ("perl" ,perl) ; pod2man |
583 | ("intltool" ,intltool))) | |
584 | (home-page "https://virt-manager.org/") | |
585 | (synopsis "Manage virtual machines") | |
586 | (description | |
587 | "The virt-manager application is a desktop user interface for managing | |
588 | virtual machines through libvirt. It primarily targets KVM VMs, but also | |
589 | manages Xen and LXC (Linux containers). It presents a summary view of running | |
590 | domains, their live performance and resource utilization statistics.") | |
591 | (license gpl2+))) | |
fe420383 RW |
592 | |
593 | (define-public criu | |
594 | (package | |
595 | (name "criu") | |
596 | (version "3.5") | |
597 | (source (origin | |
598 | (method url-fetch) | |
599 | (uri (string-append "http://download.openvz.org/criu/criu-" | |
600 | version ".tar.bz2")) | |
601 | (sha256 | |
602 | (base32 | |
603 | "1w0ybla7ac0ql0jzh0vxdf2w9amqp88jcg0na3b33r3hq8acry6x")))) | |
604 | (build-system gnu-build-system) | |
605 | (arguments | |
606 | `(#:test-target "test" | |
607 | #:tests? #f ; tests require mounting as root | |
608 | #:make-flags | |
609 | (list (string-append "PREFIX=" (assoc-ref %outputs "out")) | |
610 | (string-append "LIBDIR=" (assoc-ref %outputs "out") | |
611 | "/lib")) | |
612 | #:phases | |
613 | (modify-phases %standard-phases | |
614 | (replace 'configure | |
615 | (lambda* (#:key inputs #:allow-other-keys) | |
616 | ;; The includes for libnl are located in a sub-directory. | |
617 | (setenv "C_INCLUDE_PATH" | |
618 | (string-append (assoc-ref inputs "libnl") | |
619 | "/include/libnl3:" | |
620 | (getenv "C_INCLUDE_PATH"))) | |
621 | ;; Prevent xmlto from failing the install phase. | |
622 | (substitute* "Documentation/Makefile" | |
623 | (("XMLTO.*:=.*") | |
624 | (string-append "XMLTO:=" | |
625 | (assoc-ref inputs "xmlto") | |
626 | "/bin/xmlto" | |
627 | " --skip-validation " | |
628 | " -x " | |
629 | (assoc-ref inputs "docbook-xsl") | |
630 | "/xml/xsl/docbook-xsl-" | |
631 | ,(package-version docbook-xsl) | |
632 | "/manpages/docbook.xsl"))) | |
633 | #t)) | |
634 | (add-before 'build 'fix-symlink | |
635 | (lambda* (#:key inputs #:allow-other-keys) | |
636 | ;; The file 'images/google/protobuf/descriptor.proto' points to | |
637 | ;; /usr/include/..., which obviously does not exist. | |
638 | (let* ((file "google/protobuf/descriptor.proto") | |
639 | (target (string-append "images/" file)) | |
640 | (source (string-append (assoc-ref inputs "protobuf") | |
641 | "/include/" file))) | |
642 | (delete-file target) | |
643 | (symlink source target) | |
644 | #t))) | |
645 | (add-after 'install 'wrap | |
646 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
647 | ;; Make sure 'crit' runs with the correct PYTHONPATH. | |
648 | (let* ((out (assoc-ref outputs "out")) | |
649 | (path (string-append out | |
650 | "/lib/python" | |
651 | (string-take (string-take-right | |
652 | (assoc-ref inputs "python") 5) 3) | |
653 | "/site-packages:" | |
654 | (getenv "PYTHONPATH")))) | |
655 | (wrap-program (string-append out "/bin/crit") | |
656 | `("PYTHONPATH" ":" prefix (,path)))) | |
657 | #t))))) | |
658 | (inputs | |
659 | `(("protobuf" ,protobuf) | |
660 | ("python" ,python-2) | |
661 | ("python2-protobuf" ,python2-protobuf) | |
662 | ("python2-ipaddr" ,python2-ipaddr) | |
663 | ("iproute" ,iproute) | |
664 | ("libaio" ,libaio) | |
665 | ("libcap" ,libcap) | |
666 | ("libnet" ,libnet) | |
667 | ("libnl" ,libnl))) | |
668 | (native-inputs | |
669 | `(("pkg-config" ,pkg-config) | |
3bf94bc8 | 670 | ("perl" ,perl) |
fe420383 RW |
671 | ("protobuf-c" ,protobuf-c) |
672 | ("asciidoc" ,asciidoc) | |
673 | ("xmlto" ,xmlto) | |
674 | ("docbook-xml" ,docbook-xml) | |
675 | ("docbook-xsl" ,docbook-xsl))) | |
676 | (home-page "https://criu.org") | |
677 | (synopsis "Checkpoint and restore in user space") | |
678 | (description "Using this tool, you can freeze a running application (or | |
679 | part of it) and checkpoint it to a hard drive as a collection of files. You | |
680 | can then use the files to restore and run the application from the point it | |
681 | was frozen at. The distinctive feature of the CRIU project is that it is | |
682 | mainly implemented in user space.") | |
683 | ;; The project is licensed under GPLv2; files in the lib/ directory are | |
684 | ;; LGPLv2.1. | |
685 | (license (list gpl2 lgpl2.1)))) |