forked from M-Labs/wfvm
remove configurable efi flag
Win11 is EFI-only
This commit is contained in:
parent
fe347240f5
commit
af9218e652
@ -14,7 +14,6 @@
|
|||||||
, services ? {}
|
, services ? {}
|
||||||
, impureShellCommands ? []
|
, impureShellCommands ? []
|
||||||
, driveLetter ? "D:"
|
, driveLetter ? "D:"
|
||||||
, efi ? true
|
|
||||||
, imageSelection ? "Windows 11 Pro N"
|
, imageSelection ? "Windows 11 Pro N"
|
||||||
, ...
|
, ...
|
||||||
}:
|
}:
|
||||||
@ -121,8 +120,7 @@ let
|
|||||||
# Windows expects a flat list of users while we want to manage them as a set
|
# Windows expects a flat list of users while we want to manage them as a set
|
||||||
flatUsers = builtins.attrValues (builtins.mapAttrs (name: s: s // { inherit name; }) users);
|
flatUsers = builtins.attrValues (builtins.mapAttrs (name: s: s // { inherit name; }) users);
|
||||||
|
|
||||||
diskId =
|
diskId = 2;
|
||||||
if efi then 2 else 1;
|
|
||||||
|
|
||||||
autounattendXML = pkgs.writeText "autounattend.xml" ''
|
autounattendXML = pkgs.writeText "autounattend.xml" ''
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
@ -172,12 +170,12 @@ let
|
|||||||
<CreatePartitions>
|
<CreatePartitions>
|
||||||
<CreatePartition wcm:action="add">
|
<CreatePartition wcm:action="add">
|
||||||
<Order>1</Order>
|
<Order>1</Order>
|
||||||
<Type>${if efi then "EFI" else "Primary"}</Type>
|
<Type>EFI</Type>
|
||||||
<Size>300</Size>
|
<Size>300</Size>
|
||||||
</CreatePartition>
|
</CreatePartition>
|
||||||
<CreatePartition wcm:action="add">
|
<CreatePartition wcm:action="add">
|
||||||
<Order>2</Order>
|
<Order>2</Order>
|
||||||
<Type>${if efi then "MSR" else "Primary"}</Type>
|
<Type>MSR</Type>
|
||||||
<Size>16</Size>
|
<Size>16</Size>
|
||||||
</CreatePartition>
|
</CreatePartition>
|
||||||
<CreatePartition wcm:action="add">
|
<CreatePartition wcm:action="add">
|
||||||
@ -189,7 +187,7 @@ let
|
|||||||
<ModifyPartitions>
|
<ModifyPartitions>
|
||||||
<ModifyPartition wcm:action="add">
|
<ModifyPartition wcm:action="add">
|
||||||
<Order>1</Order>
|
<Order>1</Order>
|
||||||
<Format>${if efi then "FAT32" else "NTFS"}</Format>
|
<Format>FAT32</Format>
|
||||||
<Label>System</Label>
|
<Label>System</Label>
|
||||||
<PartitionID>1</PartitionID>
|
<PartitionID>1</PartitionID>
|
||||||
</ModifyPartition>
|
</ModifyPartition>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ pkgs, baseRtc ? "2022-10-10T10:10:10", cores ? "4", qemuMem ? "4G", efi ? true }:
|
{ pkgs, baseRtc ? "2022-10-10T10:10:10", cores ? "4", qemuMem ? "4G" }:
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
# qemu_test is a smaller closure only building for a single system arch
|
# qemu_test is a smaller closure only building for a single system arch
|
||||||
@ -18,7 +18,6 @@ rec {
|
|||||||
"-rtc base=${baseRtc}"
|
"-rtc base=${baseRtc}"
|
||||||
"-device qemu-xhci"
|
"-device qemu-xhci"
|
||||||
"-device virtio-net-pci,netdev=n1"
|
"-device virtio-net-pci,netdev=n1"
|
||||||
] ++ pkgs.lib.optionals efi [
|
|
||||||
"-bios ${OVMF.fd}/FV/OVMF.fd"
|
"-bios ${OVMF.fd}/FV/OVMF.fd"
|
||||||
] ++ extraFlags;
|
] ++ extraFlags;
|
||||||
|
|
||||||
|
@ -7,13 +7,12 @@
|
|||||||
, users ? {}
|
, users ? {}
|
||||||
# autounattend always installs index 1, so this default is backward-compatible
|
# autounattend always installs index 1, so this default is backward-compatible
|
||||||
, imageSelection ? "Windows 11 Pro N"
|
, imageSelection ? "Windows 11 Pro N"
|
||||||
, efi ? true
|
|
||||||
, ...
|
, ...
|
||||||
}@attrs:
|
}@attrs:
|
||||||
|
|
||||||
let
|
let
|
||||||
lib = pkgs.lib;
|
lib = pkgs.lib;
|
||||||
utils = import ./utils.nix { inherit pkgs efi; };
|
utils = import ./utils.nix { inherit pkgs; };
|
||||||
inherit (pkgs) guestfs-tools;
|
inherit (pkgs) guestfs-tools;
|
||||||
|
|
||||||
# p7zip on >20.03 has known vulns but we have no better option
|
# p7zip on >20.03 has known vulns but we have no better option
|
||||||
@ -95,7 +94,7 @@ let
|
|||||||
"usb-storage,drive=virtio-win"
|
"usb-storage,drive=virtio-win"
|
||||||
# USB boot
|
# USB boot
|
||||||
"-drive"
|
"-drive"
|
||||||
"id=win-install,file=${if efi then "usb" else "cd"}image.img,if=none,format=raw,readonly=on,media=${if efi then "disk" else "cdrom"}"
|
"id=win-install,file=usbimage.img,if=none,format=raw,readonly=on,media=disk"
|
||||||
"-device"
|
"-device"
|
||||||
"usb-storage,drive=win-install"
|
"usb-storage,drive=win-install"
|
||||||
# Output image
|
# Output image
|
||||||
@ -124,11 +123,7 @@ let
|
|||||||
|
|
||||||
cp ${autounattend.autounattendXML} win/autounattend.xml
|
cp ${autounattend.autounattendXML} win/autounattend.xml
|
||||||
|
|
||||||
${if efi then ''
|
|
||||||
virt-make-fs --partition --type=fat win/ usbimage.img
|
virt-make-fs --partition --type=fat win/ usbimage.img
|
||||||
'' else ''
|
|
||||||
${pkgs.cdrkit}/bin/mkisofs -iso-level 4 -l -R -udf -D -b boot/etfsboot.com -no-emul-boot -boot-load-size 8 -hide boot.catalog -eltorito-alt-boot -o cdimage.img win/
|
|
||||||
''}
|
|
||||||
rm -rf win
|
rm -rf win
|
||||||
|
|
||||||
# Qemu requires files to be rw
|
# Qemu requires files to be rw
|
||||||
|
Loading…
Reference in New Issue
Block a user