Revert "all-packages: Rewrite packageOverrides to use fix'/extends"
This reverts commit 9c0121be81
. I don't
know what this change does and I don't have time to review it at the
moment, sorry.
This commit is contained in:
parent
c8e55671cd
commit
75f361f4c9
@ -64,7 +64,7 @@ let
|
||||
# { /* the config */ } and
|
||||
# { pkgs, ... } : { /* the config */ }
|
||||
if builtins.isFunction configExpr
|
||||
then configExpr { pkgs = pkgsFinal; }
|
||||
then configExpr { inherit pkgs; }
|
||||
else configExpr;
|
||||
|
||||
# Allow setting the platform in the config file. Otherwise, let's use a reasonable default (pc)
|
||||
@ -83,38 +83,51 @@ let
|
||||
platform = if platform_ != null then platform_
|
||||
else config.platform or platformAuto;
|
||||
|
||||
# The complete set of packages, after applying the overrides
|
||||
pkgsFinal = lib.fix' (lib.extends configOverrides (lib.extends stdenvOverrides pkgsFun));
|
||||
# Helper functions that are exported through `pkgs'.
|
||||
helperFunctions =
|
||||
stdenvAdapters //
|
||||
(import ../build-support/trivial-builders.nix { inherit lib; inherit (pkgs) stdenv; inherit (pkgs.xorg) lndir; });
|
||||
|
||||
stdenvOverrides =
|
||||
# We don't want stdenv overrides in the case of cross-building,
|
||||
# or otherwise the basic overrided packages will not be built
|
||||
# with the crossStdenv adapter.
|
||||
if crossSystem == null
|
||||
then self: super: lib.optionalAttrs (super.stdenv ? overrides) (super.stdenv.overrides super)
|
||||
else self: super: {};
|
||||
stdenvAdapters =
|
||||
import ../stdenv/adapters.nix pkgs;
|
||||
|
||||
# Packages can be overriden globally via the `packageOverrides'
|
||||
|
||||
# Allow packages to be overriden globally via the `packageOverrides'
|
||||
# configuration option, which must be a function that takes `pkgs'
|
||||
# as an argument and returns a set of new or overriden packages.
|
||||
# The recommended usage follows this snippet:
|
||||
# packageOverrides = super: let self = super.pkgs in ...
|
||||
# `super' is the *original* (un-overriden) set of packages,
|
||||
# while `self' refers to the final (overriden) set of packages.
|
||||
configOverrides =
|
||||
if config ? packageOverrides && bootStdenv == null # don't apply config overrides in stdenv boot
|
||||
then self: config.packageOverrides
|
||||
else self: super: {};
|
||||
# The `packageOverrides' function is called with the *original*
|
||||
# (un-overriden) set of packages, allowing packageOverrides
|
||||
# attributes to refer to the original attributes (e.g. "foo =
|
||||
# ... pkgs.foo ...").
|
||||
pkgs = applyGlobalOverrides (config.packageOverrides or (pkgs: {}));
|
||||
|
||||
mkOverrides = pkgsOrig: overrides: overrides //
|
||||
(lib.optionalAttrs (pkgsOrig.stdenv ? overrides && crossSystem == null) (pkgsOrig.stdenv.overrides pkgsOrig));
|
||||
|
||||
# Return the complete set of packages, after applying the overrides
|
||||
# returned by the `overrider' function (see above). Warning: this
|
||||
# function is very expensive!
|
||||
applyGlobalOverrides = overrider:
|
||||
let
|
||||
# Call the overrider function. We don't want stdenv overrides
|
||||
# in the case of cross-building, or otherwise the basic
|
||||
# overrided packages will not be built with the crossStdenv
|
||||
# adapter.
|
||||
overrides = mkOverrides pkgsOrig (overrider pkgsOrig);
|
||||
|
||||
# The un-overriden packages, passed to `overrider'.
|
||||
pkgsOrig = pkgsFun pkgs {};
|
||||
|
||||
# The overriden, final packages.
|
||||
pkgs = pkgsFun pkgs overrides;
|
||||
in pkgs;
|
||||
|
||||
|
||||
# The package compositions. Yes, this isn't properly indented.
|
||||
pkgsFun = pkgs:
|
||||
let defaultScope = pkgs // pkgs.xorg;
|
||||
helperFunctions = pkgs_.stdenvAdapters // pkgs_.trivial-builders;
|
||||
pkgsRet = helperFunctions // pkgs_;
|
||||
pkgs_ = with pkgs; {
|
||||
# Helper functions that are exported through `pkgs'.
|
||||
trivial-builders = import ../build-support/trivial-builders.nix { inherit lib; inherit stdenv; inherit (xorg) lndir; };
|
||||
stdenvAdapters = import ../stdenv/adapters.nix pkgs;
|
||||
pkgsFun = pkgs: overrides:
|
||||
with helperFunctions;
|
||||
let defaultScope = pkgs // pkgs.xorg; self = self_ // overrides;
|
||||
self_ = with self; helperFunctions // {
|
||||
|
||||
# Make some arguments passed to all-packages.nix available
|
||||
inherit system platform;
|
||||
@ -144,7 +157,11 @@ let
|
||||
#
|
||||
# The result is `pkgs' where all the derivations depending on `foo'
|
||||
# will use the new version.
|
||||
overridePackages = f: lib.fix' (lib.extends f pkgs.__unfix__);
|
||||
overridePackages = f:
|
||||
let
|
||||
newpkgs = pkgsFun newpkgs overrides;
|
||||
overrides = mkOverrides pkgs (f newpkgs pkgs);
|
||||
in newpkgs;
|
||||
|
||||
# Override system. This is useful to build i686 packages on x86_64-linux.
|
||||
forceSystem = system: kernel: (import ./all-packages.nix) {
|
||||
@ -166,7 +183,7 @@ let
|
||||
|
||||
|
||||
### Helper functions.
|
||||
inherit lib config;
|
||||
inherit lib config stdenvAdapters;
|
||||
|
||||
inherit (lib) lowPrio hiPrio appendToName makeOverridable;
|
||||
inherit (misc) versionedDerivation;
|
||||
@ -197,8 +214,7 @@ let
|
||||
allPackages = args: import ./all-packages.nix ({ inherit config system; } // args);
|
||||
};
|
||||
|
||||
# We use pkgs_ because accessing pkgs would lead to an infinite recursion in stdenvOverrides
|
||||
defaultStdenv = pkgs_.allStdenvs.stdenv // { inherit platform; };
|
||||
defaultStdenv = allStdenvs.stdenv // { inherit platform; };
|
||||
|
||||
stdenvCross = lowPrio (makeStdenvCross defaultStdenv crossSystem binutilsCross gccCrossStageFinal);
|
||||
|
||||
@ -218,7 +234,7 @@ let
|
||||
};
|
||||
}
|
||||
else
|
||||
pkgs_.defaultStdenv;
|
||||
defaultStdenv;
|
||||
|
||||
forceNativeDrv = drv : if crossSystem == null then drv else
|
||||
(drv // { crossDrv = drv.nativeDrv; });
|
||||
@ -5988,8 +6004,8 @@ let
|
||||
gotty = goPackages.gotty.bin // { outputs = [ "bin" ]; };
|
||||
|
||||
gradleGen = callPackage ../development/tools/build-managers/gradle { };
|
||||
gradle = gradleGen.gradleLatest;
|
||||
gradle25 = gradleGen.gradle25;
|
||||
gradle = self.gradleGen.gradleLatest;
|
||||
gradle25 = self.gradleGen.gradle25;
|
||||
|
||||
gperf = callPackage ../development/tools/misc/gperf { };
|
||||
|
||||
@ -11824,7 +11840,7 @@ let
|
||||
AppKit Carbon Cocoa IOKit OSAKit Quartz QuartzCore WebKit
|
||||
ImageCaptureCore GSS ImageIO;
|
||||
});
|
||||
emacs24Macport = emacs24Macport_24_5;
|
||||
emacs24Macport = self.emacs24Macport_24_5;
|
||||
|
||||
emacs25pre = lowPrio (callPackage ../applications/editors/emacs-25 {
|
||||
# use override to enable additional features
|
||||
@ -16200,13 +16216,12 @@ let
|
||||
|
||||
mg = callPackage ../applications/editors/mg { };
|
||||
|
||||
};
|
||||
# end pkgs_ =
|
||||
}; # self_ =
|
||||
|
||||
|
||||
### Deprecated aliases - for backward compatibility
|
||||
|
||||
aliases = with pkgs; {
|
||||
aliases = with self; rec {
|
||||
accounts-qt = qt5.accounts-qt; # added 2015-12-19
|
||||
adobeReader = adobe-reader;
|
||||
aircrackng = aircrack-ng; # added 2016-01-14
|
||||
@ -16295,7 +16310,4 @@ tweakAlias = _n: alias: with lib;
|
||||
removeAttrs alias ["recurseForDerivations"]
|
||||
else alias;
|
||||
|
||||
in lib.mapAttrs tweakAlias aliases // pkgsRet;
|
||||
# end pkgsFun
|
||||
|
||||
in pkgsFinal
|
||||
in lib.mapAttrs tweakAlias aliases // self; in pkgs
|
||||
|
Loading…
Reference in New Issue
Block a user