aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher League <league@contrapunctus.net>2021-11-03 09:25:27 -0400
committerChristopher League <league@contrapunctus.net>2021-11-03 09:25:27 -0400
commit3f070cc417ab71cf8b20d5a9db62ff515d209846 (patch)
tree56fc8c5fd5702b55f40ad511b6cc78b4aeb3a0a3
parent133905b309992b2ab0dbec2d2bdc4bcc9672c6b9 (diff)
In checkOverlay, accept underscored names for final/prev args.
Resolves #4416.
-rw-r--r--src/nix/flake.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nix/flake.cc b/src/nix/flake.cc
index 68bb76742..5855348ac 100644
--- a/src/nix/flake.cc
+++ b/src/nix/flake.cc
@@ -346,10 +346,14 @@ struct CmdFlakeCheck : FlakeCommand
auto checkOverlay = [&](const std::string & attrPath, Value & v, const Pos & pos) {
try {
state->forceValue(v, pos);
- if (!v.isLambda() || v.lambda.fun->hasFormals() || std::string(v.lambda.fun->arg) != "final")
+ if (!v.isLambda() || v.lambda.fun->hasFormals() ||
+ (std::string(v.lambda.fun->arg) != "final" &&
+ 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->hasFormals() || std::string(body->arg) != "prev")
+ if (!body || body->hasFormals() ||
+ (std::string(body->arg) != "prev" &&
+ 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.