nix flake pin: Use lazyFetch()

This commit is contained in:
Eelco Dolstra 2022-07-25 15:44:45 +02:00
parent c0555c8e1f
commit 184c6605b0

View file

@ -183,14 +183,12 @@ struct CmdRegistryPin : RegistryCommand, EvalCommand
void run(nix::ref<nix::Store> store) override
{
if (locked.empty()) {
locked = url;
}
if (locked.empty()) locked = url;
auto registry = getRegistry();
auto ref = parseFlakeRef(url);
auto locked_ref = parseFlakeRef(locked);
auto lockedRef = parseFlakeRef(locked);
registry->remove(ref.input);
auto [tree, resolved] = locked_ref.resolve(store).input.fetch(store);
auto [accessor, resolved] = lockedRef.resolve(store).input.lazyFetch(store);
fetchers::Attrs extraAttrs;
if (ref.subdir != "") extraAttrs["dir"] = ref.subdir;
registry->add(ref.input, resolved, extraAttrs);