diff options
Diffstat (limited to 'src/nix/installables.cc')
-rw-r--r-- | src/nix/installables.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/nix/installables.cc b/src/nix/installables.cc index f471319be..4b171dcba 100644 --- a/src/nix/installables.cc +++ b/src/nix/installables.cc @@ -237,7 +237,7 @@ App Installable::toApp(EvalState & state) } std::vector<std::pair<std::shared_ptr<eval_cache::AttrCursor>, std::string>> -Installable::getCursor(EvalState & state, bool useEvalCache) +Installable::getCursors(EvalState & state, bool useEvalCache) { auto evalCache = std::make_shared<nix::eval_cache::EvalCache>(false, Hash(), state, @@ -245,6 +245,15 @@ Installable::getCursor(EvalState & state, bool useEvalCache) return {{evalCache->getRoot(), ""}}; } +std::pair<std::shared_ptr<eval_cache::AttrCursor>, std::string> +Installable::getCursor(EvalState & state, bool useEvalCache) +{ + auto cursors = getCursors(state, useEvalCache); + if (cursors.empty()) + throw Error("cannot find flake attribute '%s'", what()); + return cursors[0]; +} + struct InstallableStorePath : Installable { ref<Store> store; @@ -474,7 +483,7 @@ std::pair<Value *, Pos> InstallableFlake::toValue(EvalState & state) } std::vector<std::pair<std::shared_ptr<eval_cache::AttrCursor>, std::string>> -InstallableFlake::getCursor(EvalState & state, bool useEvalCache) +InstallableFlake::getCursors(EvalState & state, bool useEvalCache) { auto evalCache = openEvalCache(state, std::make_shared<flake::LockedFlake>(lockFlake(state, flakeRef, lockFlags)), |