pub fn source_name_for_read_dir(real: &Path) -> Option<String>Expand description
Reverse of materialize for the copy-to-store NAMING rule: given a
REAL on-disk directory (the fetcher-cache read_dir a materialize
already resolved to, then canonicalized), return the store-path
BASENAME of the flake input that tree belongs to — i.e. CppNix’s
-source name — when real IS that input’s whole tree root.
This closes the darwin system-path root: a fetched flake input’s
src = ./. copies the input’s own tree back into the store; CppNix names
that copy after the input’s /nix/store/<h>-source basename
(<h>-source), but sui reads the tree from ~/.cache/sui/inputs/<narhash>
whose basename is <repo>-<rev>. Only the NAME needs correcting — the
bytes (→ NAR hash) are identical either way — so this maps the physical
read location back to the logical -source name.
Both sides are canonicalized before comparison so a symlinked cache dir
(macOS /tmp → /private/tmp, ~ expansion) still matches. Returns
None when real is not a registered input root (a normal local
src = ./. keeps its own directory basename).