aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-02-20 22:14:44 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-02-20 22:14:44 +0100
commitd068f9ffff3d2a98e6dde0834a250e4930d44778 (patch)
treeea9359e05ea924fb32fe11c190bdefd13437d4b4 /src/libexpr
parent890df325c76a9acd90300bb3590e7d1b102e2c28 (diff)
Restore subdir support in registries
Hacky...
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/common-eval-args.cc8
-rw-r--r--src/libexpr/flake/flakeref.cc3
-rw-r--r--src/libexpr/primops/fetchTree.cc2
3 files changed, 8 insertions, 5 deletions
diff --git a/src/libexpr/common-eval-args.cc b/src/libexpr/common-eval-args.cc
index e3135b472..1fdd4e9ec 100644
--- a/src/libexpr/common-eval-args.cc
+++ b/src/libexpr/common-eval-args.cc
@@ -42,9 +42,11 @@ MixEvalArgs::MixEvalArgs()
.description("override a flake registry value")
.arity(2)
.handler([&](std::vector<std::string> ss) {
- fetchers::overrideRegistry(
- parseFlakeRef(ss[0], absPath(".")).input,
- parseFlakeRef(ss[1], absPath(".")).input);
+ auto from = parseFlakeRef(ss[0], absPath("."));
+ auto to = parseFlakeRef(ss[1], absPath("."));
+ fetchers::Input::Attrs extraAttrs;
+ if (to.subdir != "") extraAttrs["subdir"] = to.subdir;
+ fetchers::overrideRegistry(from.input, to.input, extraAttrs);
});
}
diff --git a/src/libexpr/flake/flakeref.cc b/src/libexpr/flake/flakeref.cc
index c46661df8..b61352749 100644
--- a/src/libexpr/flake/flakeref.cc
+++ b/src/libexpr/flake/flakeref.cc
@@ -40,7 +40,8 @@ bool FlakeRef::operator ==(const FlakeRef & other) const
FlakeRef FlakeRef::resolve(ref<Store> store) const
{
- return FlakeRef(lookupInRegistries(store, input), subdir);
+ auto [input2, extraAttrs] = lookupInRegistries(store, input);
+ return FlakeRef(input2, fetchers::maybeGetStrAttr(extraAttrs, "subdir").value_or(subdir));
}
FlakeRef parseFlakeRef(
diff --git a/src/libexpr/primops/fetchTree.cc b/src/libexpr/primops/fetchTree.cc
index 8fa1f1a11..60bd2ed11 100644
--- a/src/libexpr/primops/fetchTree.cc
+++ b/src/libexpr/primops/fetchTree.cc
@@ -36,7 +36,7 @@ static void prim_fetchTree(EvalState & state, const Pos & pos, Value * * args, V
input = fetchers::inputFromURL(state.coerceToString(pos, *args[0], context, false, false));
if (!evalSettings.pureEval && !input->isDirect())
- input = lookupInRegistries(state.store, input);
+ input = lookupInRegistries(state.store, input).first;
if (evalSettings.pureEval && !input->isImmutable())
throw Error("in pure evaluation mode, 'fetchTree' requires an immutable input");