From 5e3ce6334c5c4fbec260f71e69f02493403aa2eb Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Sun, 20 Mar 2016 15:27:14 +0000 Subject: [PATCH] Remove applyGlobalOverrides's pkgsOrig argument. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch change the behaviour or overridePackages: - Before, overridePackages was based on top of the set of packages overriden by `~/.nixpkgs/config.nix` file. - After, overridePackages should when given a function f, behave almost¹ the same as-if the packageOverrides attribute of `~/.nixpkgs/config.nix` file attribute was set to f, assuming that we ignore the extra `self` argument. ¹ It is not yet exactly the same because we have many paths which are re-entering nixpkgs while taking the default attributes, such as the bootstrap phase of stdenv. Thus if the nixpkgs configuration overrides any of the dependencies need for the bootstrap, then we might get different sha. --- pkgs/top-level/all-packages.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5f94da4b6e40..614978b011d7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -95,7 +95,7 @@ let # (un-overriden) set of packages, allowing packageOverrides # attributes to refer to the original attributes (e.g. "foo = # ... pkgs.foo ..."). - pkgs = applyGlobalOverrides pkgsInit (self: config.packageOverrides or (super: {})); + pkgs = applyGlobalOverrides (self: config.packageOverrides or (super: {})); # stdenvOverrides is used to avoid circular dependencies for building the # standard build environment. This mechanism use the override mechanism to @@ -108,16 +108,16 @@ let lib.optionalAttrs (crossSystem == null && pkgs.stdenv ? overrides) (pkgs.stdenv.overrides pkgs); - # The un-overriden packages, passed to `overrider'. - pkgsInit = pkgsFun pkgs; - # Return the complete set of packages, after applying the overrides # returned by the `overrider' function (see above). Warning: this # function is very expensive! - applyGlobalOverrides = pkgsOrig: overrider: + applyGlobalOverrides = overrider: let overrides = overrider pkgs pkgsOrig // stdenvOverrides pkgsOrig; + # The un-overriden packages, passed to `overrider'. + pkgsOrig = pkgsFun pkgs; + # The overriden, final packages. pkgs = pkgsFun pkgs // overrides; in pkgs; @@ -167,7 +167,7 @@ let # # The result is `pkgs' where all the derivations depending on `foo' # will use the new version. - overridePackages = f: applyGlobalOverrides pkgs f; + overridePackages = f: applyGlobalOverrides f; # Override system. This is useful to build i686 packages on x86_64-linux. forceSystem = system: kernel: (import ./../..) {