From ebbcf84c4b694b80d6114d05bb93d37e76dddfe7 Mon Sep 17 00:00:00 2001 From: mwojcik Date: Mon, 14 Mar 2022 15:22:59 +0800 Subject: [PATCH] * install first image instead by name * update vs_community sha256 * move bundle from flake to win --- flake.nix | 18 +++++------------- wfvm/autounattend.nix | 4 ++-- wfvm/layers/default.nix | 2 +- wfvm/win.nix | 14 ++++++++++++-- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/flake.nix b/flake.nix index 4b833e3..c52e4c1 100644 --- a/flake.nix +++ b/flake.nix @@ -10,18 +10,10 @@ # layers layers = (import wfvm/layers { inherit pkgs; }); # end of layers - # bundle - bundleInstaller = pkgs.runCommandNoCC "win-bundle-installer.exe" {} '' - mkdir bundle - cd bundle - cp ${wfvm/bundle/go.mod} go.mod - cp ${wfvm/bundle/main.go} main.go - env HOME=$(mktemp -d) GOOS=windows GOARCH=amd64 ${pkgs.go}/bin/go build - mv bundle.exe $out - ''; + # makeWindowsImage - makeWindowsImage = attrs: import wfvm/win.nix ({ inherit pkgs bundleInstaller; } // attrs ); + makeWindowsImage = attrs: import wfvm/win.nix ({ inherit pkgs; } // attrs ); build-demo-image = { impureMode ? false }: makeWindowsImage { # Build install script & skip building iso @@ -59,7 +51,7 @@ # administratorPassword = "12345"; # Imperative installation commands, to be installed incrementally - installCommands = pkgs.lib.optional (!impureMode) (with layers; [ + installCommands = if impureMode then [] else (with layers; [ (collapseLayers [ disable-autosleep disable-autolock @@ -78,7 +70,7 @@ # License key (required) # productKey = throw "Search the f* web" - imageSelection = "Windows 10 Pro"; + # imageSelection = "1"; # Locales # uiLanguage = "en-US"; @@ -115,7 +107,7 @@ packages.x86_64-linux = { demo-image = build-demo-image {}; - demo-image-impure = makeWindowsImage { impureMode = true; }; + demo-image-impure = build-demo-image { impureMode = true; }; make-msys-packages = utils.wfvm-run { name = "get-msys-packages"; diff --git a/wfvm/autounattend.nix b/wfvm/autounattend.nix index 99b0429..abd1c16 100644 --- a/wfvm/autounattend.nix +++ b/wfvm/autounattend.nix @@ -15,7 +15,7 @@ , impureShellCommands ? [] , driveLetter ? "D:" , efi ? true -, imageSelection ? "Windows 10 Pro" +, imageSelection ? "1" , ... }: @@ -200,7 +200,7 @@ let - /IMAGE/NAME + /IMAGE/INDEX ${imageSelection} diff --git a/wfvm/layers/default.nix b/wfvm/layers/default.nix index a9068a6..d1d6f0a 100644 --- a/wfvm/layers/default.nix +++ b/wfvm/layers/default.nix @@ -72,7 +72,7 @@ in bootstrapper = pkgs.fetchurl { name = "RESTRICTDIST-vs_Community.exe"; url = "https://aka.ms/vs/16/release/vs_community.exe"; - sha256 = "0b3csxz0qsafnvc0d74ywfpralwz8chv4zf9k07akpm8lp8ycgq0"; + sha256 = "sha256-bxi8LsvNxSZshkTbhK/FEmMx84NKYB7TUNOm9sAKXS8="; }; # This touchy-feely "community" piece of trash seems deliberately crafted to break Wine, so we use the VM to run it. download-vs = wfvm.utils.wfvm-run { diff --git a/wfvm/win.nix b/wfvm/win.nix index c85f07b..cd265f4 100644 --- a/wfvm/win.nix +++ b/wfvm/win.nix @@ -24,6 +24,16 @@ let }; }); + # bundle + bundleInstaller = pkgs.runCommandNoCC "win-bundle-installer.exe" {} '' + mkdir bundle + cd bundle + cp ${bundle/go.mod} go.mod + cp ${bundle/main.go} main.go + env HOME=$(mktemp -d) GOOS=windows GOARCH=amd64 ${pkgs.go}/bin/go build + mv bundle.exe $out + ''; + runQemuCommand = name: command: ( pkgs.runCommandNoCC name { buildInputs = [ p7zip utils.qemu libguestfs ]; } ( @@ -37,8 +47,8 @@ let ); windowsIso = if windowsImage != null then windowsImage else pkgs.requireFile rec { - name = "Win10_21H2_English_x64.iso"; - sha256 = "0kr3m0bjy086whcbssagsshdxj6lffcz7wmvbh50zhrkxgq3hrbz"; + name = "xks67i4frg8k7rmlv5298aac0s4n5nih-RESTRICTDIST-release_svc_refresh_CLIENT_LTSC_EVAL_x64FRE_en-us.iso"; + sha256 = "0fmw30g7959bh47z8xi5pmmxq4kb0sxs1qxf51il3xy2f2py33v6"; message = "Get ${name} from https://www.microsoft.com/en-us/software-download/windows10ISO"; };