Files
nixpkgs/pkgs/development/libraries/libvirt/default.nix
T

99 lines
3.0 KiB
Nix
Raw Normal View History

{ stdenv, fetchurl, fetchpatch
, pkgconfig, makeWrapper
2017-03-25 14:58:26 +01:00
, libxml2, gnutls, devicemapper, perl, python2, attr
2015-10-03 20:52:03 +02:00
, iproute, iptables, readline, lvm2, utillinux, systemd, libpciaccess, gettext
2017-03-25 14:58:26 +01:00
, libtasn1, ebtables, libgcrypt, yajl, pmutils, libcap_ng, libapparmor
, dnsmasq, libnl, libpcap, libxslt, xhtml1, numad, numactl, perlPackages
2017-04-10 23:36:35 +02:00
, curl, libiconv, gmp, xen, zfs, parted
2011-03-14 14:46:41 +00:00
}:
2017-03-23 15:26:37 -05:00
with stdenv.lib;
2016-04-19 23:53:47 +02:00
# if you update, also bump pythonPackages.libvirt or it will break
2014-03-12 08:27:05 +01:00
stdenv.mkDerivation rec {
2010-01-27 12:12:35 +00:00
name = "libvirt-${version}";
2017-03-27 17:07:14 +02:00
version = "3.1.0";
2010-01-27 12:12:35 +00:00
src = fetchurl {
url = "http://libvirt.org/sources/${name}.tar.xz";
2017-03-27 17:07:14 +02:00
sha256 = "1a9j6yqfy7i5yv414wk6nv26a5bpfyyg0rpcps6ybi6a1yd04ybq";
2010-01-27 12:12:35 +00:00
};
patches = [ ./build-on-bsd.patch ];
nativeBuildInputs = [ makeWrapper pkgconfig ];
2014-03-12 08:27:05 +01:00
buildInputs = [
libxml2 gnutls perl python2 readline gettext libtasn1 libgcrypt yajl
2017-06-05 05:50:46 +00:00
libxslt xhtml1 perlPackages.XMLXPath curl libpcap
2017-03-23 15:26:37 -05:00
] ++ optionals stdenv.isLinux [
libpciaccess devicemapper lvm2 utillinux systemd libnl numad zfs
2017-06-05 05:50:46 +00:00
libapparmor libcap_ng numactl xen attr parted
2017-03-23 15:26:37 -05:00
] ++ optionals stdenv.isDarwin [
2015-12-24 23:34:47 -05:00
libiconv gmp
2014-03-12 08:27:05 +01:00
];
2017-03-23 15:26:37 -05:00
preConfigure = optionalString stdenv.isLinux ''
2016-08-23 01:13:49 +03:00
PATH=${stdenv.lib.makeBinPath [ iproute iptables ebtables lvm2 systemd ]}:$PATH
2016-07-01 20:12:33 +02:00
substituteInPlace configure \
--replace 'as_dummy="/bin:/usr/bin:/usr/sbin"' 'as_dummy="${numad}/bin"'
2015-12-24 23:34:47 -05:00
'' + ''
PATH=${dnsmasq}/bin:$PATH
patchShebangs . # fixes /usr/bin/python references
2014-03-12 08:27:05 +01:00
'';
2014-03-12 08:27:05 +01:00
configureFlags = [
"--localstatedir=/var"
"--sysconfdir=/var/lib"
2015-12-24 23:34:47 -05:00
"--with-libpcap"
"--with-vmware"
"--with-vbox"
"--with-test"
"--with-esx"
"--with-remote"
2017-03-23 15:26:37 -05:00
] ++ optionals stdenv.isLinux [
2017-03-25 14:58:26 +01:00
"--with-attr"
"--with-apparmor"
"--with-secdriver-apparmor"
2015-12-24 23:34:47 -05:00
"--with-numad"
2014-03-27 14:08:36 +01:00
"--with-macvtap"
"--with-virtualport"
"--with-init-script=systemd+redhat"
2017-06-05 05:50:46 +00:00
"--with-storage-disk"
2016-05-23 04:03:41 +02:00
"--with-storage-zfs"
2017-03-23 15:26:37 -05:00
] ++ optionals stdenv.isDarwin [
2015-12-24 23:34:47 -05:00
"--with-init-script=none"
2014-03-12 08:27:05 +01:00
];
2011-02-25 13:24:41 +00:00
2014-03-12 08:27:05 +01:00
installFlags = [
"localstatedir=$(TMPDIR)/var"
"sysconfdir=$(out)/var/lib"
2014-03-12 08:27:05 +01:00
];
2010-01-27 12:12:35 +00:00
2014-03-12 08:27:05 +01:00
postInstall = ''
sed -i 's/ON_SHUTDOWN=suspend/ON_SHUTDOWN=''${ON_SHUTDOWN:-suspend}/' $out/libexec/libvirt-guests.sh
2014-03-12 08:27:05 +01:00
substituteInPlace $out/libexec/libvirt-guests.sh \
--replace "$out/bin" "${gettext}/bin" \
--replace "lock/subsys" "lock"
2017-03-23 15:26:37 -05:00
'' + optionalString stdenv.isLinux ''
2017-06-05 05:50:46 +00:00
rm $out/lib/systemd/system/{virtlockd,virtlogd}.*
2014-03-12 08:27:05 +01:00
wrapProgram $out/sbin/libvirtd \
2017-03-23 15:26:37 -05:00
--prefix PATH : ${makeBinPath [ iptables iproute pmutils numad numactl ]}
2014-03-12 08:27:05 +01:00
'';
2012-04-19 21:40:07 +00:00
enableParallelBuilding = true;
2014-03-12 08:27:05 +01:00
NIX_CFLAGS_COMPILE = "-fno-stack-protector";
2012-04-19 21:40:07 +00:00
2017-03-23 15:26:37 -05:00
meta = {
2010-01-27 12:12:35 +00:00
homepage = http://libvirt.org/;
repositories.git = git://libvirt.org/libvirt.git;
2014-03-12 08:27:05 +01:00
description = ''
A toolkit to interact with the virtualization capabilities of recent
versions of Linux (and other OSes)
'';
license = licenses.lgpl2Plus;
2015-12-24 23:34:47 -05:00
platforms = platforms.unix;
2016-03-19 16:33:49 +01:00
maintainers = with maintainers; [ fpletz ];
2010-01-27 12:12:35 +00:00
};
}