Skip to content

Commit ae14113

Browse files
authored
Merge pull request NixOS#5477 from league/check-overlay-args
In checkOverlay, accept underscored names for final/prev args.
2 parents f1c9ee0 + 3f070cc commit ae14113

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/nix/flake.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,14 @@ struct CmdFlakeCheck : FlakeCommand
346346
auto checkOverlay = [&](const std::string & attrPath, Value & v, const Pos & pos) {
347347
try {
348348
state->forceValue(v, pos);
349-
if (!v.isLambda() || v.lambda.fun->hasFormals() || std::string(v.lambda.fun->arg) != "final")
349+
if (!v.isLambda() || v.lambda.fun->hasFormals() ||
350+
(std::string(v.lambda.fun->arg) != "final" &&
351+
std::string(v.lambda.fun->arg) != "_final"))
350352
throw Error("overlay does not take an argument named 'final'");
351353
auto body = dynamic_cast<ExprLambda *>(v.lambda.fun->body);
352-
if (!body || body->hasFormals() || std::string(body->arg) != "prev")
354+
if (!body || body->hasFormals() ||
355+
(std::string(body->arg) != "prev" &&
356+
std::string(body->arg) != "_prev"))
353357
throw Error("overlay does not take an argument named 'prev'");
354358
// FIXME: if we have a 'nixpkgs' input, use it to
355359
// evaluate the overlay.

0 commit comments

Comments
 (0)