Added `callPackageWithSelfWith` and `callPackageWithSelf`
This commit is contained in:
parent
927c4f83d8
commit
af479c182f
|
@ -183,6 +183,15 @@ rec {
|
||||||
auto = builtins.intersectAttrs (builtins.functionArgs f) autoArgs;
|
auto = builtins.intersectAttrs (builtins.functionArgs f) autoArgs;
|
||||||
in makeOverridable f (auto // args);
|
in makeOverridable f (auto // args);
|
||||||
|
|
||||||
|
# Like `callPackageWith`, but provides the function with the `self`
|
||||||
|
# argument. `fn` is called with the new `self` whenever an override
|
||||||
|
# or extension is added.
|
||||||
|
callPackageWithSelfWith = autoArgs: fn: args:
|
||||||
|
let
|
||||||
|
f = if builtins.isFunction fn then fn else import fn;
|
||||||
|
auto = builtins.intersectAttrs (builtins.functionArgs f) autoArgs;
|
||||||
|
in makeOverridableWithSelf f (auto // args);
|
||||||
|
|
||||||
|
|
||||||
/* Like callPackage, but for a function that returns an attribute
|
/* Like callPackage, but for a function that returns an attribute
|
||||||
set of derivations. The override function is added to the
|
set of derivations. The override function is added to the
|
||||||
|
|
|
@ -79,7 +79,11 @@ in
|
||||||
# `newScope' for sets of packages in `pkgs' (see e.g. `gnome' below).
|
# `newScope' for sets of packages in `pkgs' (see e.g. `gnome' below).
|
||||||
callPackage = pkgs.newScope {};
|
callPackage = pkgs.newScope {};
|
||||||
|
|
||||||
|
callPackageWithSelf = pkgs.newScopeWithSelf {};
|
||||||
|
|
||||||
callPackages = lib.callPackagesWith splicedPackages;
|
callPackages = lib.callPackagesWith splicedPackages;
|
||||||
|
|
||||||
newScope = extra: lib.callPackageWith (splicedPackages // extra);
|
newScope = extra: lib.callPackageWith (splicedPackages // extra);
|
||||||
|
|
||||||
|
newScopeWithSelf = extra: lib.callPackageWithSelfWith (splicedPackages // extra);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue