forked from lix-project/lix
Log what nix flake check
does
There's still room for improvement, but this produces much more
informative output with `-v`:
```
$ nix flake check -v
evaluating flake...
checking flake output 'checks'...
checking derivation checks.aarch64-darwin.ghcid-ng-tests...
checking derivation checks.aarch64-darwin.ghcid-ng-clippy...
checking derivation checks.aarch64-darwin.ghcid-ng-doc...
checking derivation checks.aarch64-darwin.ghcid-ng-fmt...
checking derivation checks.aarch64-darwin.ghcid-ng-audit...
checking flake output 'packages'...
checking derivation packages.aarch64-darwin.ghcid-ng...
checking derivation packages.aarch64-darwin.ghcid-ng-tests...
checking derivation packages.aarch64-darwin.default...
checking flake output 'apps'...
checking flake output 'devShells'...
checking derivation devShells.aarch64-darwin.default...
running flake checks...
warning: The check omitted these incompatible systems: aarch64-linux, x86_64-darwin, x86_64-linux
Use '--all-systems' to check all.
```
(cherry picked from commit 49221493e243c4d10e69e7465a21be53902e16a8)
Change-Id: Ib1d58fe48cc82f4801a2ee5f91ba0d5a74907c0b
This commit is contained in:
parent
1342c8f18e
commit
2020998cfd
|
@ -354,6 +354,8 @@ struct CmdFlakeCheck : FlakeCommand
|
||||||
|
|
||||||
auto checkDerivation = [&](const std::string & attrPath, Value & v, const PosIdx pos) -> std::optional<StorePath> {
|
auto checkDerivation = [&](const std::string & attrPath, Value & v, const PosIdx pos) -> std::optional<StorePath> {
|
||||||
try {
|
try {
|
||||||
|
Activity act(*logger, lvlInfo, actUnknown,
|
||||||
|
fmt("checking derivation %s", attrPath));
|
||||||
auto drvInfo = getDerivation(*state, v, false);
|
auto drvInfo = getDerivation(*state, v, false);
|
||||||
if (!drvInfo)
|
if (!drvInfo)
|
||||||
throw Error("flake attribute '%s' is not a derivation", attrPath);
|
throw Error("flake attribute '%s' is not a derivation", attrPath);
|
||||||
|
@ -386,6 +388,8 @@ struct CmdFlakeCheck : FlakeCommand
|
||||||
|
|
||||||
auto checkOverlay = [&](const std::string & attrPath, Value & v, const PosIdx pos) {
|
auto checkOverlay = [&](const std::string & attrPath, Value & v, const PosIdx pos) {
|
||||||
try {
|
try {
|
||||||
|
Activity act(*logger, lvlInfo, actUnknown,
|
||||||
|
fmt("checking overlay %s", attrPath));
|
||||||
state->forceValue(v, pos);
|
state->forceValue(v, pos);
|
||||||
if (!v.isLambda()) {
|
if (!v.isLambda()) {
|
||||||
throw Error("overlay is not a function, but %s instead", showType(v));
|
throw Error("overlay is not a function, but %s instead", showType(v));
|
||||||
|
@ -408,6 +412,8 @@ struct CmdFlakeCheck : FlakeCommand
|
||||||
|
|
||||||
auto checkModule = [&](const std::string & attrPath, Value & v, const PosIdx pos) {
|
auto checkModule = [&](const std::string & attrPath, Value & v, const PosIdx pos) {
|
||||||
try {
|
try {
|
||||||
|
Activity act(*logger, lvlInfo, actUnknown,
|
||||||
|
fmt("checking NixOS module %s", attrPath));
|
||||||
state->forceValue(v, pos);
|
state->forceValue(v, pos);
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
e.addTrace(resolve(pos), hintfmt("while checking the NixOS module '%s'", attrPath));
|
e.addTrace(resolve(pos), hintfmt("while checking the NixOS module '%s'", attrPath));
|
||||||
|
@ -419,6 +425,8 @@ struct CmdFlakeCheck : FlakeCommand
|
||||||
|
|
||||||
checkHydraJobs = [&](const std::string & attrPath, Value & v, const PosIdx pos) {
|
checkHydraJobs = [&](const std::string & attrPath, Value & v, const PosIdx pos) {
|
||||||
try {
|
try {
|
||||||
|
Activity act(*logger, lvlInfo, actUnknown,
|
||||||
|
fmt("checking Hydra job %s", attrPath));
|
||||||
state->forceAttrs(v, pos, "");
|
state->forceAttrs(v, pos, "");
|
||||||
|
|
||||||
if (state->isDerivation(v))
|
if (state->isDerivation(v))
|
||||||
|
@ -428,7 +436,7 @@ struct CmdFlakeCheck : FlakeCommand
|
||||||
state->forceAttrs(*attr.value, attr.pos, "");
|
state->forceAttrs(*attr.value, attr.pos, "");
|
||||||
auto attrPath2 = concatStrings(attrPath, ".", state->symbols[attr.name]);
|
auto attrPath2 = concatStrings(attrPath, ".", state->symbols[attr.name]);
|
||||||
if (state->isDerivation(*attr.value)) {
|
if (state->isDerivation(*attr.value)) {
|
||||||
Activity act(*logger, lvlChatty, actUnknown,
|
Activity act(*logger, lvlInfo, actUnknown,
|
||||||
fmt("checking Hydra job '%s'", attrPath2));
|
fmt("checking Hydra job '%s'", attrPath2));
|
||||||
checkDerivation(attrPath2, *attr.value, attr.pos);
|
checkDerivation(attrPath2, *attr.value, attr.pos);
|
||||||
} else
|
} else
|
||||||
|
@ -443,7 +451,7 @@ struct CmdFlakeCheck : FlakeCommand
|
||||||
|
|
||||||
auto checkNixOSConfiguration = [&](const std::string & attrPath, Value & v, const PosIdx pos) {
|
auto checkNixOSConfiguration = [&](const std::string & attrPath, Value & v, const PosIdx pos) {
|
||||||
try {
|
try {
|
||||||
Activity act(*logger, lvlChatty, actUnknown,
|
Activity act(*logger, lvlInfo, actUnknown,
|
||||||
fmt("checking NixOS configuration '%s'", attrPath));
|
fmt("checking NixOS configuration '%s'", attrPath));
|
||||||
Bindings & bindings(*state->allocBindings(0));
|
Bindings & bindings(*state->allocBindings(0));
|
||||||
auto vToplevel = findAlongAttrPath(*state, "config.system.build.toplevel", bindings, v).first;
|
auto vToplevel = findAlongAttrPath(*state, "config.system.build.toplevel", bindings, v).first;
|
||||||
|
@ -458,7 +466,7 @@ struct CmdFlakeCheck : FlakeCommand
|
||||||
|
|
||||||
auto checkTemplate = [&](const std::string & attrPath, Value & v, const PosIdx pos) {
|
auto checkTemplate = [&](const std::string & attrPath, Value & v, const PosIdx pos) {
|
||||||
try {
|
try {
|
||||||
Activity act(*logger, lvlChatty, actUnknown,
|
Activity act(*logger, lvlInfo, actUnknown,
|
||||||
fmt("checking template '%s'", attrPath));
|
fmt("checking template '%s'", attrPath));
|
||||||
|
|
||||||
state->forceAttrs(v, pos, "");
|
state->forceAttrs(v, pos, "");
|
||||||
|
@ -492,6 +500,8 @@ struct CmdFlakeCheck : FlakeCommand
|
||||||
|
|
||||||
auto checkBundler = [&](const std::string & attrPath, Value & v, const PosIdx pos) {
|
auto checkBundler = [&](const std::string & attrPath, Value & v, const PosIdx pos) {
|
||||||
try {
|
try {
|
||||||
|
Activity act(*logger, lvlInfo, actUnknown,
|
||||||
|
fmt("checking bundler %s", attrPath));
|
||||||
state->forceValue(v, pos);
|
state->forceValue(v, pos);
|
||||||
if (!v.isLambda())
|
if (!v.isLambda())
|
||||||
throw Error("bundler must be a function");
|
throw Error("bundler must be a function");
|
||||||
|
@ -511,7 +521,7 @@ struct CmdFlakeCheck : FlakeCommand
|
||||||
enumerateOutputs(*state,
|
enumerateOutputs(*state,
|
||||||
*vFlake,
|
*vFlake,
|
||||||
[&](const std::string & name, Value & vOutput, const PosIdx pos) {
|
[&](const std::string & name, Value & vOutput, const PosIdx pos) {
|
||||||
Activity act(*logger, lvlChatty, actUnknown,
|
Activity act(*logger, lvlInfo, actUnknown,
|
||||||
fmt("checking flake output '%s'", name));
|
fmt("checking flake output '%s'", name));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue