aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-02-07 14:22:01 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-02-07 14:22:01 +0100
commitd2032edb2f86e955a8a7724a27c0c3225f386500 (patch)
tree33f4b8874c2e1816947e2086937b9175ec0b0e64 /src/libexpr
parent0b013a54dc570395bed887369f8dd622b8ce337b (diff)
nix edit: Support non-derivation attributes
E.g. $ nix edit .#nixosConfigurations.bla now works.
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/attr-path.cc2
-rw-r--r--src/libexpr/attr-path.hh1
2 files changed, 2 insertions, 1 deletions
diff --git a/src/libexpr/attr-path.cc b/src/libexpr/attr-path.cc
index 1e22f5708..4545bfd72 100644
--- a/src/libexpr/attr-path.cc
+++ b/src/libexpr/attr-path.cc
@@ -103,7 +103,7 @@ Pos findDerivationFilename(EvalState & state, Value & v, std::string what)
auto dummyArgs = state.allocBindings(0);
v2 = findAlongAttrPath(state, "meta.position", *dummyArgs, v).first;
} catch (Error &) {
- throw Error("package '%s' has no source location information", what);
+ throw NoPositionInfo("package '%s' has no source location information", what);
}
// FIXME: is it possible to extract the Pos object instead of doing this
diff --git a/src/libexpr/attr-path.hh b/src/libexpr/attr-path.hh
index 3e78e2899..fce160da7 100644
--- a/src/libexpr/attr-path.hh
+++ b/src/libexpr/attr-path.hh
@@ -8,6 +8,7 @@
namespace nix {
MakeError(AttrPathNotFound, Error);
+MakeError(NoPositionInfo, Error);
std::pair<Value *, Pos> findAlongAttrPath(EvalState & state, const string & attrPath,
Bindings & autoArgs, Value & vIn);