mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 14:36:16 +02:00
nix flake check: Check overlays
This commit is contained in:
parent
f97d3753a1
commit
dc3f52a144
1 changed files with 19 additions and 0 deletions
|
@ -280,6 +280,22 @@ struct CmdFlakeCheck : FlakeCommand, MixJSON
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto checkOverlay = [&](const std::string & attrPath, Value & v) {
|
||||||
|
try {
|
||||||
|
state->forceValue(v);
|
||||||
|
if (v.type != tLambda || v.lambda.fun->matchAttrs || std::string(v.lambda.fun->arg) != "final")
|
||||||
|
throw Error("overlay does not take an argument named 'final'");
|
||||||
|
auto body = dynamic_cast<ExprLambda *>(v.lambda.fun->body);
|
||||||
|
if (!body || body->matchAttrs || std::string(body->arg) != "prev")
|
||||||
|
throw Error("overlay does not take an argument named 'prev'");
|
||||||
|
// FIXME: if we have a 'nixpkgs' input, use it to
|
||||||
|
// evaluate the overlay.
|
||||||
|
} catch (Error & e) {
|
||||||
|
e.addPrefix(fmt("while checking the overlay '" ANSI_BOLD "%s" ANSI_NORMAL "':\n", attrPath));
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
{
|
{
|
||||||
Activity act(*logger, lvlInfo, actUnknown, "evaluating flake");
|
Activity act(*logger, lvlInfo, actUnknown, "evaluating flake");
|
||||||
|
|
||||||
|
@ -326,6 +342,9 @@ struct CmdFlakeCheck : FlakeCommand, MixJSON
|
||||||
// FIXME: do getDerivations?
|
// FIXME: do getDerivations?
|
||||||
;
|
;
|
||||||
|
|
||||||
|
else if (name == "overlay")
|
||||||
|
checkOverlay(name, vProvide);
|
||||||
|
|
||||||
else
|
else
|
||||||
warn("unknown flake output '%s'", name);
|
warn("unknown flake output '%s'", name);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue