Azazel is a deterministic, declarative build-model layer for Zig. CUE validates a stable project model; Azazel generates typed Zig build data; Zig remains the build executor.
project.cue -> CUE validation -> build_spec.zig -> std.Build -> artifacts
human constraints typed IR Zig
The point is not to hide Zig. The point is to keep project configuration stable while Azazel absorbs std.Build API churn, and to make the build graph available as validated data for analysis, tooling, compatibility work, and eventually safe remote caching.
The core build pipeline is production-supported on Zig 0.14.1, 0.15.2, and 0.16.0. CI runs the same canonical CLI path users run, forces code generation twice to verify determinism, builds, and runs the test suites on every supported lane.
Azazel is still pre-1.0. Pin the revision or release you adopt and upgrade deliberately. The exact support contract and release gate are in docs/PRODUCTION.md.
The shared artifact cache keys each build on its declared-input closure and refuses a build whose inputs it cannot name. CACHE.md lists what the key covers, what is refused, and the evidence.
package build
core: #Module & {
kind: "module"
root: "src/core.zig"
}
app: #Module & {
kind: "exe"
root: "src/main.zig"
deps: ["core"]
profile: "release"
}For a pure Zig dependency, kind: "module" is consumed through @import and produces no separate artifact. ABI-linked static/shared libraries remain available for C/C++ interoperability and explicit binary boundaries.
Prerequisites are Zig, CUE, and Python 3.
brew install cue zig
git clone https://github.com/godofecht/azazel.git
cd azazel
./setup.shThe canonical CLI is the root azazel script:
python3 azazel check # validate CUE, exported contract, roots, graph
python3 azazel gen # generate build_spec.zig
python3 azazel build # check + generate + zig build
python3 azazel build -Dfoo=true # forward normal Zig build arguments
python3 azazel targets # list target paths; select with --slice or --subproject
python3 azazel build --slice 'examples/*' # build only the matching subprojects
python3 azazel info # print the resolved build model
python3 azazel cleanThe CLI does not contain a second generator. gen_build_spec.sh is the single CUE-to-Zig implementation used by both direct and CLI workflows.
The equivalent low-level path is:
./gen_build_spec.sh
zig build
zig build test --summary allA hand-written build.zig is executable build logic. Azazel moves the project description into a validated model and keeps the compatibility/execution layer separate.
That gives the project a representation which can be checked before compilation, diffed as data, consumed by editor tooling, replayed against multiple Zig lanes, translated into a build graph, and pressure-tested against real repositories without treating arbitrary build-script behavior as the configuration format.
The generated build_spec.zig is typed Zig source. The executor does not parse JSON at build time.
#Module currently models:
| Field | Purpose |
|---|---|
kind |
exe, static, shared, or module-only target |
root |
Zig root source file |
subproject |
The nested package the module belongs to, by its key in subprojects |
artifact_name |
Produced artifact name when it differs from the graph/import name |
deps |
Internal module dependencies |
profile |
Debug or release optimization profile |
link |
import or ABI consumption |
pre, post |
Explicit build-time commands |
install_dirs |
Runtime/resource directory staging |
pkg_imports |
Zig package module imports |
pkg_artifacts |
Artifacts exported by Zig packages |
pkg_library_paths |
Package-provided library search paths |
build_options |
User-selectable typed build options |
option_values |
Fixed typed values injected into an options module |
gen_imports |
Zig modules generated by declared host tools |
generated |
Outputs of declared generator steps: imported, embedded, compiled as C, or added to the include path |
build_options_import |
Import name for generated build options |
native |
C sources, includes, objects, system libraries, frameworks, libc/libc++ linkage |
The full schema is in schema.cue and the worked reference is in docs/WIKI.md.
A field is considered implemented only when it survives all four layers: schema, CUE export, generated spec, and Zig executor. python3 azazel check validates the exported module contract so silently dropped fields fail before compilation.
A generator is declared once at the top level and consumed by any module:
generated: build_info: {
command: ["python3"]
args: [
{kind: "input_file", value: "tools/gen/build_info.py"},
{kind: "input_file", value: "build.zig.zon"},
{kind: "output_file", value: "build_info.zig"},
]
outputs: [{name: "build_info.zig"}]
}
app: #Module & {
kind: "exe"
root: "src/main.zig"
generated: [{from: "build_info", output: "build_info.zig", as: "import", alias: "build_info"}]
}The producer is a Zig host tool, a command on PATH, or a path exported by a package. Outputs can be imported, embedded, compiled as C sources, added to the include path, and installed. This repository builds app that way: it prints the version the generator read from build.zig.zon. See "Generated files" in docs/WIKI.md.
packages in project.cue declares build.zig.zon dependencies by alias, with url, hash, path and lazy. Modules consume them through pkg_imports, pkg_artifacts and pkg_library_paths. python3 azazel zon write rewrites the .dependencies of build.zig.zon from that declaration, azazel zon check lists drift, and azazel zon import <build.zig.zon> prints a packages block for an existing manifest. See "Packages and build.zig.zon" in docs/WIKI.md.
The options a dependency takes are typed args on the import, the artifact or the generated package: bool, int, string, string_list, enum, target and optimize. {name: "backend", kind: "enum", value: "glfw_wgpu"} becomes .backend = .glfw_wgpu in the generated b.dependency call. azazel check compares each option with what the dependency's own build.zig declares, so a misspelled name or a wrong type fails before Zig runs. See "Dependency options" in docs/WIKI.md.
subprojects in project.cue declares nested packages by path, with an optional output_dir for their artifacts. A module joins one with subproject. python3 azazel build --slice 'examples/*' builds and installs only the modules whose target path or subproject path matches the glob. --subproject NAME selects by name, and python3 azazel targets lists what a selection reaches. This repository declares its danzig core and its two examples that way. See "Subprojects and target slices" in docs/WIKI.md.
Host requirements are declared once, at the top level of project.cue:
system_deps: [
{name: "wayland-scanner", kind: "tool", hint: "part of the wayland development package"},
{name: "wlroots-0.20", kind: "pkg_config"},
{name: "Cocoa", kind: "framework", os: ["macos"]},
]A requirement is a tool, a pkg_config library, a system library, a framework, a header, or an include_dir. os limits it to the listed platforms. zig build checks every requirement before any artifact compiles and prints each missing one with its hint. python3 azazel doctor runs the same checks without building. See the schema reference in docs/WIKI.md.
Projects may declare accepted lanes:
toolchain: zig: {
lanes: ["0.14", "0.15", "0.16"]
preferred: "0.15"
}The generated build spec records those lanes and build.zig rejects an unsupported Zig lane before doing real build work.
Release CI currently covers 0.14.1, 0.15.2, and 0.16.0. Zig 0.17 support exists for corpus work but remains best-effort while 0.17 is a moving development target.
Lanes describe what the Azazel generator supports. The exact release, development-build window, or custom distribution an upstream project requires is a separate declaration, recorded per repo in the corpus manifests and resolved by tools/zig_toolchain.py. See docs/HUGE_PROJECT_CORPUS.md.
Azazel distinguishes two internal dependency shapes.
link: "import" merges a Zig dependency into the consumer compilation and exposes it through @import("name"). It avoids a separate artifact/link step and is the normal choice for pure Zig module edges.
link: "abi" keeps a separately compiled artifact and links it across an ABI boundary. Shared libraries are always ABI targets. This is the appropriate shape for C/C++ interoperability and deliberate binary boundaries.
Large projects can combine the two into clusters: import-connected modules inside a cluster, with ABI boundaries between clusters. See examples/06-clusters.
Azazel maintains a corpus built around ZLS, libxev, River, Mach, MicroZig, libvaxis, Capy, zig-gamedev, TigerBeetle, and Ghostty. The corpus is used to discover missing build-model primitives and toolchain/API failure modes.
Executable parity is claimed only for modeled target slices that actually compile through the Azazel-generated graph. An upstream project's own successful zig build is tracked separately and is not reported as Azazel replacement parity.
See docs/HUGE_PROJECT_CORPUS.md.
The production build path does not depend on the shared cache, corpus automation, IDE prototypes, or Danzig.
tools/huge_corpus.py is validation/research infrastructure. ide/ contains editor experiments. src/danzig/ is retained as a substantial integration/dogfood workload rather than as part of Azazel's build-system API.
Keeping those boundaries explicit is intentional: experimental surfaces may inform the build model without silently becoming production dependencies.
The complete reference lives in docs/WIKI.md. Production guarantees are defined in docs/PRODUCTION.md. Contribution requirements are in CONTRIBUTING.md, and security reporting guidance is in SECURITY.md.
The generated documentation site is published from the repository's documentation sources on GitHub Pages.
Azazel is the declarative configuration frontend for Zaza, a Zig-driven build system for C, C++, Zig, CMake interoperability, and WebAssembly. Azazel can also be used directly for Zig projects.
MIT