Skip to content

Commit e2ca9cb

Browse files
authored
fix(test-guest): pin HVF runtime dependencies (#2924)
Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent 4558839 commit e2ca9cb

4 files changed

Lines changed: 41 additions & 5 deletions

File tree

flake.lock

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
inputs = {
1515
flake-utils.url = "github:numtide/flake-utils";
1616
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
17+
# Keep the QEMU and OVMF runtime used by Apple Silicon test guests on a
18+
# known-good release. Development shells and cross toolchains use nixpkgs.
19+
nixpkgs-test-guest.url = "github:NixOS/nixpkgs/0954f7ee2f6bb3dc7d4e3d0d8bcb8fd4bde4cfc5";
1720
rust-overlay = {
1821
url = "github:oxalica/rust-overlay";
1922
inputs.nixpkgs.follows = "nixpkgs";
@@ -29,6 +32,7 @@
2932
{
3033
flake-utils,
3134
nixpkgs,
35+
nixpkgs-test-guest,
3236
treefmt-nix,
3337
rust-overlay,
3438
...
@@ -40,6 +44,7 @@
4044
inherit system;
4145
overlays = [ (import rust-overlay) ];
4246
};
47+
testGuestPkgs = import nixpkgs-test-guest { inherit system; };
4348
commonDevShellPackages = with pkgs; [
4449
# Assemble Debian artifacts on macOS and Linux.
4550
dpkg
@@ -56,7 +61,11 @@
5661
rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
5762
z3-static = pkgs.callPackage ./nix/pkgs/z3-static.nix { };
5863
aws-lc-static = pkgs.callPackage ./nix/pkgs/aws-lc-static.nix { };
59-
testGuest = import ./nix/test-guest { inherit pkgs; };
64+
testGuest = import ./nix/test-guest {
65+
inherit pkgs;
66+
qemuPkgs = testGuestPkgs;
67+
firmwarePkgs = testGuestPkgs;
68+
};
6069
in
6170
{
6271
apps.test-guest = testGuest.app;

nix/test-guest/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ This prototype uses Nix, QEMU, and Ansible to boot and configure disposable Linu
1616

1717
The first run downloads the selected cloud image and VM runtime. Nix reuses those immutable inputs on later runs, while each guest starts from a fresh writable overlay.
1818

19+
On Apple Silicon, test guests deliberately take QEMU 11.0.2 and its matching OVMF
20+
firmware from a separately pinned Nixpkgs revision. All other guest-runtime tools,
21+
development dependencies, and cross-toolchain dependencies continue to use the main
22+
current Nixpkgs input. This avoids a QEMU 11.1 HVF guest boot regression. Update
23+
this pair only after validating an ARM64 Ubuntu guest boot with HVF.
24+
1925
## Directory structure
2026

2127
```text

nix/test-guest/default.nix

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33

44
# PROTOTYPE: Composable distro VMs for installing and exercising artifacts.
55

6-
{ pkgs }:
6+
{
7+
pkgs,
8+
qemuPkgs ? pkgs,
9+
firmwarePkgs ? pkgs,
10+
}:
711

812
let
913
isAarch64 = pkgs.stdenv.hostPlatform.isAarch64;
1014
isDarwin = pkgs.stdenv.hostPlatform.isDarwin;
1115
architecture = if isAarch64 then "aarch64" else "x86_64";
12-
qemu = pkgs.qemu.override { hostCpuOnly = true; };
16+
qemu = qemuPkgs.qemu.override { hostCpuOnly = true; };
1317
qemuBinary =
1418
if isAarch64 then "${qemu}/bin/qemu-system-aarch64" else "${qemu}/bin/qemu-system-x86_64";
1519

@@ -75,8 +79,8 @@ let
7579
export OPENSHELL_TEST_GUEST_RUNNER=${./run.sh}
7680
export TEST_GUEST_BASH=${pkgs.bash}/bin/bash
7781
export TEST_GUEST_QEMU=${qemuBinary}
78-
export TEST_GUEST_FIRMWARE_CODE=${pkgs.OVMF.firmware}
79-
export TEST_GUEST_FIRMWARE_VARS=${pkgs.OVMF.variables}
82+
export TEST_GUEST_FIRMWARE_CODE=${firmwarePkgs.OVMF.firmware}
83+
export TEST_GUEST_FIRMWARE_VARS=${firmwarePkgs.OVMF.variables}
8084
export TEST_GUEST_MACHINE=${if isAarch64 then "virt" else "q35"}
8185
export TEST_GUEST_ACCELERATOR=${if isDarwin then "hvf" else "kvm"}
8286
export TEST_GUEST_ARCHITECTURE=${architecture}

0 commit comments

Comments
 (0)