1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 11:41:15 +02:00

Make builtins.{path,filterSource} work with chroot stores

This commit is contained in:
Eelco Dolstra 2021-10-07 14:07:51 +02:00
parent 7b5fc4a984
commit d39692e6b3
6 changed files with 24 additions and 15 deletions

View file

@ -445,7 +445,7 @@ EvalState::EvalState(
StorePathSet closure;
store->computeFSClosure(store->toStorePath(r.second).first, closure);
for (auto & path : closure)
allowPath(store->printStorePath(path));
allowPath(path);
} catch (InvalidPath &) {
allowPath(r.second);
}
@ -488,6 +488,12 @@ void EvalState::allowPath(const Path & path)
allowedPaths->insert(path);
}
void EvalState::allowPath(const StorePath & storePath)
{
if (allowedPaths)
allowedPaths->insert(store->toRealPath(storePath));
}
Path EvalState::checkSourcePath(const Path & path_)
{
if (!allowedPaths) return path_;
@ -1895,9 +1901,9 @@ string EvalState::copyPathToStore(PathSet & context, const Path & path)
? store->computeStorePathForPath(std::string(baseNameOf(path)), checkSourcePath(path)).first
: store->addToStore(std::string(baseNameOf(path)), checkSourcePath(path), FileIngestionMethod::Recursive, htSHA256, defaultPathFilter, repair);
dstPath = store->printStorePath(p);
allowPath(p);
srcToStore.insert_or_assign(path, std::move(p));
printMsg(lvlChatty, "copied source '%1%' -> '%2%'", path, dstPath);
allowPath(dstPath);
}
context.insert(dstPath);