summary refs log tree commit diff
path: root/lib/customisation.nix
diff options
context:
space:
mode:
authordanbst <abcz2.uprola@gmail.conf>2017-02-12 13:57:42 +0000
committerdanbst <abcz2.uprola@gmail.conf>2017-02-12 14:00:28 +0000
commit9d55479e07421d1c02c4bbab9508bf5d0913c21b (patch)
tree0151ce62ed406617cc26affa1bcd9b259c953731 /lib/customisation.nix
parent3fd44e2912795db39ad9c5c9bb977663a4d129c7 (diff)
downloadnixlib-9d55479e07421d1c02c4bbab9508bf5d0913c21b.tar
nixlib-9d55479e07421d1c02c4bbab9508bf5d0913c21b.tar.gz
nixlib-9d55479e07421d1c02c4bbab9508bf5d0913c21b.tar.bz2
nixlib-9d55479e07421d1c02c4bbab9508bf5d0913c21b.tar.lz
nixlib-9d55479e07421d1c02c4bbab9508bf5d0913c21b.tar.xz
nixlib-9d55479e07421d1c02c4bbab9508bf5d0913c21b.tar.zst
nixlib-9d55479e07421d1c02c4bbab9508bf5d0913c21b.zip
add .overrideDerivation and .overrideAttrs to packages created with `callPackages`/`callPackagesWith`
nix/nixUnstable, tomcatN and postgresqlNN use `callPackages` pattern, they have .override
attribute, but lack .overrideDerivation and recent .overrideAttrs.
Packages created with `callPackage` have all of those. Because .overrideDerivation function
is used in public, without this we can break code when refactoring callPackage -> callPackages.
Diffstat (limited to 'lib/customisation.nix')
-rw-r--r--lib/customisation.nix8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/customisation.nix b/lib/customisation.nix
index 41fe07fbd0a7..bedb91af7735 100644
--- a/lib/customisation.nix
+++ b/lib/customisation.nix
@@ -106,11 +106,9 @@ rec {
     let
       f = if builtins.isFunction fn then fn else import fn;
       auto = builtins.intersectAttrs (builtins.functionArgs f) autoArgs;
-      finalArgs = auto // args;
-      pkgs = f finalArgs;
-      mkAttrOverridable = name: pkg: pkg // {
-        override = newArgs: mkAttrOverridable name (f (finalArgs // newArgs)).${name};
-      };
+      origArgs = auto // args;
+      pkgs = f origArgs;
+      mkAttrOverridable = name: pkg: makeOverridable (newArgs: (f newArgs).${name}) origArgs;
     in lib.mapAttrs mkAttrOverridable pkgs;