mirror of
https://github.com/NixOS/nix.git
synced 2025-11-11 21:16:02 +01:00
Merge pull request #134 from DeterminateSystems/nix-flake-check-dont-build
nix flake check: Skip substitutable derivations
This commit is contained in:
commit
668088b876
1 changed files with 24 additions and 1 deletions
|
|
@ -833,8 +833,31 @@ struct CmdFlakeCheck : FlakeCommand
|
||||||
if (build && !drvPaths.empty()) {
|
if (build && !drvPaths.empty()) {
|
||||||
Activity act(*logger, lvlInfo, actUnknown,
|
Activity act(*logger, lvlInfo, actUnknown,
|
||||||
fmt("running %d flake checks", drvPaths.size()));
|
fmt("running %d flake checks", drvPaths.size()));
|
||||||
store->buildPaths(drvPaths);
|
|
||||||
|
auto missing = store->queryMissing(drvPaths);
|
||||||
|
|
||||||
|
/* This command doesn't need to actually substitute
|
||||||
|
derivation outputs if they're missing but
|
||||||
|
substitutable. So filter out derivations that are
|
||||||
|
substitutable or already built. */
|
||||||
|
std::vector<DerivedPath> toBuild;
|
||||||
|
for (auto & path : drvPaths) {
|
||||||
|
std::visit(overloaded {
|
||||||
|
[&](const DerivedPath::Built & bfd) {
|
||||||
|
auto drvPathP = std::get_if<DerivedPath::Opaque>(&*bfd.drvPath);
|
||||||
|
if (!drvPathP || missing.willBuild.contains(drvPathP->path))
|
||||||
|
toBuild.push_back(path);
|
||||||
|
},
|
||||||
|
[&](const DerivedPath::Opaque & bo) {
|
||||||
|
if (!missing.willSubstitute.contains(bo.path))
|
||||||
|
toBuild.push_back(path);
|
||||||
|
},
|
||||||
|
}, path.raw());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
store->buildPaths(toBuild);
|
||||||
|
}
|
||||||
|
|
||||||
if (hasErrors)
|
if (hasErrors)
|
||||||
throw Error("some errors were encountered during the evaluation");
|
throw Error("some errors were encountered during the evaluation");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue