File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -833,8 +833,31 @@ struct CmdFlakeCheck : FlakeCommand
833833 if (build && !drvPaths.empty ()) {
834834 Activity act (*logger, lvlInfo, actUnknown,
835835 fmt (" running %d flake checks" , drvPaths.size ()));
836- store->buildPaths (drvPaths);
836+
837+ auto missing = store->queryMissing (drvPaths);
838+
839+ /* This command doesn't need to actually substitute
840+ derivation outputs if they're missing but
841+ substitutable. So filter out derivations that are
842+ substitutable or already built. */
843+ std::vector<DerivedPath> toBuild;
844+ for (auto & path : drvPaths) {
845+ std::visit (overloaded {
846+ [&](const DerivedPath::Built & bfd) {
847+ auto drvPathP = std::get_if<DerivedPath::Opaque>(&*bfd.drvPath );
848+ if (!drvPathP || missing.willBuild .contains (drvPathP->path ))
849+ toBuild.push_back (path);
850+ },
851+ [&](const DerivedPath::Opaque & bo) {
852+ if (!missing.willSubstitute .contains (bo.path ))
853+ toBuild.push_back (path);
854+ },
855+ }, path.raw ());
856+ }
857+
858+ store->buildPaths (toBuild);
837859 }
860+
838861 if (hasErrors)
839862 throw Error (" some errors were encountered during the evaluation" );
840863
You can’t perform that action at this time.
0 commit comments