mirror of
https://github.com/NixOS/nix
synced 2025-06-30 11:43:15 +02:00
Unified fetcher caching system
This commit is contained in:
parent
fbcb897e21
commit
2a4e4f6a6e
20 changed files with 425 additions and 197 deletions
|
@ -44,7 +44,7 @@ MixEvalArgs::MixEvalArgs()
|
|||
.handler([&](std::vector<std::string> ss) {
|
||||
auto from = parseFlakeRef(ss[0], absPath("."));
|
||||
auto to = parseFlakeRef(ss[1], absPath("."));
|
||||
fetchers::Input::Attrs extraAttrs;
|
||||
fetchers::Attrs extraAttrs;
|
||||
if (to.subdir != "") extraAttrs["dir"] = to.subdir;
|
||||
fetchers::overrideRegistry(from.input, to.input, extraAttrs);
|
||||
});
|
||||
|
|
|
@ -132,10 +132,10 @@ static FlakeInput parseFlakeInput(EvalState & state,
|
|||
auto sFlake = state.symbols.create("flake");
|
||||
auto sFollows = state.symbols.create("follows");
|
||||
|
||||
fetchers::Input::Attrs attrs;
|
||||
fetchers::Attrs attrs;
|
||||
std::optional<std::string> url;
|
||||
|
||||
for (Attr attr : *(value->attrs)) {
|
||||
for (nix::Attr attr : *(value->attrs)) {
|
||||
try {
|
||||
if (attr.name == sUrl || attr.name == sUri) {
|
||||
expectType(state, tString, *attr.value, *attr.pos);
|
||||
|
@ -188,7 +188,7 @@ static std::map<FlakeId, FlakeInput> parseFlakeInputs(
|
|||
|
||||
expectType(state, tAttrs, *value, pos);
|
||||
|
||||
for (Attr & inputAttr : *(*value).attrs) {
|
||||
for (nix::Attr & inputAttr : *(*value).attrs) {
|
||||
inputs.emplace(inputAttr.name,
|
||||
parseFlakeInput(state,
|
||||
inputAttr.name,
|
||||
|
|
|
@ -19,7 +19,7 @@ std::string FlakeRef::to_string() const
|
|||
return input->to_string();
|
||||
}
|
||||
|
||||
fetchers::Input::Attrs FlakeRef::toAttrs() const
|
||||
fetchers::Attrs FlakeRef::toAttrs() const
|
||||
{
|
||||
auto attrs = input->toAttrs();
|
||||
if (subdir != "")
|
||||
|
@ -168,7 +168,7 @@ std::optional<std::pair<FlakeRef, std::string>> maybeParseFlakeRefWithFragment(
|
|||
}
|
||||
}
|
||||
|
||||
FlakeRef FlakeRef::fromAttrs(const fetchers::Input::Attrs & attrs)
|
||||
FlakeRef FlakeRef::fromAttrs(const fetchers::Attrs & attrs)
|
||||
{
|
||||
auto attrs2(attrs);
|
||||
attrs2.erase("dir");
|
||||
|
|
|
@ -29,11 +29,11 @@ struct FlakeRef
|
|||
// FIXME: change to operator <<.
|
||||
std::string to_string() const;
|
||||
|
||||
fetchers::Input::Attrs toAttrs() const;
|
||||
fetchers::Attrs toAttrs() const;
|
||||
|
||||
FlakeRef resolve(ref<Store> store) const;
|
||||
|
||||
static FlakeRef fromAttrs(const fetchers::Input::Attrs & attrs);
|
||||
static FlakeRef fromAttrs(const fetchers::Attrs & attrs);
|
||||
|
||||
std::pair<fetchers::Tree, FlakeRef> fetchTree(ref<Store> store) const;
|
||||
};
|
||||
|
|
|
@ -52,7 +52,7 @@ static void prim_fetchTree(EvalState & state, const Pos & pos, Value * * args, V
|
|||
if (args[0]->type == tAttrs) {
|
||||
state.forceAttrs(*args[0], pos);
|
||||
|
||||
fetchers::Input::Attrs attrs;
|
||||
fetchers::Attrs attrs;
|
||||
|
||||
for (auto & attr : *args[0]->attrs) {
|
||||
state.forceValue(*attr.value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue