query
On this page

callPackagesWith

lib.customisation.callPackagesWith

Docs pulled from | This Revision | about 1 hour ago


Like callPackage, but for a function that returns an attribute set of derivations. The override function is added to the individual attributes.

Inputs

autoArgs

1. Function argument

fn

2. Function argument

args

3. Function argument

Type

callPackagesWith :: AttrSet -> ((AttrSet -> AttrSet) | Path) -> AttrSet -> AttrSet

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

callPackagesWith =
    autoArgs: fn: args:
    let
      f = if isFunction fn then fn else import fn;
      auto = intersectAttrs (functionArgs f) autoArgs;
      mirrorArgs = mirrorFunctionArgs f;
      origArgs = auto // args;
      pkgs = f origArgs;
      mkAttrOverridable = name: _: makeOverridable (mirrorArgs (newArgs: (f newArgs).${name})) origArgs;
    in
    if isDerivation pkgs then
      throw (
        "function `callPackages` was called on a *single* derivation "
        + ''"${pkgs.name or "<unknown-name>"}";''
        + " did you mean to use `callPackage` instead?"
      )
    else
      mapAttrs mkAttrOverridable pkgs;