Skip to main content

Module flake

Module flake 

Source
Expand description

Flake result shape — declarative policy for getFlake / callFlake output assembly. CppNix parity, authored as Lisp data.

Before this spec existed, the top-level flake attrset was built in sui-eval/src/builtins/flake_eval.rs by hand: the code inserted _type, outPath, sourceInfo, inputs, outputs explicitly, then iterated flake_attrs copying anything not already present. That loop silently leaked every top-level attribute from the parsed flake.nix (description, nixConfig, …) — which the first cross-repo sweep caught: CppNix does NOT expose those keys on the flake result, and every pleme-io flake’s (getFlake …) result disagreed.

This crate encodes the policy once:

(defflake-shape
  :name                       "cppnix"
  :type-marker                "flake"
  :required-keys              ("_type" "outPath" "sourceInfo"
                               "inputs" "outputs")
  :spread-from-output-fn       t
  :never-leak-from-flake-body ("description" "nixConfig"))

The Rust caller asks the shape: “should I copy this key from the flake body?”, “what’s the type marker string?”, “am I allowed to spread the outputs-fn result?”. Each question is a one-method call.

Structs§

FlakeShape
Top-level flake result shape policy.

Constants§

CPPNIX_FLAKE_SHAPE_LISP

Functions§

load_canonical
Compile the embedded canonical flake-shape spec.