Skip to content

Commit

Permalink
Print derivation paths
Browse files Browse the repository at this point in the history
Also be more consistent with quotes around attribute paths
  • Loading branch information
9999years committed Jan 20, 2024
1 parent 4922149 commit 9404ce3
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/nix/flake.cc
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,16 @@ struct CmdFlakeCheck : FlakeCommand
auto packageInfo = getDerivation(*state, v, false);
if (!packageInfo)
throw Error("flake attribute '%s' is not a derivation", attrPath);
// FIXME: check meta attributes
return packageInfo->queryDrvPath();
else {
// FIXME: check meta attributes
auto storePath = packageInfo->queryDrvPath();
if (storePath) {
logger->log(lvlInfo,
fmt("derivation evaluated to %s",
store->printStorePath(storePath.value())));
}
return storePath;
}
} catch (Error & e) {
e.addTrace(resolve(pos), hintfmt("while checking the derivation '%s'", attrPath));
reportError(e);
Expand Down Expand Up @@ -430,7 +438,7 @@ struct CmdFlakeCheck : FlakeCommand
auto checkOverlay = [&](const std::string & attrPath, Value & v, const PosIdx pos) {
try {
Activity act(*logger, lvlInfo, actUnknown,
fmt("checking overlay %s", attrPath));
fmt("checking overlay '%s'", attrPath));
state->forceValue(v, pos);
if (!v.isLambda()) {
throw Error("overlay is not a function, but %s instead", showType(v));
Expand All @@ -454,7 +462,7 @@ struct CmdFlakeCheck : FlakeCommand
auto checkModule = [&](const std::string & attrPath, Value & v, const PosIdx pos) {
try {
Activity act(*logger, lvlInfo, actUnknown,
fmt("checking NixOS module %s", attrPath));
fmt("checking NixOS module '%s'", attrPath));
state->forceValue(v, pos);
} catch (Error & e) {
e.addTrace(resolve(pos), hintfmt("while checking the NixOS module '%s'", attrPath));
Expand All @@ -466,8 +474,6 @@ struct CmdFlakeCheck : FlakeCommand

checkHydraJobs = [&](const std::string & attrPath, Value & v, const PosIdx pos) {
try {
Activity act(*logger, lvlInfo, actUnknown,
fmt("checking Hydra job %s", attrPath));
state->forceAttrs(v, pos, "");

if (state->isDerivation(v))
Expand Down Expand Up @@ -542,7 +548,7 @@ struct CmdFlakeCheck : FlakeCommand
auto checkBundler = [&](const std::string & attrPath, Value & v, const PosIdx pos) {
try {
Activity act(*logger, lvlInfo, actUnknown,
fmt("checking bundler %s", attrPath));
fmt("checking bundler '%s'", attrPath));
state->forceValue(v, pos);
if (!v.isLambda())
throw Error("bundler must be a function");
Expand Down

0 comments on commit 9404ce3

Please sign in to comment.