Compare commits

...

12 Commits

Author SHA1 Message Date
d8e9f9878b wfvm/utils: update baseRtc 2022-10-12 21:29:11 +02:00
5ba57fb502 wfvm/win: pass format of backing image to qemu-img
required since qemu 6.1.0
2022-10-12 21:05:39 +02:00
dfdcf0f19a flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/c5924154f000e6306030300592f4282949b2db6c' (2022-10-08)
  → 'github:nixos/nixpkgs/285e77efe87df64105ec14b204de6636fb0a7a27' (2022-10-11)
2022-10-12 19:05:56 +02:00
9845a99863 flake.nix: switch input back to nixos-unstable now that fix PRs have landed 2022-10-12 19:04:51 +02:00
4f7aef8788 wfvm/win: replace libguestfs with guestfs-tools
tools like virt-make-fs have been split off into a separate package.
2022-10-11 00:10:58 +02:00
c124cfc5dc flakify 2022-10-11 00:10:32 +02:00
3b87f787a8 s/runCommandNoCC/runCommand/ 2022-10-05 16:46:27 +02:00
b33b71eec7 wfvm/win: lower wimsplit size to 4070 MB for more headroom 2022-10-05 16:07:06 +02:00
c732c671d9 wfvm/layers: update vs_Community.exe sha256 2022-10-05 16:06:43 +02:00
9d07da799c Merge remote-tracking branch 'origin/master' 2021-12-17 20:33:52 +01:00
a4fe5f0475 update visual studio garbage 2021-11-14 20:15:26 +08:00
c7d9060eee vs: update 2021-09-09 20:48:48 +08:00
7 changed files with 62 additions and 14 deletions

27
flake.lock generated Normal file
View File

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1665449268,
"narHash": "sha256-cw4xrQIAZUyJGj58Dp5VLICI0rscd+uap83afiFzlcA=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "285e77efe87df64105ec14b204de6636fb0a7a27",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

20
flake.nix Normal file
View File

@ -0,0 +1,20 @@
{
description = "WFVM: Windows Functional Virtual Machine";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs }:
let
# only x64 is supported
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in {
lib = import ./wfvm {
inherit pkgs;
};
};
}

View File

@ -305,7 +305,7 @@ let
in {
# Lint and format as a sanity check
autounattendXML = pkgs.runCommandNoCC "autounattend.xml" {} ''
autounattendXML = pkgs.runCommand "autounattend.xml" {} ''
${pkgs.libxml2}/bin/xmllint --format ${autounattendXML} > $out
'';

View File

@ -1,6 +1,6 @@
{ pkgs }:
pkgs.runCommandNoCC "win-bundle-installer.exe" {} ''
pkgs.runCommand "win-bundle-installer.exe" {} ''
mkdir bundle
cd bundle
cp ${./go.mod} go.mod

View File

@ -71,8 +71,8 @@ in
script = let
bootstrapper = pkgs.fetchurl {
name = "RESTRICTDIST-vs_Community.exe";
url = "https://download.visualstudio.microsoft.com/download/pr/ac05c4f5-0da1-429f-8701-ce509ac69926/cc9556137c66a373670376d6db2fc5c5c937b2b0bf7b3d3cac11c69e33615511/vs_Community.exe";
sha256 = "04amc4rrxihimhy3syxzn2r3gjf5qlpxpmkn0dkp78v6gh9md5fc";
url = "https://aka.ms/vs/16/release/vs_community.exe";
sha256 = "0vj6s82b1c0n6cjysx1lba7xmgmy7pmmk3apq1i4xsqwcjv80xwv";
};
# 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 {
@ -93,7 +93,7 @@ in
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = "0axaym774p2w49pja1vqlx3x6fdylfjkpiybrqkyfc605r07xqyk";
outputHash = "0ic3jvslp2y9v8yv9mfr2mafkvj2q5frmcyhmlbxj71si1x3kpag";
phases = [ "buildPhase" ];
buildInputs = [ download-vs ];
@ -118,7 +118,7 @@ in
name = "MSVC-ide-unbreak";
script =
''
win-exec 'cd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE" && devenv /ResetSettings'
win-exec 'cd "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE" && devenv /ResetSettings'
sleep 40
'';
};

View File

@ -1,4 +1,4 @@
{ pkgs, baseRtc ? "2020-04-20T14:21:42", cores ? "4", qemuMem ? "4G", efi ? true }:
{ pkgs, baseRtc ? "2022-10-10T10:10:10", cores ? "4", qemuMem ? "4G", efi ? true }:
rec {
# qemu_test is a smaller closure only building for a single system arch

View File

@ -14,7 +14,7 @@
let
lib = pkgs.lib;
utils = import ./utils.nix { inherit pkgs efi; };
libguestfs = pkgs.libguestfs-with-appliance;
inherit (pkgs) guestfs-tools;
# p7zip on >20.03 has known vulns but we have no better option
p7zip = pkgs.p7zip.overrideAttrs(old: {
@ -24,7 +24,7 @@ let
});
runQemuCommand = name: command: (
pkgs.runCommandNoCC name { buildInputs = [ p7zip utils.qemu libguestfs ]; }
pkgs.runCommand name { buildInputs = [ p7zip utils.qemu guestfs-tools ]; }
(
''
if ! test -f; then
@ -109,7 +109,7 @@ let
''
#!${pkgs.runtimeShell}
set -euxo pipefail
export PATH=${lib.makeBinPath [ p7zip utils.qemu libguestfs pkgs.wimlib ]}:$PATH
export PATH=${lib.makeBinPath [ p7zip utils.qemu guestfs-tools pkgs.wimlib ]}:$PATH
# Create a bootable "USB" image
# Booting in USB mode circumvents the "press any key to boot from cdrom" prompt
@ -120,7 +120,7 @@ let
7z x -y ${windowsIso} -owin
# Split image so it fits in FAT32 partition
wimsplit win/sources/install.wim win/sources/install.swm 4090
wimsplit win/sources/install.wim win/sources/install.swm 4070
rm win/sources/install.wim
cp ${autounattend.autounattendXML} win/autounattend.xml
@ -138,12 +138,12 @@ let
''
);
baseImage = pkgs.runCommandNoCC "RESTRICTDIST-windows.img" {} ''
baseImage = pkgs.runCommand "RESTRICTDIST-windows.img" {} ''
${installScript}
mv c.img $out
'';
finalImage = builtins.foldl' (acc: v: pkgs.runCommandNoCC "RESTRICTDIST-${v.name}.img" {
finalImage = builtins.foldl' (acc: v: pkgs.runCommand "RESTRICTDIST-${v.name}.img" {
buildInputs = with utils; [
qemu win-wait win-exec win-put
] ++ (v.buildInputs or []);
@ -158,8 +158,9 @@ let
]);
in ''
set -x
# Create an image referencing the previous image in the chain
qemu-img create -f qcow2 -b ${acc} c.img
qemu-img create -F qcow2 -f qcow2 -b ${acc} c.img
set -m
qemu-system-x86_64 ${lib.concatStringsSep " " qemuParams} &