1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 09:31:16 +02:00

nix flake check: Check apps

This commit is contained in:
Eelco Dolstra 2019-06-17 17:59:57 +02:00
parent 3b2ebd029c
commit 9d1207c02c
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
4 changed files with 47 additions and 21 deletions

View file

@ -51,21 +51,20 @@ void EvalState::realiseContext(const PathSet & context)
PathSet drvs;
for (auto & i : context) {
std::pair<string, string> decoded = decodeContext(i);
Path ctx = decoded.first;
auto [ctx, outputName] = decodeContext(i);
assert(store->isStorePath(ctx));
if (!store->isValidPath(ctx))
throw InvalidPathError(ctx);
if (!decoded.second.empty() && nix::isDerivation(ctx)) {
drvs.insert(decoded.first + "!" + decoded.second);
if (!outputName.empty() && nix::isDerivation(ctx)) {
drvs.insert(ctx + "!" + outputName);
/* Add the output of this derivation to the allowed
paths. */
if (allowedPaths) {
auto drv = store->derivationFromPath(decoded.first);
DerivationOutputs::iterator i = drv.outputs.find(decoded.second);
auto drv = store->derivationFromPath(ctx);
DerivationOutputs::iterator i = drv.outputs.find(outputName);
if (i == drv.outputs.end())
throw Error("derivation '%s' does not have an output named '%s'", decoded.first, decoded.second);
throw Error("derivation '%s' does not have an output named '%s'", ctx, outputName);
allowedPaths->insert(i->second.path);
}
}
@ -80,6 +79,7 @@ void EvalState::realiseContext(const PathSet & context)
PathSet willBuild, willSubstitute, unknown;
unsigned long long downloadSize, narSize;
store->queryMissing(drvs, willBuild, willSubstitute, unknown, downloadSize, narSize);
store->buildPaths(drvs);
}