Expand description
Nix-powered IR transforms (external evaluator: nix-instantiate or sui). Nix-powered IR transforms.
Shells out to an external Nix evaluator (nix-instantiate by
default; aliased to sui in sui-enabled environments) to apply a
user-supplied Nix expression over an IacResource. The expression
is a single-argument lambda:
# transform.nix
resource: resource // {
description = "v2 — updated by Nix transform";
attributes = map (a:
if a.name == "password" then a // { sensitive = true; } else a
) resource.attributes;
}Call flow:
- Rust emits the IR as a Nix attribute set via
NixBackend’sresource_to_nixconverter (internal helper used by this module too) - Nix evaluates
(<expression>) <emitted-attrset>and prints JSON viabuiltins.toJSON - Rust reads the JSON output and reconstructs an
IacResource
This is the pragmatic realization of “Nix as the extension language
for IR transforms.” Sui integration at the Rust library level (linking
sui-eval directly, no process boundary) is a natural follow-up; the
API surface here stays the same.
Enums§
- NixEvaluator
- Which evaluator binary to call.
nix-instantiateis the default; users can override viaNixEvaluator::Custom("sui".into())or via theNIX_EVALUATORenvironment variable. - NixTransform
Error - Errors from running a Nix-powered transform.
Functions§
- apply_
nix_ transform - Apply a Nix lambda expression to an IacResource.
- evaluator_
available - Check whether the configured evaluator is available on PATH.