From e7b042bf80e053f2877043bcf6f8723c95d436f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Wed, 24 May 2023 14:39:08 +0100 Subject: [PATCH] almost allow the windows 11 installer to start unattended --- config/services/router.nix | 44 +++++++++++++++++++++++++++++++++++++- config/services/samba.nix | 2 +- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/config/services/router.nix b/config/services/router.nix index 09549d0f..d52569ce 100644 --- a/config/services/router.nix +++ b/config/services/router.nix @@ -18,6 +18,31 @@ outputHashMode = "flat"; outputHashAlgo = "sha256"; }; + installBat = pkgs.writeText "install.bat" '' + wpeinit + ipconfig + net use i: \\192.168.2.1\INSTALL /user:none none + + i: + setup.exe /AddBootMgrLast + ''; + winpeshlIni = pkgs.writeText "winpeshl.ini" '' + [LaunchhApps] + "install.bat" + ''; + win11SetupDir = pkgs.stdenv.mkDerivation { + name = "win11-boot"; + src = pkgs.emptyDirectory; + nativeBuildInputs = [pkgs.p7zip]; + buildPhase = ""; + installPhase = '' + mkdir $out + cd $out + 7z x ${win11Iso} boot efi sources/boot.wim + ln -sv ${installBat} install.bat + ln -sv ${winpeshlIni} winpeshl.ini + ''; + }; win11IsoDir = pkgs.stdenv.mkDerivation { name = "win11"; @@ -27,6 +52,7 @@ installPhase = '' mkdir $out ln -sv ${win11Iso} $out/win11.iso + ln -sv ${win11SetupDir} $out/setup ''; }; bootIpxeX86Script = pkgs.writeTextDir "boot.ipxe" '' @@ -45,7 +71,18 @@ chain http://192.168.2.1/x86_64/netboot.ipxe :windows - sanboot http://192.168.2.1/x86_64/win11.iso + imgfree + kernel http://192.168.2.1/x86_64/share/wimboot/wimboot.x86_64.efi gui + initrd http://192.168.2.1/x86_64/setup/install.bat install.bat + initrd http://192.168.2.1/x86_64/setup/winpeshl.ini winpeshl.ini + initrd http://192.168.2.1/x86_64/setup/efi/microsoft/boot/bcd BCD + initrd http://192.168.2.1/x86_64/setup/boot/fonts/segmono_boot.ttf segmono_boot.ttf + initrd http://192.168.2.1/x86_64/setup/boot/fonts/segoe_slboot.ttf segoe_slboot.ttf + initrd http://192.168.2.1/x86_64/setup/boot/fonts/segoen_slboot.ttf segoen_slboot.ttf + initrd http://192.168.2.1/x86_64/setup/boot/fonts/wgl4_boot.ttf wgl4_boot.ttf + initrd http://192.168.2.1/x86_64/setup/boot/boot.sdi boot.sdi + initrd http://192.168.2.1/x86_64/setup/sources/boot.wim boot.wim + boot :shell chain http://192.168.2.1/x86_64/shell.efi @@ -63,6 +100,7 @@ pkgs.edk2-uefi-shell bootIpxeX86Script win11IsoDir + pkgs.wimboot ]; }; bootIpxeScript = pkgs.writeText "boot.ipxe" '' @@ -130,4 +168,8 @@ in { "net.ipv4.conf.all.forwarding" = true; "net.ipv6.conf.all.forwarding" = true; }; + fileSystems."/mnt/win" = { + device = "${win11Iso}"; + options = ["loop" "ro"]; + }; } diff --git a/config/services/samba.nix b/config/services/samba.nix index f0810208..8e1227be 100644 --- a/config/services/samba.nix +++ b/config/services/samba.nix @@ -23,7 +23,7 @@ _: { map to guest = bad user ''; shares = { - winstall = { + install = { path = "/mnt/win"; browseable = "yes"; "read only" = "yes";