mirror of
https://github.com/NixOS/nix.git
synced 2024-12-17 19:12:47 +00:00
error message formatting
This commit is contained in:
parent
9f2b25ce55
commit
d8ef423a18
@ -1366,14 +1366,15 @@ void EvalState::autoCallFunction(Bindings & args, Value & fun, Value & res)
|
||||
actualArgs->attrs->push_back(*j);
|
||||
} else if (!i.def) {
|
||||
throwUndefinedVarError(i.pos, R"(cannot auto-call a function that has an argument without a default value ('%1%')
|
||||
An 'auto-call' is when a nix expression is evaluated without any external arguments.
|
||||
If that nix expression is a function, and that function's arguments all have default
|
||||
values, then all is well.
|
||||
|
||||
But if the function arguments don't have default values, evaluation fails.
|
||||
An 'auto-call' is when a nix expression is evaluated without any external arguments.
|
||||
If that nix expression is a function, and that function's arguments all have default
|
||||
values, then all is well.
|
||||
|
||||
The classic case for this error is evaluating a nix file with nix-build that expects
|
||||
to be evaluated by callPackage.
|
||||
But if the function arguments don't have default values, evaluation fails.
|
||||
|
||||
The classic case for this error is evaluating a nix file with nix-build that expects
|
||||
to be evaluated by callPackage.
|
||||
# in 'callPackage' format: expression is a function that takes an argument 'stdenv'.
|
||||
# callPackage would implicitly pull 'stdenv' from nixpkgs, then call this function.
|
||||
{ stdenv }:
|
||||
@ -1387,8 +1388,8 @@ void EvalState::autoCallFunction(Bindings & args, Value & fun, Value & res)
|
||||
nixpkgs.stdenv.mkDerivation {
|
||||
...
|
||||
|
||||
See this nix pill for more information re callPackage format:
|
||||
https://nixos.org/guides/nix-pills/callpackage-design-pattern.html)", i.name);
|
||||
More about callPackage:
|
||||
https://nixos.org/guides/nix-pills/callpackage-design-pattern.html)", i.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user