From 9444d6e6ded8c281174599c6c1e7281e956896b6 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Thu, 17 Mar 2016 19:48:01 +0000 Subject: Split miss-indented last lines. to simplify future diffs. --- pkgs/top-level/all-packages.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 54a2ee0b8f4..2fd1cb51ac3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16478,4 +16478,8 @@ tweakAlias = _n: alias: with lib; removeAttrs alias ["recurseForDerivations"] else alias; -in lib.mapAttrs tweakAlias aliases // self; in pkgs +in + lib.mapAttrs tweakAlias aliases // self; + +in + pkgs -- cgit 1.4.1 From a39c5ff0d891d451a9ce08cab7ff99942664cc72 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Thu, 17 Mar 2016 20:18:03 +0000 Subject: Re-indent the top of pkgsFun. --- pkgs/top-level/all-packages.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2fd1cb51ac3..4cc95221e30 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -126,8 +126,10 @@ let # The package compositions. Yes, this isn't properly indented. pkgsFun = pkgs: overrides: with helperFunctions; - let defaultScope = pkgs // pkgs.xorg; self = self_ // overrides; - self_ = with self; 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; -- cgit 1.4.1 From 11a566b5bc9cb90619df16170f47c9acac8eb57d Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Thu, 17 Mar 2016 20:19:44 +0000 Subject: Move 'with helperFunctions' above the set of all packages. --- pkgs/top-level/all-packages.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4cc95221e30..c5c4820b584 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -125,11 +125,10 @@ let # The package compositions. Yes, this isn't properly indented. pkgsFun = pkgs: overrides: - with helperFunctions; let defaultScope = pkgs // pkgs.xorg; self = self_ // overrides; - self_ = with self; helperFunctions // { + self_ = with self; helperFunctions // (with helperFunctions; { # Make some arguments passed to all-packages.nix available inherit system platform; @@ -16470,7 +16469,7 @@ let mg = callPackage ../applications/editors/mg { }; -}; # self_ = +}); # self_ = aliases = import ./aliases.nix self; -- cgit 1.4.1 From 5f4cb91a1c022ca20f47ff189dfa0e4c98e5b592 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Thu, 17 Mar 2016 20:22:15 +0000 Subject: Move helperfunctions and stdenvAdapters under pkgsFun. The `helperFunctions` and `stdenvAdapters` both use the `pkgs` attribute as input, either to inherit some properties, either to use it as argument. The `pkgs` binding used in both expressions of the `helperFunctions` and `stdenvAdapters` is no longer the result of the `applyGlobalOverrides` function, but the argument of the `pkgsFun` function. The `pkgsFun` functions is called twice under `applyGlobalOverrides`, and in both cases, the first argument of `pkgsFun` correspond to the result of `applyGlobalOverrides`. Thus, this modification will change the bindings, but the evaluation of ``. A third call the `pkgsFun` exists under `overridePackages` in the set of all packages. Previously, the `helperFunctions` and `stdenvAdapaters` would use the functions defined as part of the default `` set. With this modification, the `helperFunctions` and the `stdenvAdapters` are now using the fix-point of the newly evaluated package set. This implies that this modification allow the user to use `overridePackages`, which is already not recommended for performance reasons, to override the inputs of the `helperFucntions` and `stdenvAdapaters` too, where this was not possible before. --- pkgs/top-level/all-packages.nix | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c5c4820b584..0a80c5b48d2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -83,15 +83,6 @@ let platform = if platform_ != null then platform_ else config.platform or platformAuto; - # Helper functions that are exported through `pkgs'. - helperFunctions = - stdenvAdapters // - (import ../build-support/trivial-builders.nix { inherit lib; inherit (pkgs) stdenv; inherit (pkgs.xorg) lndir; }); - - stdenvAdapters = - import ../stdenv/adapters.nix pkgs; - - # 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. @@ -128,6 +119,15 @@ let let defaultScope = pkgs // pkgs.xorg; self = self_ // overrides; + + # Helper functions that are exported through `pkgs'. + helperFunctions = + stdenvAdapters // + (import ../build-support/trivial-builders.nix { inherit lib; inherit (pkgs) stdenv; inherit (pkgs.xorg) lndir; }); + + stdenvAdapters = + import ../stdenv/adapters.nix pkgs; + self_ = with self; helperFunctions // (with helperFunctions; { # Make some arguments passed to all-packages.nix available -- cgit 1.4.1 From f9a29887fe5e8c6205a982ef3fed4b77553c43b9 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Thu, 17 Mar 2016 21:03:22 +0000 Subject: Move pkgsOrig outside applyGlobalOverrides and provide it as argument. --- pkgs/top-level/all-packages.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0a80c5b48d2..1f8b04a8350 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -90,15 +90,18 @@ let # (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: {})); + pkgs = applyGlobalOverrides pkgsInit (config.packageOverrides or (pkgs: {})); mkOverrides = pkgsOrig: overrides: overrides // (lib.optionalAttrs (pkgsOrig.stdenv ? overrides && crossSystem == null) (pkgsOrig.stdenv.overrides pkgsOrig)); + # 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 = overrider: + applyGlobalOverrides = pkgsOrig: overrider: let # Call the overrider function. We don't want stdenv overrides # in the case of cross-building, or otherwise the basic @@ -106,9 +109,6 @@ let # 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; -- cgit 1.4.1 From a6e260c91f38dacbc42a08273101f222276075b7 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Thu, 17 Mar 2016 21:05:03 +0000 Subject: Add an extra argument to the overrider function of applyGlobalOverrides. --- pkgs/top-level/all-packages.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1f8b04a8350..bda8ff62c56 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -90,7 +90,7 @@ let # (un-overriden) set of packages, allowing packageOverrides # attributes to refer to the original attributes (e.g. "foo = # ... pkgs.foo ..."). - pkgs = applyGlobalOverrides pkgsInit (config.packageOverrides or (pkgs: {})); + pkgs = applyGlobalOverrides pkgsInit (self: config.packageOverrides or (super: {})); mkOverrides = pkgsOrig: overrides: overrides // (lib.optionalAttrs (pkgsOrig.stdenv ? overrides && crossSystem == null) (pkgsOrig.stdenv.overrides pkgsOrig)); @@ -107,7 +107,7 @@ let # 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); + overrides = mkOverrides pkgsOrig (overrider pkgs pkgsOrig); # The overriden, final packages. pkgs = pkgsFun pkgs overrides; -- cgit 1.4.1 From a5188bda7b008c942ae58a43a2d4d0b9d3ba4ebc Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Thu, 17 Mar 2016 21:07:13 +0000 Subject: Unify the applyGlobalOverride function with the overridePackages function. --- pkgs/top-level/all-packages.nix | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bda8ff62c56..b40014a2e75 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -158,11 +158,7 @@ let # # The result is `pkgs' where all the derivations depending on `foo' # will use the new version. - overridePackages = f: - let - newpkgs = pkgsFun newpkgs overrides; - overrides = mkOverrides pkgs (f newpkgs pkgs); - in newpkgs; + overridePackages = f: applyGlobalOverrides pkgs f; # Override system. This is useful to build i686 packages on x86_64-linux. forceSystem = system: kernel: (import ./../..) { -- cgit 1.4.1 From 00963c3dfdab7fbcc3e2a9db6df47cea25d46688 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Thu, 17 Mar 2016 21:24:53 +0000 Subject: Extract stdenvOverrides function out of mkOverrides function. --- pkgs/top-level/all-packages.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b40014a2e75..b7d68885507 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -92,8 +92,14 @@ let # ... pkgs.foo ..."). pkgs = applyGlobalOverrides pkgsInit (self: config.packageOverrides or (super: {})); - mkOverrides = pkgsOrig: overrides: overrides // - (lib.optionalAttrs (pkgsOrig.stdenv ? overrides && crossSystem == null) (pkgsOrig.stdenv.overrides pkgsOrig)); + mkOverrides = pkgs: overrides: overrides // stdenvOverrides pkgs; + + # stdenvOverrides is used to avoid circular dependencies for building the + # standard build environment. This mechanism use the override mechanism to + # implement some staged compilation of the stdenv. + stdenvOverrides = pkgs: + lib.optionalAttrs (pkgs.stdenv ? overrides && crossSystem == null) + (pkgs.stdenv.overrides pkgs); # The un-overriden packages, passed to `overrider'. pkgsInit = pkgsFun pkgs {}; -- cgit 1.4.1 From acaa99cbd2db20fad9ee63118d0828f0f237709a Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Fri, 18 Mar 2016 20:36:00 +0000 Subject: Move applyGlobalOverrides comment to stdenvOverrides, where it fits better. --- pkgs/top-level/all-packages.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b7d68885507..1798b120cd1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -97,6 +97,10 @@ let # stdenvOverrides is used to avoid circular dependencies for building the # standard build environment. This mechanism use the override mechanism to # implement some staged compilation of the stdenv. + # + # 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. stdenvOverrides = pkgs: lib.optionalAttrs (pkgs.stdenv ? overrides && crossSystem == null) (pkgs.stdenv.overrides pkgs); @@ -109,10 +113,6 @@ let # function is very expensive! applyGlobalOverrides = pkgsOrig: 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 pkgs pkgsOrig); # The overriden, final packages. -- cgit 1.4.1 From 71b2fd92b3be82291563699a94a795b8becd5a65 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Fri, 18 Mar 2016 20:56:40 +0000 Subject: Move mkOverrides under applyGlobalOverrides. --- pkgs/top-level/all-packages.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1798b120cd1..eb30c460d47 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -92,8 +92,6 @@ let # ... pkgs.foo ..."). pkgs = applyGlobalOverrides pkgsInit (self: config.packageOverrides or (super: {})); - mkOverrides = pkgs: overrides: overrides // stdenvOverrides pkgs; - # stdenvOverrides is used to avoid circular dependencies for building the # standard build environment. This mechanism use the override mechanism to # implement some staged compilation of the stdenv. @@ -113,13 +111,14 @@ let # function is very expensive! applyGlobalOverrides = pkgsOrig: overrider: let + mkOverrides = pkgs: overrides: overrides // stdenvOverrides pkgs; + overrides = mkOverrides pkgsOrig (overrider pkgs pkgsOrig); # The overriden, final packages. pkgs = pkgsFun pkgs overrides; in pkgs; - # The package compositions. Yes, this isn't properly indented. pkgsFun = pkgs: overrides: let -- cgit 1.4.1 From a8374f2168e4ad6dda41ae6457feac69614e271b Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Fri, 18 Mar 2016 20:58:24 +0000 Subject: Under applyGlobalOverrides, inline mkOverrides in overrides. --- pkgs/top-level/all-packages.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index eb30c460d47..5f27f94b44c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -111,9 +111,7 @@ let # function is very expensive! applyGlobalOverrides = pkgsOrig: overrider: let - mkOverrides = pkgs: overrides: overrides // stdenvOverrides pkgs; - - overrides = mkOverrides pkgsOrig (overrider pkgs pkgsOrig); + overrides = overrider pkgs pkgsOrig // stdenvOverrides pkgsOrig; # The overriden, final packages. pkgs = pkgsFun pkgs overrides; -- cgit 1.4.1 From a658645e1e277ecea37ccbdac6c2ce64e55eed13 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Fri, 18 Mar 2016 22:54:24 +0000 Subject: Remove with helperFunction above the list of all packages. This modification change the names bound to the `helperFunctions` attribute set, to be bound to `self` which is constructed by merging the same `helperFunctions` set with the set of all packages. This patch works as expected because none of the helperFunction names is aliased by the name of a package. --- pkgs/top-level/all-packages.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5f27f94b44c..12ebed19f2d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -131,7 +131,7 @@ let stdenvAdapters = import ../stdenv/adapters.nix pkgs; - self_ = with self; helperFunctions // (with helperFunctions; { + self_ = with self; helperFunctions // { # Make some arguments passed to all-packages.nix available inherit system platform; @@ -16468,7 +16468,7 @@ let mg = callPackage ../applications/editors/mg { }; -}); # self_ = +}; # self_ = aliases = import ./aliases.nix self; -- cgit 1.4.1 From ffcb6682bcc14f70c49949fdcbfbba8841c63e0c Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Sat, 19 Mar 2016 14:02:20 +0000 Subject: Under pkgsFun, move the merge of helper functions from self_ to self. --- pkgs/top-level/all-packages.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 12ebed19f2d..5d21f1fd9e5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -121,7 +121,7 @@ let pkgsFun = pkgs: overrides: let defaultScope = pkgs // pkgs.xorg; - self = self_ // overrides; + self = helperFunctions // self_ // overrides; # Helper functions that are exported through `pkgs'. helperFunctions = @@ -131,7 +131,7 @@ let stdenvAdapters = import ../stdenv/adapters.nix pkgs; - self_ = with self; helperFunctions // { + self_ = with self; { # Make some arguments passed to all-packages.nix available inherit system platform; -- cgit 1.4.1 From 8d355b8d85b7ce454bca1473bf8cc5aebf8f0c48 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Sat, 19 Mar 2016 14:39:48 +0000 Subject: Under pkgsFun, expand self attribute, and rename self_ to self. Note, the aliases are now computed against the set of packages defined in the set of all packages, and no longer apply to any overriden package. I think this is better as this reduces the amount of surprizes. --- pkgs/top-level/all-packages.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5d21f1fd9e5..fb39447c999 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -121,7 +121,6 @@ let pkgsFun = pkgs: overrides: let defaultScope = pkgs // pkgs.xorg; - self = helperFunctions // self_ // overrides; # Helper functions that are exported through `pkgs'. helperFunctions = @@ -131,7 +130,7 @@ let stdenvAdapters = import ../stdenv/adapters.nix pkgs; - self_ = with self; { + self = with helperFunctions; with self; with overrides; { # Make some arguments passed to all-packages.nix available inherit system platform; @@ -16468,7 +16467,7 @@ let mg = callPackage ../applications/editors/mg { }; -}; # self_ = +}; # self = aliases = import ./aliases.nix self; @@ -16479,7 +16478,7 @@ tweakAlias = _n: alias: with lib; else alias; in - lib.mapAttrs tweakAlias aliases // self; + lib.mapAttrs tweakAlias aliases // helperFunctions // self // overrides; in pkgs -- cgit 1.4.1 From 7f3a4f428746620ca555797f1a7269bb2226e5dc Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Sun, 20 Mar 2016 13:15:37 +0000 Subject: Swap conditions of stdenvOverrides to prevent infinite loops while evaluating stdenvCross. While evaluating the derivation of xbursttools: the condition `pkgs.stdenv ? overrides` causes the evaluation of `stdenvCross`. This evaluation comes too early during the execution, as it prevents the resolution of names such as `pkgs.lib`, and `stdenvAdapaters.makeStdenvCross`, which we want to take from `pkgs` instead of `self` in following patches. By swapping the conditions, we effectively make the resolution of `pkgs.lib` and `stdenvAdapaters.makeStdenvCross` possible through the pkgs attribute. --- pkgs/top-level/all-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index fb39447c999..f16a7b6691c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -100,7 +100,7 @@ let # otherwise the basic overrided packages will not be built with the # crossStdenv adapter. stdenvOverrides = pkgs: - lib.optionalAttrs (pkgs.stdenv ? overrides && crossSystem == null) + lib.optionalAttrs (crossSystem == null && pkgs.stdenv ? overrides) (pkgs.stdenv.overrides pkgs); # The un-overriden packages, passed to `overrider'. -- cgit 1.4.1 From 020bb40454712e9149cfce31ba21cf918afb34dc Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Sat, 19 Mar 2016 18:11:09 +0000 Subject: Split stdenv attribute set. Extract stdenvDefault from the set of all packages. As this set of attributes are inter-dependant, probably due to stdenvOverrides, we have to keep them in a close set of inter-dependent options. I guess I will have to investigate more ... --- pkgs/top-level/all-packages.nix | 92 +++++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 45 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f16a7b6691c..6d5bf04cfa3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -130,7 +130,40 @@ let stdenvAdapters = import ../stdenv/adapters.nix pkgs; - self = with helperFunctions; with self; with overrides; { + stdenvDefault = with helperFunctions; with self; with overrides; { + + + ### STANDARD ENVIRONMENT + + + allStdenvs = import ../stdenv { + inherit system platform config lib; + allPackages = args: import ./../.. ({ inherit config system; } // args); + }; + + defaultStdenv = allStdenvs.stdenv // { inherit platform; }; + + stdenv = + if bootStdenv != null then (bootStdenv // {inherit platform;}) else + if crossSystem != null then + stdenvCross + else + let + changer = config.replaceStdenv or null; + in if changer != null then + changer { + # We import again all-packages to avoid recursivities. + pkgs = import ./../.. { + # We remove packageOverrides to avoid recursivities + config = removeAttrs config [ "replaceStdenv" ]; + }; + } + else + defaultStdenv; + +}; + + self = with pkgs; stdenvDefault // { # Make some arguments passed to all-packages.nix available inherit system platform; @@ -170,12 +203,24 @@ let crossSystem; }; - # Used by wine, firefox with debugging version of Flash, ... pkgsi686Linux = forceSystem "i686-linux" "i386"; callPackage_i686 = lib.callPackageWith (pkgsi686Linux // pkgsi686Linux.xorg); + forceNativeDrv = drv : if crossSystem == null then drv else + (drv // { crossDrv = drv.nativeDrv; }); + + stdenvCross = lowPrio (makeStdenvCross defaultStdenv crossSystem binutilsCross gccCrossStageFinal); + + # A stdenv capable of building 32-bit binaries. On x86_64-linux, + # it uses GCC compiled with multilib support; on i686-linux, it's + # just the plain stdenv. + stdenv_32bit = lowPrio ( + if system == "x86_64-linux" then + overrideCC stdenv gcc_multi + else + stdenv); # For convenience, allow callers to get the path to Nixpkgs. path = ../..; @@ -205,49 +250,6 @@ let nixpkgs-lint = callPackage ../../maintainers/scripts/nixpkgs-lint.nix { }; - ### STANDARD ENVIRONMENT - - - allStdenvs = import ../stdenv { - inherit system platform config lib; - allPackages = args: import ./../.. ({ inherit config system; } // args); - }; - - defaultStdenv = allStdenvs.stdenv // { inherit platform; }; - - stdenvCross = lowPrio (makeStdenvCross defaultStdenv crossSystem binutilsCross gccCrossStageFinal); - - stdenv = - if bootStdenv != null then (bootStdenv // {inherit platform;}) else - if crossSystem != null then - stdenvCross - else - let - changer = config.replaceStdenv or null; - in if changer != null then - changer { - # We import again all-packages to avoid recursivities. - pkgs = import ./../.. { - # We remove packageOverrides to avoid recursivities - config = removeAttrs config [ "replaceStdenv" ]; - }; - } - else - defaultStdenv; - - forceNativeDrv = drv : if crossSystem == null then drv else - (drv // { crossDrv = drv.nativeDrv; }); - - # A stdenv capable of building 32-bit binaries. On x86_64-linux, - # it uses GCC compiled with multilib support; on i686-linux, it's - # just the plain stdenv. - stdenv_32bit = lowPrio ( - if system == "x86_64-linux" then - overrideCC stdenv gcc_multi - else - stdenv); - - ### BUILD SUPPORT attrSetToDir = arg: callPackage ../build-support/upstream-updater/attrset-to-dir.nix { -- cgit 1.4.1 From be3531a56e153a4947b4c4b5f22a43e65b174d5e Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Sun, 20 Mar 2016 13:46:14 +0000 Subject: Replace with statements of stdenvDefault to rely on pkgs instead of self. --- pkgs/top-level/all-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6d5bf04cfa3..9cb6b371427 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -130,7 +130,7 @@ let stdenvAdapters = import ../stdenv/adapters.nix pkgs; - stdenvDefault = with helperFunctions; with self; with overrides; { + stdenvDefault = with pkgs; with stdenvDefault; { ### STANDARD ENVIRONMENT -- cgit 1.4.1 From f7c86ee01841f85b94b3823f381119faf7060810 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Sun, 20 Mar 2016 13:47:31 +0000 Subject: Move merge of stdenvDefault from the self attribute to the returned value of pkgsFun. --- pkgs/top-level/all-packages.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9cb6b371427..1d120339110 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -163,7 +163,7 @@ let }; - self = with pkgs; stdenvDefault // { + self = with pkgs; { # Make some arguments passed to all-packages.nix available inherit system platform; @@ -16480,7 +16480,7 @@ tweakAlias = _n: alias: with lib; else alias; in - lib.mapAttrs tweakAlias aliases // helperFunctions // self // overrides; + lib.mapAttrs tweakAlias aliases // helperFunctions // stdenvDefault // self // overrides; in pkgs -- cgit 1.4.1 From 0b67f7cb5dfc2b5080b8e3046917a0a15bb5140d Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Sun, 20 Mar 2016 14:50:27 +0000 Subject: Move tweakAlias function into the aliases.nix file, and rename it. --- pkgs/top-level/aliases.nix | 14 +++++++++++++- pkgs/top-level/all-packages.nix | 7 +------ 2 files changed, 14 insertions(+), 7 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index f2e1bbc5102..944de791929 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -2,9 +2,21 @@ self: with self; +let + # Removind recurseForDerivation prevents derivations of aliased attribute + # set to appear while listing all the packages available. + removeRecurseForDerivations = _n: alias: with lib; + if alias.recurseForDerivations or false then + removeAttrs alias ["recurseForDerivations"] + else alias; + + doNotDisplayTwice = aliases: + lib.mapAttrs removeRecurseForDerivations aliases; +in + ### Deprecated aliases - for backward compatibility -rec { +doNotDisplayTwice rec { accounts-qt = qt5.accounts-qt; # added 2015-12-19 adobeReader = adobe-reader; aircrackng = aircrack-ng; # added 2016-01-14 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1d120339110..188c548050c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16474,13 +16474,8 @@ let aliases = import ./aliases.nix self; -tweakAlias = _n: alias: with lib; - if alias.recurseForDerivations or false then - removeAttrs alias ["recurseForDerivations"] - else alias; - in - lib.mapAttrs tweakAlias aliases // helperFunctions // stdenvDefault // self // overrides; + aliases // helperFunctions // stdenvDefault // self // overrides; in pkgs -- cgit 1.4.1 From f043ffcea463e3f965283e26b458b5fab5ddbbd9 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Sun, 20 Mar 2016 14:52:28 +0000 Subject: Move the set of aliases after 'self', such that we can later use the extend function. --- pkgs/top-level/all-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 188c548050c..a0bae697db2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16475,7 +16475,7 @@ let aliases = import ./aliases.nix self; in - aliases // helperFunctions // stdenvDefault // self // overrides; + helperFunctions // stdenvDefault // self // aliases // overrides; in pkgs -- cgit 1.4.1 From 054327729cfe043587f4a0cff86fb4f5f5f20ec5 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Sun, 20 Mar 2016 15:14:57 +0000 Subject: Move stdenvDefault into its own file. --- pkgs/top-level/all-packages.nix | 38 ++++++-------------------------------- pkgs/top-level/stdenv.nix | 31 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 32 deletions(-) create mode 100644 pkgs/top-level/stdenv.nix (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a0bae697db2..f0bb6a7ee7b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -83,6 +83,11 @@ let platform = if platform_ != null then platform_ else config.platform or platformAuto; + topLevelArguments = { + inherit system bootStdenv noSysDirs gccWithCC gccWithProfiling config + crossSystem platform lib; + }; + # 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. @@ -130,38 +135,7 @@ let stdenvAdapters = import ../stdenv/adapters.nix pkgs; - stdenvDefault = with pkgs; with stdenvDefault; { - - - ### STANDARD ENVIRONMENT - - - allStdenvs = import ../stdenv { - inherit system platform config lib; - allPackages = args: import ./../.. ({ inherit config system; } // args); - }; - - defaultStdenv = allStdenvs.stdenv // { inherit platform; }; - - stdenv = - if bootStdenv != null then (bootStdenv // {inherit platform;}) else - if crossSystem != null then - stdenvCross - else - let - changer = config.replaceStdenv or null; - in if changer != null then - changer { - # We import again all-packages to avoid recursivities. - pkgs = import ./../.. { - # We remove packageOverrides to avoid recursivities - config = removeAttrs config [ "replaceStdenv" ]; - }; - } - else - defaultStdenv; - -}; + stdenvDefault = (import ./stdenv.nix topLevelArguments) {} pkgs; self = with pkgs; { diff --git a/pkgs/top-level/stdenv.nix b/pkgs/top-level/stdenv.nix new file mode 100644 index 00000000000..aeb36b8edc3 --- /dev/null +++ b/pkgs/top-level/stdenv.nix @@ -0,0 +1,31 @@ +{ system, bootStdenv, crossSystem, config, platform, lib, ... }: +self: super: + +with super; + +rec { + allStdenvs = import ../stdenv { + inherit system platform config lib; + allPackages = args: import ./../.. ({ inherit config system; } // args); + }; + + defaultStdenv = allStdenvs.stdenv // { inherit platform; }; + + stdenv = + if bootStdenv != null then (bootStdenv // {inherit platform;}) else + if crossSystem != null then + stdenvCross + else + let + changer = config.replaceStdenv or null; + in if changer != null then + changer { + # We import again all-packages to avoid recursivities. + pkgs = import ./../.. { + # We remove packageOverrides to avoid recursivities + config = removeAttrs config [ "replaceStdenv" ]; + }; + } + else + defaultStdenv; +} -- cgit 1.4.1 From 007500f2ece22ab43b6c73e33cb39c4c29221745 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Sun, 20 Mar 2016 15:17:34 +0000 Subject: Move the merge of the overrides from pkgsFun to applyGlobalOverrides. --- pkgs/top-level/all-packages.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f0bb6a7ee7b..5f94da4b6e4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -109,7 +109,7 @@ let (pkgs.stdenv.overrides pkgs); # The un-overriden packages, passed to `overrider'. - pkgsInit = pkgsFun pkgs {}; + pkgsInit = pkgsFun pkgs; # Return the complete set of packages, after applying the overrides # returned by the `overrider' function (see above). Warning: this @@ -119,11 +119,11 @@ let overrides = overrider pkgs pkgsOrig // stdenvOverrides pkgsOrig; # The overriden, final packages. - pkgs = pkgsFun pkgs overrides; + pkgs = pkgsFun pkgs // overrides; in pkgs; # The package compositions. Yes, this isn't properly indented. - pkgsFun = pkgs: overrides: + pkgsFun = pkgs: let defaultScope = pkgs // pkgs.xorg; @@ -16449,7 +16449,7 @@ let aliases = import ./aliases.nix self; in - helperFunctions // stdenvDefault // self // aliases // overrides; + helperFunctions // stdenvDefault // self // aliases; in pkgs -- cgit 1.4.1 From 5e3ce6334c5c4fbec260f71e69f02493403aa2eb Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Sun, 20 Mar 2016 15:27:14 +0000 Subject: 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(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5f94da4b6e4..614978b011d 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 ./../..) { -- cgit 1.4.1 From 32e96bbb8b05bbc5aecaf4a8edec9a20e150d8cd Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Sun, 20 Mar 2016 15:43:27 +0000 Subject: Within applyGlobalOverrides, alias pkgsFun calls. --- pkgs/top-level/all-packages.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 614978b011d..778ce916d12 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -113,13 +113,13 @@ let # function is very expensive! applyGlobalOverrides = overrider: let - overrides = overrider pkgs pkgsOrig // stdenvOverrides pkgsOrig; + overrides = super: overrider pkgs super // stdenvOverrides super; # The un-overriden packages, passed to `overrider'. - pkgsOrig = pkgsFun pkgs; + pkgs_ = pkgsFun pkgs; # The overriden, final packages. - pkgs = pkgsFun pkgs // overrides; + pkgs = pkgs_ // overrides pkgs_; in pkgs; # The package compositions. Yes, this isn't properly indented. -- cgit 1.4.1 From 07e549ee5b8b53ecedb8c3932982a1547d8963c6 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Sun, 20 Mar 2016 15:54:26 +0000 Subject: Rename applyGlobalOverrides to pkgsWithOverrides --- pkgs/top-level/all-packages.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 778ce916d12..11987090806 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 (self: config.packageOverrides or (super: {})); + pkgs = pkgsWithOverrides (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 @@ -111,7 +111,7 @@ let # 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: + pkgsWithOverrides = overrider: let overrides = super: overrider pkgs super // stdenvOverrides super; @@ -167,7 +167,7 @@ let # # The result is `pkgs' where all the derivations depending on `foo' # will use the new version. - overridePackages = f: applyGlobalOverrides f; + overridePackages = f: pkgsWithOverrides f; # Override system. This is useful to build i686 packages on x86_64-linux. forceSystem = system: kernel: (import ./../..) { -- cgit 1.4.1 From a543a57ab5758d174e6351938a73583091517273 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Sun, 20 Mar 2016 16:04:00 +0000 Subject: Reformat pkgsWithOverrides to later facilitate the identitication with the extend functions. --- pkgs/top-level/all-packages.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 11987090806..769cae55406 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -113,13 +113,13 @@ let # function is very expensive! pkgsWithOverrides = overrider: let - overrides = super: overrider pkgs super // stdenvOverrides super; - # The un-overriden packages, passed to `overrider'. - pkgs_ = pkgsFun pkgs; + pkgs_6 = pkgsFun pkgs; + + pkgs_7 = pkgs_6 // overrider pkgs pkgs_6; # The overriden, final packages. - pkgs = pkgs_ // overrides pkgs_; + pkgs = pkgs_7 // stdenvOverrides pkgs_6; in pkgs; # The package compositions. Yes, this isn't properly indented. -- cgit 1.4.1 From ad317834053983e1bf3b61f58c923ca48a0dd2d7 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Sun, 20 Mar 2016 16:28:18 +0000 Subject: Extract the top-level logic out of all-packages.nix into pkgs/top-level/default.nix --- default.nix | 2 +- pkgs/top-level/all-packages.nix | 155 +++------------------------------------- pkgs/top-level/default.nix | 147 +++++++++++++++++++++++++++++++++++++ 3 files changed, 158 insertions(+), 146 deletions(-) create mode 100644 pkgs/top-level/default.nix (limited to 'pkgs/top-level/all-packages.nix') diff --git a/default.nix b/default.nix index 12c3cf87618..c384a5bb694 100644 --- a/default.nix +++ b/default.nix @@ -6,4 +6,4 @@ if ! builtins ? nixVersion || builtins.compareVersions requiredVersion builtins. else - import ./pkgs/top-level/all-packages.nix + import ./pkgs/top-level diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 769cae55406..18fc8b95811 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1,143 +1,16 @@ -/* This file composes the Nix Packages collection. That is, it - imports the functions that build the various packages, and calls - them with appropriate arguments. The result is a set of all the - packages in the Nix Packages collection for some particular - platform. */ +{ system, bootStdenv, noSysDirs, gccWithCC, gccWithProfiling +, config, crossSystem, platform, lib +, pkgsWithOverrides, stdenvAdapters, helperFunctions +, ... }: +self: pkgs: - -{ # The system (e.g., `i686-linux') for which to build the packages. - system ? builtins.currentSystem - -, # The standard environment to use. Only used for bootstrapping. If - # null, the default standard environment is used. - bootStdenv ? null - -, # Non-GNU/Linux OSes are currently "impure" platforms, with their libc - # outside of the store. Thus, GCC, GFortran, & co. must always look for - # files in standard system directories (/usr/include, etc.) - noSysDirs ? (system != "x86_64-freebsd" && system != "i686-freebsd" - && system != "x86_64-solaris" - && system != "x86_64-kfreebsd-gnu") - - # More flags for the bootstrapping of stdenv. -, gccWithCC ? true -, gccWithProfiling ? true - -, # Allow a configuration attribute set to be passed in as an - # argument. Otherwise, it's read from $NIXPKGS_CONFIG or - # ~/.nixpkgs/config.nix. - config ? null - -, crossSystem ? null -, platform ? null -}: - - -let config_ = config; platform_ = platform; in # rename the function arguments +with pkgs; let + defaultScope = pkgs // pkgs.xorg; +in - lib = import ../../lib; - - # The contents of the configuration file found at $NIXPKGS_CONFIG or - # $HOME/.nixpkgs/config.nix. - # for NIXOS (nixos-rebuild): use nixpkgs.config option - config = - let - toPath = builtins.toPath; - getEnv = x: if builtins ? getEnv then builtins.getEnv x else ""; - pathExists = name: - builtins ? pathExists && builtins.pathExists (toPath name); - - configFile = getEnv "NIXPKGS_CONFIG"; - homeDir = getEnv "HOME"; - configFile2 = homeDir + "/.nixpkgs/config.nix"; - - configExpr = - if config_ != null then config_ - else if configFile != "" && pathExists configFile then import (toPath configFile) - else if homeDir != "" && pathExists configFile2 then import (toPath configFile2) - else {}; - - in - # allow both: - # { /* the config */ } and - # { pkgs, ... } : { /* the config */ } - if builtins.isFunction configExpr - then configExpr { inherit pkgs; } - else configExpr; - - # Allow setting the platform in the config file. Otherwise, let's use a reasonable default (pc) - - platformAuto = let - platforms = (import ./platforms.nix); - in - if system == "armv6l-linux" then platforms.raspberrypi - else if system == "armv7l-linux" then platforms.armv7l-hf-multiplatform - else if system == "armv5tel-linux" then platforms.sheevaplug - else if system == "mips64el-linux" then platforms.fuloong2f_n32 - else if system == "x86_64-linux" then platforms.pc64 - else if system == "i686-linux" then platforms.pc32 - else platforms.pcBase; - - platform = if platform_ != null then platform_ - else config.platform or platformAuto; - - topLevelArguments = { - inherit system bootStdenv noSysDirs gccWithCC gccWithProfiling config - crossSystem platform lib; - }; - - # 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 `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 = pkgsWithOverrides (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 - # implement some staged compilation of the stdenv. - # - # 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. - stdenvOverrides = pkgs: - lib.optionalAttrs (crossSystem == null && pkgs.stdenv ? overrides) - (pkgs.stdenv.overrides pkgs); - - # Return the complete set of packages, after applying the overrides - # returned by the `overrider' function (see above). Warning: this - # function is very expensive! - pkgsWithOverrides = overrider: - let - # The un-overriden packages, passed to `overrider'. - pkgs_6 = pkgsFun pkgs; - - pkgs_7 = pkgs_6 // overrider pkgs pkgs_6; - - # The overriden, final packages. - pkgs = pkgs_7 // stdenvOverrides pkgs_6; - in pkgs; - - # The package compositions. Yes, this isn't properly indented. - pkgsFun = pkgs: - let - defaultScope = pkgs // pkgs.xorg; - - # Helper functions that are exported through `pkgs'. - helperFunctions = - stdenvAdapters // - (import ../build-support/trivial-builders.nix { inherit lib; inherit (pkgs) stdenv; inherit (pkgs.xorg) lndir; }); - - stdenvAdapters = - import ../stdenv/adapters.nix pkgs; - - stdenvDefault = (import ./stdenv.nix topLevelArguments) {} pkgs; - - self = with pkgs; { +{ # Make some arguments passed to all-packages.nix available inherit system platform; @@ -16443,13 +16316,5 @@ let mg = callPackage ../applications/editors/mg { }; -}; # self = - +} -aliases = import ./aliases.nix self; - -in - helperFunctions // stdenvDefault // self // aliases; - -in - pkgs diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix new file mode 100644 index 00000000000..39626a7485f --- /dev/null +++ b/pkgs/top-level/default.nix @@ -0,0 +1,147 @@ +/* This file composes the Nix Packages collection. That is, it + imports the functions that build the various packages, and calls + them with appropriate arguments. The result is a set of all the + packages in the Nix Packages collection for some particular + platform. */ + + +{ # The system (e.g., `i686-linux') for which to build the packages. + system ? builtins.currentSystem + +, # The standard environment to use. Only used for bootstrapping. If + # null, the default standard environment is used. + bootStdenv ? null + +, # Non-GNU/Linux OSes are currently "impure" platforms, with their libc + # outside of the store. Thus, GCC, GFortran, & co. must always look for + # files in standard system directories (/usr/include, etc.) + noSysDirs ? (system != "x86_64-freebsd" && system != "i686-freebsd" + && system != "x86_64-solaris" + && system != "x86_64-kfreebsd-gnu") + + # More flags for the bootstrapping of stdenv. +, gccWithCC ? true +, gccWithProfiling ? true + +, # Allow a configuration attribute set to be passed in as an + # argument. Otherwise, it's read from $NIXPKGS_CONFIG or + # ~/.nixpkgs/config.nix. + config ? null + +, crossSystem ? null +, platform ? null +}: + + +let config_ = config; platform_ = platform; in # rename the function arguments + +let + + lib = import ../../lib; + + # The contents of the configuration file found at $NIXPKGS_CONFIG or + # $HOME/.nixpkgs/config.nix. + # for NIXOS (nixos-rebuild): use nixpkgs.config option + config = + let + toPath = builtins.toPath; + getEnv = x: if builtins ? getEnv then builtins.getEnv x else ""; + pathExists = name: + builtins ? pathExists && builtins.pathExists (toPath name); + + configFile = getEnv "NIXPKGS_CONFIG"; + homeDir = getEnv "HOME"; + configFile2 = homeDir + "/.nixpkgs/config.nix"; + + configExpr = + if config_ != null then config_ + else if configFile != "" && pathExists configFile then import (toPath configFile) + else if homeDir != "" && pathExists configFile2 then import (toPath configFile2) + else {}; + + in + # allow both: + # { /* the config */ } and + # { pkgs, ... } : { /* the config */ } + if builtins.isFunction configExpr + then configExpr { inherit pkgs; } + else configExpr; + + # Allow setting the platform in the config file. Otherwise, let's use a reasonable default (pc) + + platformAuto = let + platforms = (import ./platforms.nix); + in + if system == "armv6l-linux" then platforms.raspberrypi + else if system == "armv7l-linux" then platforms.armv7l-hf-multiplatform + else if system == "armv5tel-linux" then platforms.sheevaplug + else if system == "mips64el-linux" then platforms.fuloong2f_n32 + else if system == "x86_64-linux" then platforms.pc64 + else if system == "i686-linux" then platforms.pc32 + else platforms.pcBase; + + platform = if platform_ != null then platform_ + else config.platform or platformAuto; + + topLevelArguments = { + inherit system bootStdenv noSysDirs gccWithCC gccWithProfiling config + crossSystem platform lib; + }; + + # 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 `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 = pkgsWithOverrides (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 + # implement some staged compilation of the stdenv. + # + # 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. + stdenvOverrides = pkgs: + lib.optionalAttrs (crossSystem == null && pkgs.stdenv ? overrides) + (pkgs.stdenv.overrides pkgs); + + # Return the complete set of packages, after applying the overrides + # returned by the `overrider' function (see above). Warning: this + # function is very expensive! + pkgsWithOverrides = overrider: + let + # The un-overriden packages, passed to `overrider'. + pkgs_6 = pkgsFun pkgs; + + pkgs_7 = pkgs_6 // overrider pkgs pkgs_6; + + # The overriden, final packages. + pkgs = pkgs_7 // stdenvOverrides pkgs_6; + in pkgs; + + # The package compositions. Yes, this isn't properly indented. + pkgsFun = pkgs: + let + # Helper functions that are exported through `pkgs'. + helperFunctions = + stdenvAdapters // + (import ../build-support/trivial-builders.nix { inherit lib; inherit (pkgs) stdenv; inherit (pkgs.xorg) lndir; }); + + stdenvAdapters = + import ../stdenv/adapters.nix pkgs; + + stdenvDefault = (import ./stdenv.nix topLevelArguments) {} pkgs; + + selfArgs = topLevelArguments // { inherit pkgsWithOverrides stdenvAdapters helperFunctions; }; + self = (import ./all-packages.nix selfArgs) self pkgs; + + aliases = import ./aliases.nix self; + + in + helperFunctions // stdenvDefault // self // aliases; + +in + pkgs -- cgit 1.4.1 From 5cdaa7b90766f69e8fee9eb2a2ce1cbb1c22624a Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Sun, 20 Mar 2016 16:41:20 +0000 Subject: Remove all-packages.nix helperFunctions dependency. --- pkgs/build-support/dotnetbuildhelpers/default.nix | 4 ++-- pkgs/top-level/all-packages.nix | 6 ++---- pkgs/top-level/default.nix | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/build-support/dotnetbuildhelpers/default.nix b/pkgs/build-support/dotnetbuildhelpers/default.nix index ed0d4f790c8..0edfd0b467a 100644 --- a/pkgs/build-support/dotnetbuildhelpers/default.nix +++ b/pkgs/build-support/dotnetbuildhelpers/default.nix @@ -1,5 +1,5 @@ -{ helperFunctions, mono, pkgconfig }: - helperFunctions.runCommand +{ runCommand, mono, pkgconfig }: + runCommand "dotnetbuildhelpers" { preferLocalBuild = true; } '' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 18fc8b95811..e8b659586c2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1,6 +1,6 @@ { system, bootStdenv, noSysDirs, gccWithCC, gccWithProfiling , config, crossSystem, platform, lib -, pkgsWithOverrides, stdenvAdapters, helperFunctions +, pkgsWithOverrides, stdenvAdapters , ... }: self: pkgs: @@ -151,9 +151,7 @@ in dotnetfx = dotnetfx40; }; - dotnetbuildhelpers = callPackage ../build-support/dotnetbuildhelpers { - inherit helperFunctions; - }; + dotnetbuildhelpers = callPackage ../build-support/dotnetbuildhelpers { }; dispad = callPackage ../tools/X11/dispad { }; diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix index acce228ddff..8b499b96215 100644 --- a/pkgs/top-level/default.nix +++ b/pkgs/top-level/default.nix @@ -123,7 +123,7 @@ let stdenvDefault = (import ./stdenv.nix topLevelArguments) {} pkgs; - selfArgs = topLevelArguments // { inherit pkgsWithOverrides stdenvAdapters helperFunctions; }; + selfArgs = topLevelArguments // { inherit pkgsWithOverrides stdenvAdapters; }; self = (import ./all-packages.nix selfArgs) self pkgs; aliases = import ./aliases.nix self; -- cgit 1.4.1 From 01693ac154138e95324959d260056312021e0dae Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Sun, 20 Mar 2016 17:50:06 +0000 Subject: Move stdenvAdapaters attribute from all-packages.nix into the stdenvAdapters of the top-level. --- pkgs/top-level/all-packages.nix | 4 ++-- pkgs/top-level/default.nix | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'pkgs/top-level/all-packages.nix') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e8b659586c2..14e87053387 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1,6 +1,6 @@ { system, bootStdenv, noSysDirs, gccWithCC, gccWithProfiling , config, crossSystem, platform, lib -, pkgsWithOverrides, stdenvAdapters +, pkgsWithOverrides , ... }: self: pkgs: @@ -74,7 +74,7 @@ in ### Helper functions. - inherit lib config stdenvAdapters; + inherit lib config; inherit (lib) lowPrio hiPrio appendToName makeOverridable; inherit (misc) versionedDerivation; diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix index 58b2a75f0d2..0e9f7ecf056 100644 --- a/pkgs/top-level/default.nix +++ b/pkgs/top-level/default.nix @@ -114,14 +114,16 @@ let pkgsWithOverrides = overrider: let stdenvAdapters = - import ../stdenv/adapters.nix pkgs; + let res = import ../stdenv/adapters.nix pkgs; in res // { + stdenvAdapters = res; + }; trivialBuilders = (import ../build-support/trivial-builders.nix { inherit lib; inherit (pkgs) stdenv; inherit (pkgs.xorg) lndir; }); stdenvDefault = (import ./stdenv.nix topLevelArguments) {} pkgs; - selfArgs = topLevelArguments // { inherit pkgsWithOverrides stdenvAdapters; }; + selfArgs = topLevelArguments // { inherit pkgsWithOverrides; }; self = (import ./all-packages.nix selfArgs) self pkgs; aliases = import ./aliases.nix self; -- cgit 1.4.1