pub fn dematerialize(path: &Path) -> PathBufExpand description
REVERSE of materialize for 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>-source
STORE-PATH equivalent (with the same relative subpath appended); returns
path unchanged when it is not under any registered input’s cache dir.
This closes the position half of the store↔cache seam. materialize
redirects a store-path READ down to the cache; dematerialize lifts a
cache-path back up to the store path for REPORTING — so
builtins.unsafeGetAttrPos/__curPos reports the store-source .file
CppNix reports (/nix/store/<h>-source/lib/foo.nix), NOT the sui fetcher
cache dir. nix-darwin’s doc/manual hasPrefix <nix-darwin>.outPath decl
rewrite only fires when decl carries the store prefix — the
options.json dock-declarations root.
Both sides are compared after canonicalize on the cache side (a
symlinked cache dir — macOS /tmp → /private/tmp, ~ expansion —
still matches the registered read_dir, which is canonicalized here
too). Only the reported STRING changes; no value the evaluator observes
is mutated — the byte-parity invariant.