Expand description
Source-tree store-path computation — the primitive behind
builtins.getFlake "path:...".
CppNix, when asked for a path: flake ref, serializes the
source tree as a NAR archive (excluding .git by default),
hashes the NAR with sha256, and produces:
- a store path of the form
/nix/store/<hash>-source(computed via thefixed-output-hash“source” branch), - a SRI-format
narHashof the formsha256-<base64>.
Both are surfaced on the flake result as outPath + narHash
(top level) and duplicated inside sourceInfo.
This module is the single place we serialize + hash a source tree. Callers (currently just the flake evaluator in sui-eval) go through one function and get both outputs atomically — no chance of the hash drifting from the path.
Structs§
- Source
Hash - Result of serializing + hashing a source tree.
Functions§
- base64_
sha256 - Base64 encode the SHA-256 of
byteswithout thesha256-prefix. Exposed for callers that already have NAR bytes in hand (e.g. a cache hit). - nar_
hash_ source_ tree - NAR-serialize
dir, hash it, and compute the CppNix source store path + SRI narHash.