# rules_jsonnet **Repository Path**: mirrors_bazelbuild/rules_jsonnet ## Basic Information - **Project Name**: rules_jsonnet - **Description**: Jsonnet rules for Bazel - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-03-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README [](https://buildkite.com/bazel/rules-jsonnet-postsubmit) # Jsonnet Rules
## Overview These are build rules for working with [Jsonnet][jsonnet] files with Bazel. [jsonnet]: https://jsonnet.org ## Setup To use the Jsonnet rules as part of your Bazel project, please follow the instructions on [the releases page](https://github.com/bazelbuild/rules_jsonnet/releases). ## Jsonnet Compiler Selection By default for Bzlmod, Bazel will use the [Go compiler](https://github.com/google/go-jsonnet). Note that the primary development focus of the Jsonnet project is now with the Go compiler. This repository's support for using the C++ compiler is deprecated, and may be removed in a future release. To use [the C++](https://github.com/google/jsonnet) or [Rust](https://github.com/CertainLach/jrsonnet) compiler of Jsonnet instead, register a different compiler: | Jsonnet compiler | MODULE.bazel directive | | ---------------- | --------------------------------- | | Go | `jsonnet.compiler(name = "go")` | | cpp | `jsonnet.compiler(name = "cpp")` | | Rust | `jsonnet.compiler(name = "rust")` | ### CLI Use the `--extra_toolchains` flag to pass the preferred toolchain to the bazel invocation: ```bash bazel build //... --extra_toolchains=@rules_jsonnet//jsonnet:cpp_jsonnet_toolchain bazel test //... --extra_toolchains=@rules_jsonnet//jsonnet:rust_jsonnet_toolchain bazel run //... --extra_toolchains=@rules_jsonnet//jsonnet:go_jsonnet_toolchain ``` ## Rule usage Please refer to [the StarDoc generated documentation](docs/jsonnet.md) for instructions on how to use these rules.