From 9d55479e07421d1c02c4bbab9508bf5d0913c21b Mon Sep 17 00:00:00 2001 From: danbst Date: Sun, 12 Feb 2017 13:57:42 +0000 Subject: [PATCH] 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. --- lib/customisation.nix | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/customisation.nix b/lib/customisation.nix index 41fe07fbd0a..bedb91af773 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;