mirror of
https://github.com/NixOS/nix.git
synced 2025-11-11 04:56:01 +01:00
Move mountInput into EvalState
This commit is contained in:
parent
ff85b347b8
commit
182edb4dee
7 changed files with 48 additions and 60 deletions
|
|
@ -67,4 +67,27 @@ std::string EvalState::computeBaseName(const SourcePath & path)
|
|||
return std::string(path.baseName());
|
||||
}
|
||||
|
||||
StorePath EvalState::mountInput(
|
||||
fetchers::Input & input, const fetchers::Input & originalInput, ref<SourceAccessor> accessor, bool requireLockable)
|
||||
{
|
||||
auto storePath = StorePath::random(input.getName());
|
||||
|
||||
allowPath(storePath); // FIXME: should just whitelist the entire virtual store
|
||||
|
||||
storeFS->mount(CanonPath(store->printStorePath(storePath)), accessor);
|
||||
|
||||
if (requireLockable && !input.isLocked() && !input.getNarHash()) {
|
||||
auto narHash = accessor->hashPath(CanonPath::root);
|
||||
input.attrs.insert_or_assign("narHash", narHash.to_string(HashFormat::SRI, true));
|
||||
}
|
||||
|
||||
// FIXME: check NAR hash
|
||||
|
||||
#if 0
|
||||
assert(!originalInput.getNarHash() || storePath == originalInput.computeStorePath(*store));
|
||||
#endif
|
||||
|
||||
return storePath;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue