callPackage
pkgs.emacsPackages.callPackage
Docs pulled from | This Revision | about 1 hour ago
Contribute
Enhance the ecosystem with your expertise! Contribute to fill the gaps in documentation. Your input can make a difference.
- Write API documentation for this function
Learn how to write documentation
- Improve position tracking
Contribute to Noogle
Noogle detected
- pkgs.agdaPackages.callPackage
- pkgs.dhallPackages.callPackage
- pkgs.dotnetCorePackages.callPackage
- pkgs.elmPackages.callPackage
- pkgs.callPackage
- pkgs.python3Packages.callPackage
- pkgs.rustPackages.callPackage
- pkgs.rustPackages.buildRustPackages.callPackage
- pkgs.rustPackages.rustPlatform.callPackage
- pkgs.rustPackages.buildRustPackages.rustPlatform.callPackage
Implementation
The following is the current implementation of this function.
fn: args:
let
f = if isFunction fn then fn else import fn;
fargs = functionArgs f;
# All arguments that will be passed to the function
# This includes automatic ones and ones passed explicitly
allArgs = intersectAttrs fargs autoArgs // args;
# arguments that weren't passed automatically to the function
unpassedArgs = removeAttrs fargs (attrNames allArgs);
in
# if nonempty, check if the function has defaults for those other args
if unpassedArgs == { } || all (value: value) (attrValues unpassedArgs) then
makeOverridable f allArgs
else
# Only show the error for the first missing argument
# This needs to be an abort so it can't be caught with `builtins.tryEval`,
# which is used by nix-env and ofborg to filter out packages that don't evaluate.
# This way we're forced to fix such errors in Nixpkgs,
# which is especially relevant with allowAliases = false
abort (makeErrorMessage autoArgs fn args fargs unpassedArgs)