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

Function runFetchClosureWithInputAddressedPath

src/libexpr/primops/fetchClosure.cc:104–125  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

102 * Fetch the closure and make sure it's input addressed.
103 */
104static void runFetchClosureWithInputAddressedPath(
105 EvalState & state, const PosIdx pos, Store & fromStore, const StorePath & fromPath, Value & v)
106{
107
108 if (!state.store->isValidPath(fromPath))
109 copyClosure(fromStore, *state.store, RealisedPath::Set{fromPath});
110
111 auto info = state.store->queryPathInfo(fromPath);
112
113 if (info->isContentAddressed(*state.store)) {
114 throw Error(
115 {.msg = HintFmt(
116 "The store object referred to by 'fromPath' at '%s' is not input-addressed, but 'inputAddressed' is set to 'true'.\n\n"
117 "Remove the 'inputAddressed' attribute (it defaults to 'false') to expect 'fromPath' to be content-addressed",
118 state.store->printStorePath(fromPath)),
119 .pos = state.positions[pos]});
120 }
121
122 state.allowClosure(fromPath);
123
124 state.mkStorePathString(fromPath, v);
125}
126
127typedef std::optional<StorePath> StorePathOrGap;
128

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