From 1b494798360cca30971b43adda5baa154bf1991e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 18 Mar 2020 14:11:58 +0100 Subject: [PATCH] Remove flake closure caching This is not compatible with lazy flake input fetching. --- src/nix/installables.cc | 52 ----------------------------------------- 1 file changed, 52 deletions(-) diff --git a/src/nix/installables.cc b/src/nix/installables.cc index 3bf4fa8f4..64ea1e000 100644 --- a/src/nix/installables.cc +++ b/src/nix/installables.cc @@ -256,56 +256,6 @@ struct InstallableAttrPath : InstallableValue } }; -void makeFlakeClosureGCRoot(Store & store, - const FlakeRef & origFlakeRef, - const flake::LockedFlake & lockedFlake) -{ -#if 0 - if (std::get_if(&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> 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 InstallableFlake::getActualAttrPaths() { std::vector res; @@ -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);