Skip to content

Commit

Permalink
Remove flake closure caching
Browse files Browse the repository at this point in the history
This is not compatible with lazy flake input fetching.
  • Loading branch information
edolstra committed Mar 18, 2020
1 parent 1e7ce1d commit 1b49479
Showing 1 changed file with 0 additions and 52 deletions.
52 changes: 0 additions & 52 deletions src/nix/installables.cc
Original file line number Diff line number Diff line change
Expand Up @@ -256,56 +256,6 @@ struct InstallableAttrPath : InstallableValue
}
};

void makeFlakeClosureGCRoot(Store & store,
const FlakeRef & origFlakeRef,
const flake::LockedFlake & lockedFlake)
{
#if 0
if (std::get_if<FlakeRef::IsPath>(&origFlakeRef.data)) return;

/* Get the store paths of all non-local flakes. */
StorePathSet closure;

assert(store.isValidPath(store.parseStorePath(lockedFlake.flake.sourceInfo.storePath)));
closure.insert(store.parseStorePath(lockedFlake.flake.sourceInfo.storePath));

std::queue<std::reference_wrapper<const flake::LockedInputs>> queue;
queue.push(lockedFlake.lockFile);

while (!queue.empty()) {
const flake::LockedInputs & flake = queue.front();
queue.pop();
/* Note: due to lazy fetching, these paths might not exist
yet. */
for (auto & dep : flake.inputs) {
auto path = dep.second.computeStorePath(store);
if (store.isValidPath(store.parseStorePath(path)))
closure.insert(store.parseStorePath(path));
queue.push(dep.second);
}
}

if (closure.empty()) return;

/* Write the closure to a file in the store. */
auto closurePath = store.addTextToStore("flake-closure",
concatStringsSep(" ", store.printStorePathSet(closure)), closure);

Path cacheDir = getCacheDir() + "/nix/flake-closures";
createDirs(cacheDir);

auto s = origFlakeRef.to_string();
assert(s[0] != '.');
s = replaceStrings(s, "%", "%25");
s = replaceStrings(s, "/", "%2f");
s = replaceStrings(s, ":", "%3a");
Path symlink = cacheDir + "/" + s;
debug("writing GC root '%s' for flake closure of '%s'", symlink, origFlakeRef);
replaceSymlink(store.printStorePath(closurePath), symlink);
store.addIndirectRoot(symlink);
#endif
}

std::vector<std::string> InstallableFlake::getActualAttrPaths()
{
std::vector<std::string> res;
Expand All @@ -325,8 +275,6 @@ Value * InstallableFlake::getFlakeOutputs(EvalState & state, const flake::Locked

callFlake(state, lockedFlake, *vFlake);

makeFlakeClosureGCRoot(*state.store, flakeRef, lockedFlake);

auto aOutputs = vFlake->attrs->get(state.symbols.create("outputs"));
assert(aOutputs);

Expand Down

0 comments on commit 1b49479

Please sign in to comment.