2010-05-27 12:20:37 +00:00
|
|
|
# QEMU flags shared between various Nix expressions.
|
2018-01-30 09:22:41 +00:00
|
|
|
{ pkgs }:
|
2010-05-27 12:20:37 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
|
2010-12-07 00:44:29 +00:00
|
|
|
qemuNICFlags = nic: net: machine:
|
2011-08-02 06:52:10 +00:00
|
|
|
[ "-net nic,vlan=${toString nic},macaddr=52:54:00:12:${toString net}:${toString machine},model=virtio"
|
|
|
|
"-net vde,vlan=${toString nic},sock=$QEMU_VDE_SOCKET_${toString net}"
|
|
|
|
];
|
2011-01-12 18:47:23 +00:00
|
|
|
|
2018-01-30 09:28:26 +00:00
|
|
|
qemuSerialDevice = if pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64 then "ttyS0"
|
|
|
|
else if pkgs.stdenv.isArm || pkgs.stdenv.isAarch64 then "ttyAMA0"
|
|
|
|
else throw "Unknown QEMU serial device for system '${pkgs.stdenv.system}'";
|
|
|
|
|
2017-12-06 18:26:22 +00:00
|
|
|
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}'");
|
2010-05-27 12:20:37 +00:00
|
|
|
}
|