diff --git a/src/libstore/fetchers/fetchers.cc b/src/libstore/fetchers/fetchers.cc
index 90bdc0fc5..0cc6f1c91 100644
--- a/src/libstore/fetchers/fetchers.cc
+++ b/src/libstore/fetchers/fetchers.cc
@@ -32,7 +32,12 @@ std::unique_ptr inputFromAttrs(const Input::Attrs & attrs)
{
for (auto & inputScheme : *inputSchemes) {
auto res = inputScheme->inputFromAttrs(attrs);
- if (res) return res;
+ if (res) {
+ if (auto narHash = maybeGetStrAttr(attrs, "narHash"))
+ // FIXME: require SRI hash.
+ res->narHash = Hash(*narHash);
+ return res;
+ }
}
throw Error("input '%s' is unsupported", attrsToJson(attrs));
}
@@ -106,8 +111,8 @@ std::pair> Input::fetchTree(ref store)
assert(input->narHash == tree.info.narHash);
if (narHash && narHash != input->narHash)
- throw Error("NAR hash mismatch in input '%s', expected '%s', got '%s'",
- to_string(), narHash->to_string(SRI), input->narHash->to_string(SRI));
+ throw Error("NAR hash mismatch in input '%s' (%s), expected '%s', got '%s'",
+ to_string(), tree.actualPath, narHash->to_string(SRI), input->narHash->to_string(SRI));
return {std::move(tree), input};
}
diff --git a/src/libstore/fetchers/tarball.cc b/src/libstore/fetchers/tarball.cc
index fc4d7542b..7c0b6690d 100644
--- a/src/libstore/fetchers/tarball.cc
+++ b/src/libstore/fetchers/tarball.cc
@@ -121,9 +121,7 @@ struct TarballInputScheme : InputScheme
if (auto hash = maybeGetStrAttr(attrs, "hash"))
// FIXME: require SRI hash.
input->hash = Hash(*hash);
- if (auto narHash = maybeGetStrAttr(attrs, "narHash"))
- // FIXME: require SRI hash.
- input->narHash = Hash(*narHash);
+
return input;
}
};