1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 15:51:15 +02:00

Factor out flake:... lookup path from evaluator

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
This commit is contained in:
John Ericson 2024-06-24 17:33:15 -04:00
parent 88f9d8ccb1
commit 52730d38e2
4 changed files with 68 additions and 20 deletions

View file

@ -15,7 +15,20 @@
namespace nix {
EvalSettings evalSettings {
settings.readOnlyMode
settings.readOnlyMode,
{
{
"flake",
[](ref<Store> store, std::string_view rest) {
experimentalFeatureSettings.require(Xp::Flakes);
// FIXME `parseFlakeRef` should take a `std::string_view`.
auto flakeRef = parseFlakeRef(std::string { rest }, {}, true, false);
debug("fetching flake search path element '%s''", rest);
auto storePath = flakeRef.resolve(store).fetchTree(store).first;
return store->toRealPath(storePath);
},
},
},
};
static GlobalConfig::Register rEvalSettings(&evalSettings);