1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-19 23:09:37 +02:00

fetchOrSubstituteTree(): Return an accessor

This prepares lazy access to flake.nix etc.
This commit is contained in:
Eelco Dolstra 2025-02-04 16:14:34 +01:00
parent 3c109095de
commit 1ab97a70f5
4 changed files with 54 additions and 19 deletions

View file

@ -200,10 +200,6 @@ std::pair<StorePath, Input> Input::fetchToStore(ref<Store> store) const
auto narHash = store->queryPathInfo(storePath)->narHash;
result.attrs.insert_or_assign("narHash", narHash.to_string(HashFormat::SRI, true));
// FIXME: we would like to mark inputs as final in
// getAccessorUnchecked(), but then we can't add
// narHash. Or maybe narHash should be excluded from the
// concept of "final" inputs?
result.attrs.insert_or_assign("__final", Explicit<bool>(true));
assert(result.isFinal());
@ -284,6 +280,8 @@ std::pair<ref<SourceAccessor>, Input> Input::getAccessor(ref<Store> store) const
try {
auto [accessor, result] = getAccessorUnchecked(store);
result.attrs.insert_or_assign("__final", Explicit<bool>(true));
checkLocks(*this, result);
return {accessor, std::move(result)};