From 4c1b710308970a95709237e6db2b9395313919cf Mon Sep 17 00:00:00 2001 From: Git Sagar Date: Mon, 8 Jun 2026 17:46:52 +0530 Subject: [PATCH] add nicModel option to customizeImage and generalize Allows overriding the QEMU NIC model during builds (e.g. e1000 for images without VirtIO drivers). Enables MAS activation on upstream images that lack VirtIO network drivers. Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/images/windows/helpers/customizeImage.nix | 3 ++- lib/images/windows/templates/generalize.nix | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/images/windows/helpers/customizeImage.nix b/lib/images/windows/helpers/customizeImage.nix index 652b2b4..79dc155 100644 --- a/lib/images/windows/helpers/customizeImage.nix +++ b/lib/images/windows/helpers/customizeImage.nix @@ -24,6 +24,7 @@ vncDisplay ? null, smp ? 4, memSize ? 4096, + nicModel ? null, }: let originalImageName = lib.strings.removeSuffix "-vmix" (lib.strings.removeSuffix ".qcow2" originalImage.name); @@ -104,7 +105,7 @@ then "-drive file=${resultImg},format=qcow2,if=none,id=disk0 -device ide-hd,drive=disk0" else "-drive file=${resultImg},format=qcow2,if=virtio"} \ ${cdromArgs} \ - -nic user,model=${if isAHCI then "e1000" else "virtio-net-pci"}" + -nic user,model=${if nicModel != null then nicModel else if isAHCI then "e1000" else "virtio-net-pci"}" timeout 1800 qemu-system-x86_64 $VMIX_DISPLAY $QEMU_ARGS || \ if [[ "$VMIX_DISPLAY" == "-display sdl" ]]; then diff --git a/lib/images/windows/templates/generalize.nix b/lib/images/windows/templates/generalize.nix index 76904f8..0caa5b9 100644 --- a/lib/images/windows/templates/generalize.nix +++ b/lib/images/windows/templates/generalize.nix @@ -21,6 +21,8 @@ in bgColor ? null, # Enable Remote Desktop for the created user (re-applied after sysprep) enableRDP ? false, + # NIC model for the build VM (e.g. "e1000" for images without VirtIO drivers) + nicModel ? null, # delayOobeRun = true: sysprep only, OOBE + activation on real hardware # delayOobeRun = false: sysprep + OOBE + activation in build VM delayOobeRun ? false, @@ -185,6 +187,7 @@ in ''; in { name = if delayOobeRun then "generalize-delay-oobe" else "generalize"; + inherit nicModel; uploads = [ { source = oobeXml; dest = "/oobe-unattend.xml"; } { source = postOobeScript; dest = "/post-oobe.cmd"; }