nixpkgs/pkgs/os-specific/linux/qemu-kvm/default.nix

58 lines
1.8 KiB
Nix
Raw Normal View History

{ stdenv, fetchurl, attr, zlib, SDL, alsaLib, pkgconfig, pciutils, libuuid, vde2
2012-08-28 00:55:43 +02:00
, libjpeg, libpng, ncurses, python, glib, libaio, mesa
2012-09-13 16:13:16 +02:00
, spice, spice_protocol, spiceSupport ? false }:
assert stdenv.isLinux;
let version = "1.2.0"; in
stdenv.mkDerivation rec {
name = "qemu-kvm-${version}";
src = fetchurl {
url = "mirror://sourceforge/kvm/qemu-kvm/${version}/${name}.tar.gz";
sha256 = "018vb5nmk2fsm143bs2bl2wirhasd4b10d7jchl32zik4inbk2p9";
};
postPatch =
'' for i in $(find . -type f)
do
sed -i "$i" \
-e 's|/bin/bash|/bin/sh|g ;
s|/usr/bin/python|${python}/bin/python|g ;
s|/bin/rm|rm|g'
done
2012-08-28 00:55:43 +02:00
'' + stdenv.lib.optionalString spiceSupport ''
for i in configure spice-qemu-char.c ui/spice-input.c ui/spice-core.c ui/qemu-spice.h
do
substituteInPlace $i --replace '#include <spice.h>' '#include <spice/spice.h>'
done
'';
configureFlags =
[ "--audio-drv-list=alsa"
"--smbd=smbd" # use `smbd' from $PATH
2012-08-28 00:55:43 +02:00
] ++ stdenv.lib.optional spiceSupport "--enable-spice";
enableParallelBuilding = true;
buildInputs =
[ attr zlib SDL alsaLib pkgconfig pciutils libuuid vde2 libjpeg libpng
ncurses python glib libaio mesa
2012-09-13 16:13:16 +02:00
] ++ stdenv.lib.optionals spiceSupport [ spice_protocol spice ];
postInstall =
''
# Libvirt expects us to be called `qemu-kvm'. Otherwise it will
# set the domain type to "qemu" rather than "kvm", which can
# cause architecture selection to misbehave.
ln -sv $(cd $out/bin && echo qemu-system-*) $out/bin/qemu-kvm
'';
meta = {
homepage = http://www.linux-kvm.org/;
description = "A full virtualization solution for Linux on x86 hardware containing virtualization extensions";
platforms = stdenv.lib.platforms.linux;
};
}