Bazel rules for the Odin programming language.
rules_odin provides hermetic Bazel build rules for Odin, a data-oriented systems programming language. The ruleset automatically downloads and manages the Odin compiler toolchain, requiring no system-wide Odin installation.
- Hermetic Odin toolchain management (no system install required)
- bzlmod-first (no WORKSPACE file needed)
- Multi-platform support: Linux (x86-64, ARM64), macOS (x86-64, ARM64), Windows (x86-64)
- Bazel 7.x, 8.x, and 9.x compatible
Add to your MODULE.bazel:
bazel_dep(name = "rules_odin", version = "0.1.0")
odin = use_extension("@rules_odin//odin:extensions.bzl", "odin")
odin.toolchain(odin_version = "dev-2026-06")
use_repo(odin, "odin_toolchains")
register_toolchains("@odin_toolchains//:all")Then in your BUILD.bazel:
load("@rules_odin//odin:defs.bzl", "odin_binary")
odin_binary(
name = "hello",
srcs = glob(["*.odin"]),
)Compiles an Odin package (directory of .odin files) into an executable.
| Attribute | Type | Default | Description |
|---|---|---|---|
srcs |
label_list | required | Odin source files (must share a package) |
optimization |
string | "none" |
One of: none, minimal, speed, size, aggressive |
debug |
bool | True |
Include debug symbols |
defines |
string_dict | {} |
Compile-time -define: values |
extra_compiler_flags |
string_list | [] |
Additional flags passed to odin build |
vet |
bool | False |
Enable -vet checks |
| Version | Status |
|---|---|
| dev-2026-06 | Supported |
| dev-2026-05 | Supported |
See COMPATIBILITY.md for the full version matrix.
- Bazel 7.x, 8.x, or 9.x
- Linux:
clangorgcc(for linking) - macOS: Xcode Command Line Tools
- Windows: MSVC "Desktop development with C++" workload
See CONTRIBUTING.md for development setup and guidelines.
Apache License 2.0 - see LICENSE.