From 7c59f3e2c67b6c3f541337824df46cd259d9dae3 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Wed, 28 Oct 2026 19:33:26 -0700 Subject: [PATCH] feat(nix): run the Windows e2e scenarios with nix run .#e2e-windows E2E_GOLDEN names the golden image built by build-golden.sh; the komorebi, komorebic and test window binaries, QEMU, swtpm and an OVMF with TPM support come from the flake. Also exposes the guest agent and the test window as packages. --- flake.nix | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/flake.nix b/flake.nix index 3cd1a9d7..980df7b5 100644 --- a/flake.nix +++ b/flake.nix @@ -260,6 +260,8 @@ komorebi-bar = extractBinary "komorebi-bar"; komorebi-gui = extractBinary "komorebi-gui"; komorebi-shortcuts = extractBinary "komorebi-shortcuts"; + komorebi-testwin = extractBinary "komorebi-testwin"; + komorebi-e2e-agent = extractBinary "komorebi-e2e-agent"; }; mkPkgs = @@ -288,6 +290,32 @@ windowsSdk = mkWindowsSdk pkgs; build = mkKomorebiPackages { inherit pkgs windowsSdk; }; + # OVMF without SMM and with the TPM support Windows 11 Setup asks for + ovmfWithTpm = (pkgs.OVMF.override { tpmSupport = true; }).fd; + e2eWindows = pkgs.writeShellApplication { + name = "e2e-windows"; + runtimeInputs = [ + pkgs.qemu + pkgs.swtpm + (pkgs.python3.withPackages (p: [ p.pillow ])) + ]; + text = '' + : "''${E2E_GOLDEN:?set E2E_GOLDEN to the golden image directory}" + out=''${1:?usage: e2e-windows OUT SCENARIO...} + shift + bins=$(mktemp -d) + trap 'rm -rf "$bins"' EXIT + cp ${build.komorebi}/bin/komorebi.exe "$bins" + cp ${build.komorebic}/bin/komorebic.exe "$bins" + cp ${build.komorebi-testwin}/bin/komorebi-testwin.exe "$bins" + export OVMF_FD=${ovmfWithTpm} + export KOMOREBI_E2E_COMMIT=${self.rev or "dirty"} + export PYTHONPATH=${./e2e/lib}:${./e2e} + exec python -m platforms.qemu_windows.run \ + "$E2E_GOLDEN" "$bins" "$out" "$@" + ''; + }; + # toolchain with windows target and nightly rustfmt rustToolchain = (pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml).override { targets = [ "x86_64-pc-windows-msvc" ]; @@ -354,6 +382,8 @@ komorebi-bar komorebi-gui komorebi-shortcuts + komorebi-testwin + komorebi-e2e-agent ; inherit windowsSdk; komorebi-full = build.fullBuild; @@ -389,6 +419,17 @@ type = "app"; program = "${build.fullBuild}/bin/komorebi.exe"; }; + } + // pkgs.lib.optionalAttrs (system == "x86_64-linux") { + # the neutral scenarios against a throwaway Windows guest: + # E2E_GOLDEN= nix run .#e2e-windows -- \ + # OUT SCENARIO... + # the golden image is built once with + # e2e/platforms/qemu_windows/build-golden.sh + e2e-windows = { + type = "app"; + program = pkgs.lib.getExe e2eWindows; + }; }; devShells.default = pkgs.mkShell {