1{ stdenv, fetchurl, fetchpatch 2, pkgconfig, makeWrapper 3, libxml2, gnutls, devicemapper, perl, python 4, iproute, iptables, readline, lvm2, utillinux, udev, libpciaccess, gettext 5, libtasn1, ebtables, libgcrypt, yajl, pmutils, libcap_ng 6, dnsmasq, libnl, libpcap, libxslt, xhtml1, numad, numactl, perlPackages 7, curl, libiconv, gmp, xen 8}: 9 10stdenv.mkDerivation rec { 11 name = "libvirt-${version}"; 12 version = "1.3.0"; 13 14 src = fetchurl { 15 url = "http://libvirt.org/sources/${name}.tar.gz"; 16 sha256 = "ebcf5645fa565e3fe2fe94a86e841db9b768cf0e0a7e6cf395c6327f9a23bd64"; 17 }; 18 19 patches = [ ./build-on-bsd.patch ]; 20 21 nativeBuildInputs = [ makeWrapper pkgconfig ]; 22 buildInputs = [ 23 libxml2 gnutls perl python readline 24 gettext libtasn1 libgcrypt yajl 25 libxslt xhtml1 perlPackages.XMLXPath curl libpcap 26 ] ++ stdenv.lib.optionals stdenv.isLinux [ 27 libpciaccess devicemapper lvm2 utillinux udev libcap_ng 28 libnl numad numactl xen 29 ] ++ stdenv.lib.optionals stdenv.isDarwin [ 30 libiconv gmp 31 ]; 32 33 preConfigure = stdenv.lib.optionalString stdenv.isLinux '' 34 PATH=${iproute}/sbin:${iptables}/sbin:${ebtables}/sbin:${lvm2}/sbin:${udev}/sbin:$PATH 35 substituteInPlace configure --replace 'as_dummy="/bin:/usr/bin:/usr/sbin"' 'as_dummy="${numad}/bin"' 36 '' + '' 37 PATH=${dnsmasq}/bin:$PATH 38 patchShebangs . # fixes /usr/bin/python references 39 ''; 40 41 configureFlags = [ 42 "--localstatedir=/var" 43 "--sysconfdir=/var/lib" 44 "--with-libpcap" 45 "--with-vmware" 46 "--with-vbox" 47 "--with-test" 48 "--with-esx" 49 "--with-remote" 50 ] ++ stdenv.lib.optionals stdenv.isLinux [ 51 "--with-numad" 52 "--with-macvtap" 53 "--with-virtualport" 54 "--with-init-script=redhat" 55 ] ++ stdenv.lib.optionals stdenv.isDarwin [ 56 "--with-init-script=none" 57 ]; 58 59 installFlags = [ 60 "localstatedir=$(TMPDIR)/var" 61 "sysconfdir=$(out)/var/lib" 62 ]; 63 64 postInstall = '' 65 sed -i 's/ON_SHUTDOWN=suspend/ON_SHUTDOWN=''${ON_SHUTDOWN:-suspend}/' $out/libexec/libvirt-guests.sh 66 substituteInPlace $out/libexec/libvirt-guests.sh \ 67 --replace "$out/bin" "${gettext}/bin" 68 '' + stdenv.lib.optionalString stdenv.isLinux '' 69 wrapProgram $out/sbin/libvirtd \ 70 --prefix PATH : ${iptables}/sbin:${iproute}/sbin:${pmutils}/bin:${numad}/bin:${numactl}/bin 71 ''; 72 73 enableParallelBuilding = true; 74 75 NIX_CFLAGS_COMPILE = "-fno-stack-protector"; 76 77 meta = with stdenv.lib; { 78 homepage = http://libvirt.org/; 79 repositories.git = git://libvirt.org/libvirt.git; 80 description = '' 81 A toolkit to interact with the virtualization capabilities of recent 82 versions of Linux (and other OSes) 83 ''; 84 license = licenses.lgpl2Plus; 85 platforms = platforms.unix; 86 }; 87}