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

mountInput(): Optimize getting the NAR hash for real store paths

This commit is contained in:
Eelco Dolstra 2025-06-12 16:11:54 +02:00
parent fca291afc3
commit 6477d7c2ca

View file

@ -81,9 +81,13 @@ StorePath EvalState::mountInput(
auto getNarHash = [&]()
{
if (!_narHash)
// FIXME: use fetchToStore to make it cache this
_narHash = accessor->hashPath(CanonPath::root);
if (!_narHash) {
if (store->isValidPath(storePath))
_narHash = store->queryPathInfo(storePath)->narHash;
else
// FIXME: use fetchToStore to make it cache this
_narHash = accessor->hashPath(CanonPath::root);
}
return _narHash;
};