diff --git a/doc/manual/man-nixos-rebuild.xml b/doc/manual/man-nixos-rebuild.xml
index 4828215977e..0ed9f22ef99 100644
--- a/doc/manual/man-nixos-rebuild.xml
+++ b/doc/manual/man-nixos-rebuild.xml
@@ -128,10 +128,10 @@ $ nixos-rebuild build-vm
$ ./result/bin/run-*-vm
- The VM is implemented using the
- qemu-kvm package. For best performance, you
- should load the kvm-intel or
- kvm-amd kernel modules.
+ The VM is implemented using the qemu
+ package. For best performance, you should load the
+ kvm-intel or kvm-amd
+ kernel modules to get hardware virtualisation.
The VM mounts the Nix store of the host through the CIFS
filesystem. (qemu-kvm automatically starts a
diff --git a/lib/test-driver/Machine.pm b/lib/test-driver/Machine.pm
index 615fe09bdfc..f5bf40a1868 100644
--- a/lib/test-driver/Machine.pm
+++ b/lib/test-driver/Machine.pm
@@ -30,7 +30,7 @@ sub new {
if (!$startCommand) {
# !!! merge with qemu-vm.nix.
$startCommand =
- "qemu-kvm -m 384 " .
+ "$ENV{'qemu'} -enable-kvm -m 384 " .
"-net nic,model=virtio \$QEMU_OPTS ";
my $iface = $args->{hdaInterface} || "virtio";
$startCommand .= "-drive file=" . Cwd::abs_path($args->{hda}) . ",if=$iface,boot=on,werror=report "
diff --git a/lib/testing.nix b/lib/testing.nix
index 280cdf579db..653eaf3e9a6 100644
--- a/lib/testing.nix
+++ b/lib/testing.nix
@@ -28,7 +28,8 @@ rec {
wrapProgram $out/bin/nixos-test-driver \
--prefix PATH : "${pkgs.qemu}/bin:${pkgs.vde2}/bin:${imagemagick}/bin:${coreutils}/bin" \
- --prefix PERL5LIB : "${lib.makePerlPath [ perlPackages.TermReadLineGnu perlPackages.XMLWriter perlPackages.IOTty ]}:$out/lib/perl5/site_perl"
+ --prefix PERL5LIB : "${lib.makePerlPath [ perlPackages.TermReadLineGnu perlPackages.XMLWriter perlPackages.IOTty ]}:$out/lib/perl5/site_perl" \
+ --set qemu qemu-system-${if pkgs.stdenv.system == "x86_64-linux" then "x86_64" else "i386"}
'';
};
diff --git a/modules/virtualisation/qemu-vm.nix b/modules/virtualisation/qemu-vm.nix
index 70487c329a8..6715b494dfb 100644
--- a/modules/virtualisation/qemu-vm.nix
+++ b/modules/virtualisation/qemu-vm.nix
@@ -226,7 +226,7 @@ let
''
mkdir $out
diskImage=$out/disk.img
- ${pkgs.vmTools.kvm}/bin/qemu-img create -f qcow2 $diskImage "32M"
+ ${pkgs.qemu}/bin/qemu-img create -f qcow2 $diskImage "32M"
'';
buildInputs = [ pkgs.utillinux ];
}