I have an environment variable (OVMF_FD) that contains the path to a file on my system.

In the past, I could have done something like:

const ovmf_path = try std.process.getEnvVarOwned(b.allocator, "OVMF_FD");
const qemu_cmd = b.addSystemCommand(&.{
    "qemu-system-x86_64",
    "-bios",
    ovmf_path,
    ...
});

So how do this in 0.16? Because the build function doesn’t give me an instance of the env map like main does, so I’m unsure how to access it.

Thanks for the help!

skk64 July 22, 2026, 1:21am 2

I think this is the way to do it:

pub fn build(b: *std.Build) void {
    b.graph.environ_map.get("OVMF_FD");
// ....

It’s not well documented, is it?