forked from M-Labs/nix-scripts
windows tests: run qemu with/without isolateNetwork
This commit is contained in:
parent
138f5d3b8f
commit
38589b04c1
@ -49,7 +49,7 @@ let
|
||||
buildPhase = ''
|
||||
# +1 day from last modification of the disk image
|
||||
CLOCK=$(date -Is -d @$(expr $(stat -c %Y ${diskImage}) + 86400))
|
||||
${qemu.runQemu [
|
||||
${qemu.runQemu true [
|
||||
"-boot" "order=c"
|
||||
"-snapshot"
|
||||
"-drive" "file=${diskImage},index=0,media=disk,cache=unsafe"
|
||||
|
@ -52,7 +52,7 @@ stdenv.mkDerivation {
|
||||
|
||||
if [ ! -f c.img ] ; then
|
||||
${qemu.qemu-img} create -f qcow2 c.img ${diskImageSize}
|
||||
${qemu.runQemu [
|
||||
${qemu.runQemu false [
|
||||
"-boot" "order=d"
|
||||
"-drive" "file=c.img,index=0,media=disk,cache=unsafe"
|
||||
"-drive" "file=$out/data/windows.iso,index=1,media=cdrom,cache=unsafe"
|
||||
@ -60,7 +60,7 @@ stdenv.mkDerivation {
|
||||
echo "Please perform a Windows installation."
|
||||
else
|
||||
echo "Please finalize your Windows installation (or delete c.img and restart)"
|
||||
${qemu.runQemu [
|
||||
${qemu.runQemu false [
|
||||
"-boot" "order=c"
|
||||
"-drive" "file=c.img,index=0,media=disk"
|
||||
]} &
|
||||
|
@ -10,13 +10,18 @@ with pkgs;
|
||||
let
|
||||
qemu = qemu_kvm;
|
||||
qemu-img = "${qemu}/bin/qemu-img";
|
||||
runQemu = extraArgs:
|
||||
runQemu = isolateNetwork: extraArgs:
|
||||
let
|
||||
restrict =
|
||||
if isolateNetwork
|
||||
then "on"
|
||||
else "off";
|
||||
args = [
|
||||
"-enable-kvm"
|
||||
"-m" qemuMem
|
||||
"-bios" "${OVMF.fd}/FV/OVMF.fd"
|
||||
"-netdev" "user,id=n1,restrict=on,hostfwd=tcp::2022-:22" "-device" "e1000,netdev=n1"
|
||||
"-netdev" "user,id=n1,restrict=${restrict},hostfwd=tcp::2022-:22"
|
||||
"-device" "e1000,netdev=n1"
|
||||
];
|
||||
argStr = builtins.concatStringsSep " " (args ++ extraArgs);
|
||||
in "qemu-system-x86_64 ${argStr}";
|
||||
|
Loading…
Reference in New Issue
Block a user