about summary refs log tree commit diff
path: root/pkgs/applications/virtualization/qemu
diff options
context:
space:
mode:
authorvolth <volth@webmaster.ms>2017-12-06 18:06:33 +0000
committerTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>2017-12-19 06:22:16 +0200
commit489d3e7d062800ed3fb6c32b292dc443926f9ed8 (patch)
tree75a81d2e3fb11460798d80905e973d5f01895a4d /pkgs/applications/virtualization/qemu
parent8f53673c64d73a16a5a42a455245b664a5b621eb (diff)
downloadnixlib-489d3e7d062800ed3fb6c32b292dc443926f9ed8.tar
nixlib-489d3e7d062800ed3fb6c32b292dc443926f9ed8.tar.gz
nixlib-489d3e7d062800ed3fb6c32b292dc443926f9ed8.tar.bz2
nixlib-489d3e7d062800ed3fb6c32b292dc443926f9ed8.tar.lz
nixlib-489d3e7d062800ed3fb6c32b292dc443926f9ed8.tar.xz
nixlib-489d3e7d062800ed3fb6c32b292dc443926f9ed8.tar.zst
nixlib-489d3e7d062800ed3fb6c32b292dc443926f9ed8.zip
qemu: fix bin/qemu-kvm on aarch64 + minor fixes
 * $out/bin/qemu-kvm should point to qemu-system-aarch64 on aarch64, libvirt expect it
 * makeWrapper codes are separated as some architectures might require additional command flags (https://github.com/NixOS/nixpkgs/issues/31606#issuecomment-349675127)
 * x86_64-on-i686 is not a native emulation and not supported by KVM, so it is removed from the list
Diffstat (limited to 'pkgs/applications/virtualization/qemu')
-rw-r--r--pkgs/applications/virtualization/qemu/default.nix22
1 files changed, 11 insertions, 11 deletions
diff --git a/pkgs/applications/virtualization/qemu/default.nix b/pkgs/applications/virtualization/qemu/default.nix
index 5d70c6716005..91b02f7ad1f0 100644
--- a/pkgs/applications/virtualization/qemu/default.nix
+++ b/pkgs/applications/virtualization/qemu/default.nix
@@ -24,10 +24,11 @@ let
     + optionalString pulseSupport "pa,"
     + optionalString sdlSupport "sdl,";
 
-  hostCpuTargets = if stdenv.isi686 || stdenv.isx86_64 then "i386-softmmu,x86_64-softmmu"
-                      else if stdenv.isArm then "arm-softmmu"
-                      else if stdenv.isAarch64 then "aarch64-softmmu"
-                      else throw "Don't know how to build a 'hostCpuOnly = true' QEMU";
+  hostCpuTargets = if stdenv.isx86_64 then "i386-softmmu,x86_64-softmmu"
+                   else if stdenv.isi686 then "i386-softmmu"
+                   else if stdenv.isArm then "arm-softmmu"
+                   else if stdenv.isAarch64 then "aarch64-softmmu"
+                   else throw "Don't know how to build a 'hostCpuOnly = true' QEMU";
 in
 
 stdenv.mkDerivation rec {
@@ -92,14 +93,13 @@ stdenv.mkDerivation rec {
       done
     '';
 
+  # Add a ‘qemu-kvm’ wrapper for compatibility/convenience.
   postInstall =
-    ''
-      # Add a ‘qemu-kvm’ wrapper for compatibility/convenience.
-      p="$out/bin/qemu-system-${if stdenv.system == "x86_64-linux" then "x86_64" else "i386"}"
-      if [ -e "$p" ]; then
-        makeWrapper "$p" $out/bin/qemu-kvm --add-flags "\$([ -e /dev/kvm ] && echo -enable-kvm)"
-      fi
-    '';
+    if stdenv.isx86_64       then ''makeWrapper $out/bin/qemu-system-x86_64  $out/bin/qemu-kvm --add-flags "\$([ -e /dev/kvm ] && echo -enable-kvm)"''
+    else if stdenv.isi686    then ''makeWrapper $out/bin/qemu-system-i386    $out/bin/qemu-kvm --add-flags "\$([ -e /dev/kvm ] && echo -enable-kvm)"''
+    else if stdenv.isArm     then ''makeWrapper $out/bin/qemu-system-arm     $out/bin/qemu-kvm --add-flags "\$([ -e /dev/kvm ] && echo -enable-kvm)"''
+    else if stdenv.isAarch64 then ''makeWrapper $out/bin/qemu-system-aarch64 $out/bin/qemu-kvm --add-flags "\$([ -e /dev/kvm ] && echo -enable-kvm)"''
+    else "";
 
   meta = with stdenv.lib; {
     homepage = http://www.qemu.org/;