aboutsummaryrefslogtreecommitdiff
path: root/src/nix/prefetch.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix/prefetch.cc')
-rw-r--r--src/nix/prefetch.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/nix/prefetch.cc b/src/nix/prefetch.cc
index 56e7bbb6e..3b2e225f6 100644
--- a/src/nix/prefetch.cc
+++ b/src/nix/prefetch.cc
@@ -27,7 +27,10 @@ std::string resolveMirrorUrl(EvalState & state, const std::string & url)
Value vMirrors;
// FIXME: use nixpkgs flake
- state.eval(state.parseExprFromString("import <nixpkgs/pkgs/build-support/fetchurl/mirrors.nix>", "."), vMirrors);
+ state.eval(state.parseExprFromString(
+ "import <nixpkgs/pkgs/build-support/fetchurl/mirrors.nix>",
+ state.rootPath(CanonPath::root)),
+ vMirrors);
state.forceAttrs(vMirrors, noPos, "while evaluating the set of all mirrors");
auto mirrorList = vMirrors.attrs->find(state.symbols.create(mirrorName));
@@ -198,9 +201,11 @@ static int main_nix_prefetch_url(int argc, char * * argv)
throw UsageError("you must specify a URL");
url = args[0];
} else {
- Path path = resolveExprPath(lookupFileArg(*state, args.empty() ? "." : args[0]));
Value vRoot;
- state->evalFile(path, vRoot);
+ state->evalFile(
+ resolveExprPath(
+ lookupFileArg(*state, args.empty() ? "." : args[0])),
+ vRoot);
Value & v(*findAlongAttrPath(*state, attrPath, autoArgs, vRoot).first);
state->forceAttrs(v, noPos, "while evaluating the source attribute to prefetch");