diff options
author | Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi> | 2017-12-06 20:26:22 +0200 |
---|---|---|
committer | Tuomas Tynkkynen <tuomas@tuxera.com> | 2018-01-30 16:57:27 +0200 |
commit | 71631a922b4005497fe3b93fdfe5899e2f6d7a2c (patch) | |
tree | f894da583f2973a0959df8da2bc28d114db5efe3 /nixos | |
parent | 8c4f8c51a640e169484e4513b62d50844b2ed779 (diff) |
runInLinuxVM: Use QEMU command line that works on other architectures
... by moving the existing definition to qemu-flags.nix and reusing
that.
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/lib/qemu-flags.nix | 6 | ||||
-rw-r--r-- | nixos/modules/virtualisation/qemu-vm.nix | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/nixos/lib/qemu-flags.nix b/nixos/lib/qemu-flags.nix index fb00c3183fbf..fcdcbf1b0077 100644 --- a/nixos/lib/qemu-flags.nix +++ b/nixos/lib/qemu-flags.nix @@ -12,4 +12,10 @@ else if pkgs.stdenv.isArm || pkgs.stdenv.isAarch64 then "ttyAMA0" else throw "Unknown QEMU serial device for system '${pkgs.stdenv.system}'"; + qemuBinary = qemuPkg: { + "i686-linux" = "${qemuPkg}/bin/qemu-kvm"; + "x86_64-linux" = "${qemuPkg}/bin/qemu-kvm -cpu kvm64"; + "armv7l-linux" = "${qemuPkg}/bin/qemu-system-arm -enable-kvm -machine virt -cpu host"; + "aarch64-linux" = "${qemuPkg}/bin/qemu-system-aarch64 -enable-kvm -machine virt,gic-version=host -cpu host"; + }.${pkgs.stdenv.system} or (throw "Unknown QEMU binary for '${pkgs.stdenv.system}'"); } diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index c52f637604ae..13d0eb7de5c2 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -15,12 +15,6 @@ with import ../../lib/qemu-flags.nix { inherit pkgs; }; let qemu = config.system.build.qemu or pkgs.qemu_test; - qemuKvm = { - "i686-linux" = "${qemu}/bin/qemu-kvm"; - "x86_64-linux" = "${qemu}/bin/qemu-kvm -cpu kvm64"; - "armv7l-linux" = "${qemu}/bin/qemu-system-arm -enable-kvm -machine virt -cpu host"; - "aarch64-linux" = "${qemu}/bin/qemu-system-aarch64 -enable-kvm -machine virt,gic-version=host -cpu host"; - }.${pkgs.stdenv.system}; vmName = if config.networking.hostName == "" @@ -79,7 +73,7 @@ let '')} # Start QEMU. - exec ${qemuKvm} \ + exec ${qemuBinary qemu} \ -name ${vmName} \ -m ${toString config.virtualisation.memorySize} \ -smp ${toString config.virtualisation.cores} \ |