Allow use of path and filterSource in flakes

As filterSource and path perform work, add paths to allowedPaths.
This commit is contained in:
Tom Bereknyei 2021-08-22 18:45:42 -04:00
parent 7a54b10a8a
commit d90582be33

View file

@ -1886,6 +1886,20 @@ static void addPath(EvalState & state, const Pos & pos, const string & name, con
dstPath = state.store->printStorePath(*expectedStorePath);
mkString(v, dstPath, {dstPath});
if (state.allowedPaths)
state.allowedPaths->insert(v.string.s);
try {
state.realiseContext({});
} catch (InvalidPathError & e) {
throw EvalError({
.msg = hintfmt("cannot import '%1%', since path '%2%' is not valid", path, e.path),
.errPos = pos
});
} catch (Error & e) {
e.addTrace(pos, "while importing '%s'", path);
throw e;
}
}