1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-25 19:51:00 +01:00

Lazily copy trees to the store

We now mount lazy accessors on top of /nix/store without materializing
them, and only materialize them to the real store if needed (e.g. in
the `derivation` primop).
This commit is contained in:
Eelco Dolstra 2025-04-08 23:32:52 +02:00
parent c891554999
commit febd28db87
14 changed files with 122 additions and 50 deletions

View file

@ -201,13 +201,16 @@ static void fetchTree(
throw Error("input '%s' is not allowed to use the '__final' attribute", input.to_string());
}
auto [storePath, accessor, input2] = input.fetchToStore(state.store);
// FIXME: use fetchOrSubstituteTree().
auto [accessor, lockedInput] = input.getAccessor(state.store);
auto storePath = StorePath::random(input.getName());
state.allowPath(storePath);
state.storeFS->mount(CanonPath(state.store->printStorePath(storePath)), accessor);
emitTreeAttrs(state, storePath, input2, v, params.emptyRevFallback, false);
emitTreeAttrs(state, storePath, lockedInput, v, params.emptyRevFallback, false);
}
static void prim_fetchTree(EvalState & state, const PosIdx pos, Value * * args, Value & v)