aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/parser.y
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2022-12-07 15:23:01 +0100
committerEelco Dolstra <edolstra@gmail.com>2022-12-12 14:05:52 +0100
commitfd0ed7511818ba871dc3e28796ec1d0ca57b22ec (patch)
tree75aeee532ba00a2f9a52f472bdcba46969e8a711 /src/libexpr/parser.y
parentae5f62a894190e0075eb60ae4537ba81ca2a0a8d (diff)
Support flake references in the old CLI
Fixes #7026.
Diffstat (limited to 'src/libexpr/parser.y')
-rw-r--r--src/libexpr/parser.y13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y
index 6ef9407cd..fbf865719 100644
--- a/src/libexpr/parser.y
+++ b/src/libexpr/parser.y
@@ -643,6 +643,7 @@ formal
#include "filetransfer.hh"
#include "fetchers.hh"
#include "store-api.hh"
+#include "flake/flake.hh"
namespace nix {
@@ -816,7 +817,17 @@ std::pair<bool, std::string> EvalState::resolveSearchPathElem(const SearchPathEl
});
res = { false, "" };
}
- } else {
+ }
+
+ else if (hasPrefix(elem.second, "flake:")) {
+ settings.requireExperimentalFeature(Xp::Flakes);
+ auto flakeRef = parseFlakeRef(elem.second.substr(6), {}, true, false);
+ debug("fetching flake search path element '%s''", elem.second);
+ auto storePath = flakeRef.resolve(store).fetchTree(store).first.storePath;
+ res = { true, store->toRealPath(storePath) };
+ }
+
+ else {
auto path = absPath(elem.second);
if (pathExists(path))
res = { true, path };