Skip to content

Commit 60eff47

Browse files
committed
fix(nix): pin tmachine runtime on macOS
Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent dca882b commit 60eff47

4 files changed

Lines changed: 30 additions & 9 deletions

File tree

‎architecture/build.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ The Nix test guest harness under `nix/test-guest` boots native-architecture clou
278278
through QEMU for package, release, and E2E validation. A prepared cache entry is
279279
captured after the exact ordered Ansible configuration list and before
280280
test-specific packages, copied binaries, forwarded ports, or commands.
281+
On macOS, the test guest and tmachine paths use the same pinned QEMU and OVMF
282+
package set so the hypervisor and firmware remain compatible.
281283

282284
Prepared disks are flattened, sanitized QCOW2 images. The local cache keeps them
283285
read-only and each test receives a fresh writable overlay and cloud-init

‎flake.nix‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
overlays = [ (import rust-overlay) ];
4646
};
4747
testGuestPkgs = import nixpkgs-test-guest { inherit system; };
48+
tmachineRuntimePkgs = if pkgs.stdenv.hostPlatform.isDarwin then testGuestPkgs else pkgs;
4849
commonDevShellPackages =
4950
with pkgs;
5051
[
@@ -121,7 +122,11 @@
121122
qemuPkgs = testGuestPkgs;
122123
firmwarePkgs = testGuestPkgs;
123124
};
124-
testMachines = import ./tests/config.nix { inherit pkgs toolchains; };
125+
testMachines = import ./tests/config.nix {
126+
inherit pkgs toolchains;
127+
qemuPkgs = tmachineRuntimePkgs;
128+
firmwarePkgs = tmachineRuntimePkgs;
129+
};
125130
artifacts = pkgs.callPackage ./tests/artifacts.nix { inherit rustToolchain toolchains; };
126131
in
127132
{

‎tests/config.nix‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
{ pkgs, toolchains }:
4+
{
5+
pkgs,
6+
toolchains,
7+
qemuPkgs ? pkgs,
8+
firmwarePkgs ? pkgs,
9+
}:
510

611
let
712
isAarch64 = pkgs.stdenv.hostPlatform.isAarch64;
813
gnuTarget = toolchains.${if isAarch64 then "aarch64-gnu" else "x86_64-gnu"}.target;
914
muslTarget = toolchains.${if isAarch64 then "aarch64-musl" else "x86_64-musl"}.target;
10-
images = import ./images.nix { inherit pkgs; };
11-
tmachine = pkgs.callPackage ./tmachine { };
15+
images = import ./images.nix {
16+
inherit pkgs qemuPkgs firmwarePkgs;
17+
};
18+
tmachine = pkgs.callPackage ./tmachine {
19+
OVMF = firmwarePkgs.OVMF;
20+
};
21+
qemu = qemuPkgs.qemu.override { hostCpuOnly = true; };
1222
config = (pkgs.formats.yaml { }).generate "tmachine-config.yaml" {
1323
machines = [
1424
{
@@ -98,7 +108,7 @@ let
98108
runner = pkgs.writeShellApplication {
99109
name = "tmachine";
100110
runtimeInputs = [
101-
pkgs.qemu
111+
qemu
102112
pkgs.ansible
103113
pkgs.sshpass
104114
];

‎tests/images.nix‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
{ pkgs }:
4+
{
5+
pkgs,
6+
qemuPkgs ? pkgs,
7+
firmwarePkgs ? pkgs,
8+
}:
59

610
let
711
isAarch64 = pkgs.stdenv.hostPlatform.isAarch64;
812
isDarwin = pkgs.stdenv.hostPlatform.isDarwin;
913
architecture = if isAarch64 then "aarch64" else "x86_64";
1014
ubuntuArchitecture = if isAarch64 then "arm64" else "amd64";
11-
qemu = pkgs.qemu.override { hostCpuOnly = true; };
15+
qemu = qemuPkgs.qemu.override { hostCpuOnly = true; };
1216
qemuBinary =
1317
if isAarch64 then "${qemu}/bin/qemu-system-aarch64" else "${qemu}/bin/qemu-system-x86_64";
1418
machine = if isAarch64 then "virt" else "q35";
@@ -35,7 +39,7 @@ let
3539
]
3640
++ pkgs.lib.optionals isAarch64 [
3741
"-drive"
38-
"if=pflash,format=raw,readonly=on,file=${pkgs.OVMF.firmware}"
42+
"if=pflash,format=raw,readonly=on,file=${firmwarePkgs.OVMF.firmware}"
3943
"-drive"
4044
"if=pflash,format=raw,file=firmware-vars.fd"
4145
]
@@ -72,7 +76,7 @@ let
7276
16G
7377
7478
${pkgs.lib.optionalString isAarch64 ''
75-
cp ${pkgs.OVMF.variables} firmware-vars.fd
79+
cp ${firmwarePkgs.OVMF.variables} firmware-vars.fd
7680
chmod 0600 firmware-vars.fd
7781
''}
7882

0 commit comments

Comments
 (0)