Hi everyone,
I’m not sure im in any position to be attempting such a thing because there’s a lot of things that i still dont understand enough about zig and i’ve also just joined the community a few days ago.
I want to sanity-check an idea with the community before I start building it. This is something I’d only attempt after I have a very solid understanding of Zig and the build system.
The tool could be tentatively called zag. The goal is not to replace zig build, not to add a new build DSL, and not to hide what Zig is doing. It’s meant to sit around the existing Zig tooling and reduce some repetitive project setup friction.
Problem I’m trying to address
After using the Zig build system for a while, a few pain points keep coming up:
- Managing Zig versions per project
- Repeating the same dependency setup boilerplate in
build.zig - Manually copying OS- and Zig-version-specific build configuration from README files
None of these are unsolvable, but they’re tedious and error-prone, especially across multiple projects.
What zag would do
zag would focus on three narrow responsibilities:
-
Per-project Zig version management(kind of like
anyzig)- Detect required Zig version from
build.zig.zon - Install/select that version automatically
- Set up the environment so
zig buildworks without manual steps
- Detect required Zig version from
-
Dependency fetching (thin wrapper)
-
zag add <package>would internally call:zig fetch --save <package> ```bash -
No custom dependency resolution logic
-
-
Optional, declarative
build.zigaugmentation-
This is strictly opt-in and driven by the library author, not heuristics
-
A dependency may include a small config file (e.g.
zag.zon) -
That file describes how the dependency should be wired into
build.zig- imports
- link libraries
- OS-specific or Zig-version-specific conditions
-
Example (very rough):
.{
.zig = .{ .min = "0.14.0" },
.build = .{
.imports = &.{ "mylib" },
.link = &.{
.{ .os = "linux", .libs = &.{ "vulkan" } },
.{ .os = "windows", .libs = &.{ "d3d12" } },
},
},
}
zag would only insert or update code inside clearly marked regions in build.zig, e.g.:
// zag:begin mylib
// zag:end mylib
Anything outside those markers is never touched.
Non-goals
To be explicit, zag would not:
- Replace
zig build - Introduce a new build language
- Guess or auto-generate configs
- Hide build logic from the user
- Require libraries to support it
If a dependency has no zag config, zag would simply fetch it and do nothing else.
Why I’m asking
Before investing time into this, I’d like feedback on:
- Whether this overlaps with existing or planned Zig tooling
- Whether the idea conflicts with Zig’s philosophy of explicitness
- Whether the opt-in, library-authored config approach seems reasonable
- Any obvious pitfalls I’m missing
I’m not proposing this as “the Zig way”, just exploring whether it’s a useful, non-invasive tool for people who want it.