install and use virtio drivers #8
|
@ -124,6 +124,9 @@ 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 =
|
||||||
|
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"?>
|
||||||
<unattend xmlns="urn:schemas-microsoft-com:unattend">
|
<unattend xmlns="urn:schemas-microsoft-com:unattend">
|
||||||
|
@ -136,6 +139,15 @@ let
|
||||||
<PathAndCredentials wcm:action="add" wcm:keyValue="2">
|
<PathAndCredentials wcm:action="add" wcm:keyValue="2">
|
||||||
<Path>E:\</Path>
|
<Path>E:\</Path>
|
||||||
</PathAndCredentials>
|
</PathAndCredentials>
|
||||||
|
<PathAndCredentials wcm:action="add" wcm:keyValue="3">
|
||||||
|
<Path>C:\virtio\amd64\w10</Path>
|
||||||
|
</PathAndCredentials>
|
||||||
|
<PathAndCredentials wcm:action="add" wcm:keyValue="4">
|
||||||
|
<Path>C:\virtio\NetKVM\w10\amd64</Path>
|
||||||
|
</PathAndCredentials>
|
||||||
|
<PathAndCredentials wcm:action="add" wcm:keyValue="5">
|
||||||
|
<Path>C:\virtio\qxldod\w10\amd64</Path>
|
||||||
|
</PathAndCredentials>
|
||||||
</DriverPaths>
|
</DriverPaths>
|
||||||
</component>
|
</component>
|
||||||
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
@ -178,7 +190,7 @@ let
|
||||||
<PartitionID>3</PartitionID>
|
<PartitionID>3</PartitionID>
|
||||||
</ModifyPartition>
|
</ModifyPartition>
|
||||||
</ModifyPartitions>
|
</ModifyPartitions>
|
||||||
<DiskID>0</DiskID>
|
<DiskID>${toString diskId}</DiskID>
|
||||||
<WillWipeDisk>true</WillWipeDisk>
|
<WillWipeDisk>true</WillWipeDisk>
|
||||||
</Disk>
|
</Disk>
|
||||||
</DiskConfiguration>
|
</DiskConfiguration>
|
||||||
|
@ -186,7 +198,7 @@ let
|
||||||
<ImageInstall>
|
<ImageInstall>
|
||||||
<OSImage>
|
<OSImage>
|
||||||
<InstallTo>
|
<InstallTo>
|
||||||
<DiskID>0</DiskID>
|
<DiskID>${toString diskId}</DiskID>
|
||||||
<PartitionID>3</PartitionID>
|
<PartitionID>3</PartitionID>
|
||||||
</InstallTo>
|
</InstallTo>
|
||||||
<InstallFrom>
|
<InstallFrom>
|
||||||
|
|
|
@ -10,9 +10,10 @@ rec {
|
||||||
"-smp ${cores}"
|
"-smp ${cores}"
|
||||||
"-m ${qemuMem}"
|
"-m ${qemuMem}"
|
||||||
"-M q35"
|
"-M q35"
|
||||||
|
"-vga qxl"
|
||||||
"-rtc base=${baseRtc}"
|
"-rtc base=${baseRtc}"
|
||||||
"-device qemu-xhci"
|
"-device qemu-xhci"
|
||||||
"-device e1000,netdev=n1"
|
"-device virtio-net-pci,netdev=n1"
|
||||||
] ++ pkgs.lib.optionals efi [
|
] ++ pkgs.lib.optionals efi [
|
||||||
"-bios ${pkgs.OVMF.fd}/FV/OVMF.fd"
|
"-bios ${pkgs.OVMF.fd}/FV/OVMF.fd"
|
||||||
] ++ extraFlags;
|
] ++ extraFlags;
|
||||||
|
|
12
wfvm/win.nix
12
wfvm/win.nix
|
@ -41,6 +41,12 @@ let
|
||||||
sha256 = "668fe1af70c2f7416328aee3a0bb066b12dc6bbd2576f40f812b95741e18bc3a";
|
sha256 = "668fe1af70c2f7416328aee3a0bb066b12dc6bbd2576f40f812b95741e18bc3a";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# stable as of 2021-04-08
|
||||||
|
virtioWinIso = pkgs.fetchurl {
|
||||||
|
url = "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.185-2/virtio-win-0.1.185.iso";
|
||||||
|
sha256 = "11n3kjyawiwacmi3jmfmn311g9xvfn6m0ccdwnjxw1brzb4kqaxg";
|
||||||
|
};
|
||||||
|
|
||||||
openSshServerPackage = ./openssh/server-package.cab;
|
openSshServerPackage = ./openssh/server-package.cab;
|
||||||
|
|
||||||
autounattend = import ./autounattend.nix (
|
autounattend = import ./autounattend.nix (
|
||||||
|
@ -65,6 +71,8 @@ let
|
||||||
runQemuCommand "bootstrap-win-pkgs.img" ''
|
runQemuCommand "bootstrap-win-pkgs.img" ''
|
||||||
mkdir -p pkgs/fod
|
mkdir -p pkgs/fod
|
||||||
|
|
||||||
|
7z x -y ${virtioWinIso} -opkgs/virtio
|
||||||
|
|
||||||
cp ${bundleInstaller} pkgs/"$(stripHash "${bundleInstaller}")"
|
cp ${bundleInstaller} pkgs/"$(stripHash "${bundleInstaller}")"
|
||||||
|
|
||||||
# Install optional windows features
|
# Install optional windows features
|
||||||
|
@ -91,7 +99,7 @@ let
|
||||||
"usb-storage,drive=win-install"
|
"usb-storage,drive=win-install"
|
||||||
# Output image
|
# Output image
|
||||||
"-drive"
|
"-drive"
|
||||||
"file=c.img,index=0,media=disk,cache=unsafe"
|
"file=c.img,index=0,media=disk,if=virtio,cache=unsafe"
|
||||||
# Network
|
# Network
|
||||||
"-netdev user,id=n1,net=192.168.1.0/24,restrict=on"
|
"-netdev user,id=n1,net=192.168.1.0/24,restrict=on"
|
||||||
]);
|
]);
|
||||||
|
@ -152,7 +160,7 @@ let
|
||||||
qemuParams = utils.mkQemuFlags (lib.optional (!impureMode) "-display none" ++ [
|
qemuParams = utils.mkQemuFlags (lib.optional (!impureMode) "-display none" ++ [
|
||||||
# Output image
|
# Output image
|
||||||
"-drive"
|
"-drive"
|
||||||
"file=c.img,index=0,media=disk,cache=unsafe"
|
"file=c.img,index=0,media=disk,if=virtio,cache=unsafe"
|
||||||
# Network - enable SSH forwarding
|
# Network - enable SSH forwarding
|
||||||
"-netdev user,id=n1,net=192.168.1.0/24,restrict=on,hostfwd=tcp::2022-:22"
|
"-netdev user,id=n1,net=192.168.1.0/24,restrict=on,hostfwd=tcp::2022-:22"
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in New Issue