MCPcopy Create free account
hub / github.com/NixOS/nix / runFetchClosureWithContentAddressedPath

Function runFetchClosureWithContentAddressedPath

src/libexpr/primops/fetchClosure.cc:75–99  ·  view source on GitHub ↗

* Fetch the closure and make sure it's content addressed. */

Source from the content-addressed store, hash-verified

73 * Fetch the closure and make sure it's content addressed.
74 */
75static void runFetchClosureWithContentAddressedPath(
76 EvalState & state, const PosIdx pos, Store & fromStore, const StorePath & fromPath, Value & v)
77{
78
79 if (!state.store->isValidPath(fromPath))
80 copyClosure(fromStore, *state.store, RealisedPath::Set{fromPath});
81
82 auto info = state.store->queryPathInfo(fromPath);
83
84 if (!info->isContentAddressed(*state.store)) {
85 throw Error(
86 {.msg = HintFmt(
87 "The 'fromPath' value '%s' is input-addressed, but 'inputAddressed' is set to 'false' (default).\n\n"
88 "If you do intend to fetch an input-addressed store path, add\n\n"
89 " inputAddressed = true;\n\n"
90 "to the 'fetchClosure' arguments.\n\n"
91 "Note that to ensure authenticity input-addressed store paths, users must configure a trusted binary cache public key on their systems. This is not needed for content-addressed paths.",
92 state.store->printStorePath(fromPath)),
93 .pos = state.positions[pos]});
94 }
95
96 state.allowClosure(fromPath);
97
98 state.mkStorePathString(fromPath, v);
99}
100
101/**
102 * Fetch the closure and make sure it's input addressed.

Callers 1

prim_fetchClosureFunction · 0.85

Calls 9

copyClosureFunction · 0.85
ErrorEnum · 0.85
HintFmtClass · 0.85
isValidPathMethod · 0.80
isContentAddressedMethod · 0.80
printStorePathMethod · 0.80
allowClosureMethod · 0.80
mkStorePathStringMethod · 0.80
queryPathInfoMethod · 0.45

Tested by

no test coverage detected