mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 04:43:09 +03:00
nixos/qemu-vm: Set QEMU command line depending on architecture
This commit is contained in:
parent
3b2056536c
commit
43cb964e17
@ -14,6 +14,12 @@ with lib;
|
||||
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 -cpu host";
|
||||
}.${pkgs.stdenv.system};
|
||||
|
||||
vmName =
|
||||
if config.networking.hostName == ""
|
||||
@ -72,11 +78,10 @@ let
|
||||
'')}
|
||||
|
||||
# Start QEMU.
|
||||
exec ${qemu}/bin/qemu-kvm \
|
||||
exec ${qemuKvm} \
|
||||
-name ${vmName} \
|
||||
-m ${toString config.virtualisation.memorySize} \
|
||||
-smp ${toString config.virtualisation.cores} \
|
||||
${optionalString (pkgs.stdenv.system == "x86_64-linux") "-cpu kvm64"} \
|
||||
${concatStringsSep " " config.virtualisation.qemu.networkingOptions} \
|
||||
-virtfs local,path=/nix/store,security_model=none,mount_tag=store \
|
||||
-virtfs local,path=$TMPDIR/xchg,security_model=none,mount_tag=xchg \
|
||||
|
Loading…
Reference in New Issue
Block a user