2010-05-27 14:20:37 +02:00
|
|
|
# QEMU flags shared between various Nix expressions.
|
2018-01-30 10:22:41 +01:00
|
|
|
{ pkgs }:
|
2010-05-27 14:20:37 +02:00
|
|
|
|
|
|
|
{
|
|
|
|
|
2010-12-07 01:44:29 +01:00
|
|
|
qemuNICFlags = nic: net: machine:
|
2011-08-02 08:52:10 +02: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 19:47:23 +01:00
|
|
|
|
2018-01-30 10:28:26 +01: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 19:26:22 +01: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 14:20:37 +02:00
|
|
|
}
|