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 = ''
|
buildPhase = ''
|
||||||
# +1 day from last modification of the disk image
|
# +1 day from last modification of the disk image
|
||||||
CLOCK=$(date -Is -d @$(expr $(stat -c %Y ${diskImage}) + 86400))
|
CLOCK=$(date -Is -d @$(expr $(stat -c %Y ${diskImage}) + 86400))
|
||||||
${qemu.runQemu [
|
${qemu.runQemu true [
|
||||||
"-boot" "order=c"
|
"-boot" "order=c"
|
||||||
"-snapshot"
|
"-snapshot"
|
||||||
"-drive" "file=${diskImage},index=0,media=disk,cache=unsafe"
|
"-drive" "file=${diskImage},index=0,media=disk,cache=unsafe"
|
||||||
|
|
|
@ -52,7 +52,7 @@ stdenv.mkDerivation {
|
||||||
|
|
||||||
if [ ! -f c.img ] ; then
|
if [ ! -f c.img ] ; then
|
||||||
${qemu.qemu-img} create -f qcow2 c.img ${diskImageSize}
|
${qemu.qemu-img} create -f qcow2 c.img ${diskImageSize}
|
||||||
${qemu.runQemu [
|
${qemu.runQemu false [
|
||||||
"-boot" "order=d"
|
"-boot" "order=d"
|
||||||
"-drive" "file=c.img,index=0,media=disk,cache=unsafe"
|
"-drive" "file=c.img,index=0,media=disk,cache=unsafe"
|
||||||
"-drive" "file=$out/data/windows.iso,index=1,media=cdrom,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."
|
echo "Please perform a Windows installation."
|
||||||
else
|
else
|
||||||
echo "Please finalize your Windows installation (or delete c.img and restart)"
|
echo "Please finalize your Windows installation (or delete c.img and restart)"
|
||||||
${qemu.runQemu [
|
${qemu.runQemu false [
|
||||||
"-boot" "order=c"
|
"-boot" "order=c"
|
||||||
"-drive" "file=c.img,index=0,media=disk"
|
"-drive" "file=c.img,index=0,media=disk"
|
||||||
]} &
|
]} &
|
||||||
|
|
|
@ -10,13 +10,18 @@ with pkgs;
|
||||||
let
|
let
|
||||||
qemu = qemu_kvm;
|
qemu = qemu_kvm;
|
||||||
qemu-img = "${qemu}/bin/qemu-img";
|
qemu-img = "${qemu}/bin/qemu-img";
|
||||||
runQemu = extraArgs:
|
runQemu = isolateNetwork: extraArgs:
|
||||||
let
|
let
|
||||||
|
restrict =
|
||||||
|
if isolateNetwork
|
||||||
|
then "on"
|
||||||
|
else "off";
|
||||||
args = [
|
args = [
|
||||||
"-enable-kvm"
|
"-enable-kvm"
|
||||||
"-m" qemuMem
|
"-m" qemuMem
|
||||||
"-bios" "${OVMF.fd}/FV/OVMF.fd"
|
"-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);
|
argStr = builtins.concatStringsSep " " (args ++ extraArgs);
|
||||||
in "qemu-system-x86_64 ${argStr}";
|
in "qemu-system-x86_64 ${argStr}";
|
||||||
|
|
Loading…
Reference in New Issue