diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-10-06 18:08:18 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2021-10-06 18:08:18 +0200 |
commit | c497fce0111219999b37c05030f766d8cf8f901e (patch) | |
tree | 772f28394ff2de76927985ab28b51beb18ebcab6 /src/libexpr/primops.cc | |
parent | 57a8eb4c018ff69304835b0bbbfd01294df07058 (diff) | |
parent | d90582be33601d9f25b9398e6938e84b5861d6cf (diff) |
Merge branch 'flakes_filterSource' of https://github.com/tomberek/nix
Diffstat (limited to 'src/libexpr/primops.cc')
-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 3bf091438..acb5d3cef 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -1891,6 +1891,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; + } } |