diff options
author | Will Fancher <elvishjerricco@gmail.com> | 2017-07-11 22:27:05 -0400 |
---|---|---|
committer | Will Fancher <elvishjerricco@gmail.com> | 2017-07-12 18:35:23 -0400 |
commit | af479c182ff0391aefd070f5219e79d15d655c75 (patch) | |
tree | bb25533c66e172dc4b4bebc6afb5cd696714f558 /lib/customisation.nix | |
parent | 927c4f83d8d62b45229a931d9c295ad9a2d6d541 (diff) | |
download | nixpkgs-af479c182ff0391aefd070f5219e79d15d655c75.tar nixpkgs-af479c182ff0391aefd070f5219e79d15d655c75.tar.gz nixpkgs-af479c182ff0391aefd070f5219e79d15d655c75.tar.bz2 nixpkgs-af479c182ff0391aefd070f5219e79d15d655c75.tar.lz nixpkgs-af479c182ff0391aefd070f5219e79d15d655c75.tar.xz nixpkgs-af479c182ff0391aefd070f5219e79d15d655c75.tar.zst nixpkgs-af479c182ff0391aefd070f5219e79d15d655c75.zip |
Added `callPackageWithSelfWith` and `callPackageWithSelf`
Diffstat (limited to 'lib/customisation.nix')
-rw-r--r-- | lib/customisation.nix | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/customisation.nix b/lib/customisation.nix index 124e8596f49..66260c8a486 100644 --- a/lib/customisation.nix +++ b/lib/customisation.nix @@ -183,6 +183,15 @@ rec { auto = builtins.intersectAttrs (builtins.functionArgs f) autoArgs; 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 set of derivations. The override function is added to the |