diff --git a/lix/nix/flake.cc b/lix/nix/flake.cc index 599e258cb..f8419f910 100644 --- a/lix/nix/flake.cc +++ b/lix/nix/flake.cc @@ -391,14 +391,6 @@ struct CmdFlakeCheck : FlakeCommand return evaluator->positions[p]; }; - auto argHasName = [&] (Symbol arg, std::string_view expected) { - std::string_view name = evaluator->symbols[arg]; - return - name == expected - || name == "_" - || (name.starts_with("_") && name.substr(1) == expected); - }; - auto checkSystemName = [&](const std::string & system, const PosIdx pos) { // FIXME: what's the format of "system"? if (system.find('-') == std::string::npos) @@ -464,14 +456,11 @@ struct CmdFlakeCheck : FlakeCommand if (!v.isLambda()) { throw Error("overlay is not a function, but %s instead", showType(v)); } - if (v.lambda.fun->hasFormals() - || !argHasName(v.lambda.fun->arg, "final")) - throw Error("overlay does not take an argument named 'final'"); auto body = dynamic_cast(v.lambda.fun->body.get()); - if (!body - || body->hasFormals() - || !argHasName(body->arg, "prev")) - throw Error("overlay does not take an argument named 'prev'"); + if (!body) + throw Error("overlay is not a function with two arguments, but only takes one"); + if (dynamic_cast(body->body.get())) + throw Error("overlay is not a function with two arguments, but takes more than two"); // FIXME: if we have a 'nixpkgs' input, use it to // evaluate the overlay. } catch (Error & e) { diff --git a/tests/functional/flakes/check.sh b/tests/functional/flakes/check.sh index 0433e5335..fefaae9dd 100644 --- a/tests/functional/flakes/check.sh +++ b/tests/functional/flakes/check.sh @@ -23,6 +23,28 @@ cat > $flakeDir/flake.nix < $flakeDir/flake.nix < $flakeDir/flake.nix < $flakeDir/flake.nix <