Skip to main content

Module store_transform

Module store_transform 

Source
Expand description

Typed transformation AST over ParsedNar trees.

StoreTransform is the substrate’s declarative authoring surface for operating on NAR contents. Operators write (defstore-transform :name … :match-kind … :pattern …) in Lisp; the Rust executor applies the transforms in declared order to any ParsedNar tree.

Three transform kinds:

  • FileContents — regex match-and-replace over the bytes of every file in the tree. Used for redaction, secret-stripping, build-id rewriting.
  • StorePathReference — replaces every literal /nix/store/<from>-* occurrence (anywhere in file contents OR symlink targets) with /nix/store/<to>-*. Mirrors cppnix’s referrer-graft semantics.
  • EntryName — renames the top-level entries of a directory matching a regex.

Structs§

StoreTransform
Typed transformation declaration. Authored as (defstore-transform …) in Lisp.
TransformOutcome
Outcome of applying one transform to one node. Aggregated by the executor.

Enums§

TransformKind
Discriminator for the three transform shapes.

Constants§

CANONICAL_STORE_TRANSFORMS_LISP

Functions§

apply_all
Apply a sequence of transforms to a ParsedNar. Each transform fires in declared order; outcomes are returned in the same order. The tree is mutated in place.
apply_one
Apply one transform, returning its outcome.
load_canonical
Compile every authored transform.