To call the Nix function, which uses the specified destructuring, you need to pass it a set with exactly those keys that it needs, no more and no less:
nix-repl> ({ a }: a) { a = 4; b = 5; }
error: anonymous function at (string):1:2 called with unexpected argument ‘b’, at (string):1:1
The exception is that the argument list of the function contains an ellipsis at the end:
nix-repl> ({ a, ... }: a) { a = 4; b = 5; }
4
However, most packages in nixpkgs consist of a file default.nixcontaining a function that is not defined using this ellipsis. However, somehow, when you use it callPackage, it manages to call these functions and pass them only the arguments that they need. How is this implemented?
source
share