diff options
author | Tom Bereknyei <tomberek@gmail.com> | 2021-08-22 18:45:42 -0400 |
---|---|---|
committer | Tom Bereknyei <tomberek@gmail.com> | 2021-08-22 18:45:42 -0400 |
commit | d90582be33601d9f25b9398e6938e84b5861d6cf (patch) | |
tree | a61cc5239b3b6ec62865caa49bbf879efcdc71fb | |
parent | 7a54b10a8a29dadea2bb2c639a15cfec25a4d38c (diff) |
Allow use of path and filterSource in flakes
As filterSource and path perform work, add paths to allowedPaths.
-rw-r--r-- | src/libexpr/primops.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index bfe41c9fa..6c86aa4e1 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -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; + } } |