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