mirror of
https://github.com/NixOS/nix
synced 2025-07-07 01:51:47 +02:00
unsafeGetAttrPos: Set string context on store paths
This is needed to devirtualize them when they get passed to a derivation or builtins.toFile. Arguably, since this builtin is unsafe, we could just ignore this, but we may as well do the correct thing.
This commit is contained in:
parent
0c0dda3b29
commit
43a26916c2
1 changed files with 10 additions and 1 deletions
|
@ -948,7 +948,16 @@ void EvalState::mkPos(Value & v, PosIdx p)
|
|||
auto origin = positions.originOf(p);
|
||||
if (auto path = std::get_if<SourcePath>(&origin)) {
|
||||
auto attrs = buildBindings(3);
|
||||
attrs.alloc(sFile).mkString(path->path.abs());
|
||||
if (path->accessor == rootFS && store->isInStore(path->path.abs()))
|
||||
// FIXME: only do this for virtual store paths?
|
||||
attrs.alloc(sFile).mkString(path->path.abs(),
|
||||
{
|
||||
NixStringContextElem::Opaque{
|
||||
.path = store->toStorePath(path->path.abs()).first
|
||||
}
|
||||
});
|
||||
else
|
||||
attrs.alloc(sFile).mkString(path->path.abs());
|
||||
makePositionThunks(*this, p, attrs.alloc(sLine), attrs.alloc(sColumn));
|
||||
v.mkAttrs(attrs);
|
||||
} else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue