Set lockedRef correctly

This commit is contained in:
Eelco Dolstra 2022-05-20 15:47:08 +02:00
parent 885a09c3fa
commit ad4b7669db
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
3 changed files with 12 additions and 3 deletions

View file

@ -203,6 +203,7 @@ static Flake readFlake(
EvalState & state, EvalState & state,
const FlakeRef & originalRef, const FlakeRef & originalRef,
const FlakeRef & resolvedRef, const FlakeRef & resolvedRef,
const FlakeRef & lockedRef,
InputAccessor & accessor, InputAccessor & accessor,
const InputPath & lockRootPath) const InputPath & lockRootPath)
{ {
@ -220,7 +221,7 @@ static Flake readFlake(
Flake flake { Flake flake {
.originalRef = originalRef, .originalRef = originalRef,
.resolvedRef = resolvedRef, .resolvedRef = resolvedRef,
.lockedRef = resolvedRef, // FIXME .lockedRef = lockedRef,
.path = flakePath, .path = flakePath,
}; };
@ -319,9 +320,9 @@ static Flake getFlake(
resolvedRef = originalRef.resolve(state.store); resolvedRef = originalRef.resolve(state.store);
} }
auto [accessor, input] = resolvedRef.input.lazyFetch(state.store); auto [accessor, lockedRef] = resolvedRef.lazyFetch(state.store);
return readFlake(state, originalRef, resolvedRef, state.registerAccessor(accessor), lockRootPath); return readFlake(state, originalRef, resolvedRef, lockedRef, state.registerAccessor(accessor), lockRootPath);
} }
Flake getFlake(EvalState & state, const FlakeRef & originalRef, bool allowLookup, FlakeCache & flakeCache) Flake getFlake(EvalState & state, const FlakeRef & originalRef, bool allowLookup, FlakeCache & flakeCache)

View file

@ -238,6 +238,12 @@ std::pair<fetchers::Tree, FlakeRef> FlakeRef::fetchTree(ref<Store> store) const
return {std::move(tree), FlakeRef(std::move(lockedInput), subdir)}; return {std::move(tree), FlakeRef(std::move(lockedInput), subdir)};
} }
std::pair<ref<InputAccessor>, FlakeRef> FlakeRef::lazyFetch(ref<Store> store) const
{
auto [accessor, lockedInput] = input.lazyFetch(store);
return {accessor, FlakeRef(std::move(lockedInput), subdir)};
}
std::tuple<FlakeRef, std::string, OutputsSpec> parseFlakeRefWithFragmentAndOutputsSpec( std::tuple<FlakeRef, std::string, OutputsSpec> parseFlakeRefWithFragmentAndOutputsSpec(
const std::string & url, const std::string & url,
const std::optional<Path> & baseDir, const std::optional<Path> & baseDir,

View file

@ -58,6 +58,8 @@ struct FlakeRef
static FlakeRef fromAttrs(const fetchers::Attrs & attrs); static FlakeRef fromAttrs(const fetchers::Attrs & attrs);
std::pair<fetchers::Tree, FlakeRef> fetchTree(ref<Store> store) const; std::pair<fetchers::Tree, FlakeRef> fetchTree(ref<Store> store) const;
std::pair<ref<InputAccessor>, FlakeRef> lazyFetch(ref<Store> store) const;
}; };
std::ostream & operator << (std::ostream & str, const FlakeRef & flakeRef); std::ostream & operator << (std::ostream & str, const FlakeRef & flakeRef);