Expand description
Centralized path resolution (normalize, resolve relative, import). Centralized path resolution for the Nix evaluator.
All path operations (normalization, relative resolution, import resolution) go through this module to ensure consistent behavior.
Functions§
- canon_
abs - Canonicalize an ABSOLUTE path string exactly the way CppNix’s
canonPathdoes — the byte-for-byte semantics of a Nix path value. - dematerialize
- REVERSE of
materializefor SOURCE POSITIONS: given a REAL on-disk path (a fetcher-cache~/.cache/sui/inputs/…file that eval actually read from), return the flake input’s/nix/store/<narhash>-sourceSTORE-PATH equivalent (with the same relative subpath appended); returnspathunchanged when it is not under any registered input’s cache dir. - dematerialize_
str - Convenience:
dematerializea&strpath, returning an ownedString. - materialize
- If
pathlies under a registered flake-input store-path prefix, rewrite that prefix to the input’s real on-diskread_dir; otherwise returnpathunchanged. This is a FILESYSTEM-READ-ONLY redirect — callers use the result to touch disk, never to build a value the evaluator observes. - materialize_
str - Convenience:
materializea&strpath, returning an ownedString. - normalize
- Normalize a path by removing
.components and resolving..components. Unlikecanonicalize(), this doesn’t require the path to exist on disk. - register_
fetched_ source - Register a
builtins.fetch*result directory with the store-path NAME CppNix would give its copied-to-store tree ("source"forfetchGit/fetchTree/fetchTarball). Idempotent perread_dir. Does not affect any string value — only the name a later copy-to-store coercion of this exact path assigns to its store path. - register_
input_ source - Register a fetched flake-input source tree so subsequent filesystem
reads under its
/nix/store/<narhash>-sourcestore path resolve to the real on-diskread_dir. Idempotent perstore_path. Does not affect any string value — only where reads land on disk. - resolve_
import - Resolve an import path.
- resolve_
relative - Resolve a relative path against a base directory, normalizing the result.
- source_
name_ for_ read_ dir - Reverse of
materializefor the copy-to-store NAMING rule: given a REAL on-disk directory (the fetcher-cacheread_diramaterializealready resolved to, thencanonicalized), return the store-path BASENAME of the flake input that tree belongs to — i.e. CppNix’s-sourcename — whenrealIS that input’s whole tree root.