diff --git a/lib/images/windows/templates/generalize.nix b/lib/images/windows/templates/generalize.nix index 5db8285..52109d6 100644 --- a/lib/images/windows/templates/generalize.nix +++ b/lib/images/windows/templates/generalize.nix @@ -238,8 +238,13 @@ in ${lib.optionalString (staticIP != null) '' :: This VM's only NIC sits on a macvtap bridged to the host's LAN, so its :: address is a LAN address that nothing hands out -- the guest asserts it. - :: Clearing first makes the command idempotent across re-runs. - call C:\vmix-static-ip.cmd + :: Registered to run at every boot rather than applied here. OOBE runs in + :: the build VM, whose NIC is qemu user networking on another subnet with + :: another MAC -- so an address set now lands on an adapter that does not + :: exist on the real host. Windows sees the target's NIC as new hardware + :: and falls back to DHCP, which is exactly what happened. Per-boot also + :: survives the adapter being replaced again later. + schtasks /create /tn "vmix-static-ip" /tr "C:\vmix-static-ip.cmd" /sc onstart /ru SYSTEM /rl HIGHEST /f > nul 2>&1 ''} ${lib.optionalString (writeFilter != null) ''