diff options
author | John Ericson <Ericson2314@Yahoo.com> | 2016-11-27 12:32:56 -0800 |
---|---|---|
committer | John Ericson <jericson@galois.com> | 2016-11-30 19:04:22 -0500 |
commit | 07a2b17cbf541c485e04f1a8ec98ffe8c24ac713 (patch) | |
tree | d9505361a7a9c9502cbba76f9428b8ebe81a6bad /pkgs/top-level/default.nix | |
parent | 2df990967be3c21f074c56682f8fa47bdd7cba7b (diff) | |
download | nixpkgs-07a2b17cbf541c485e04f1a8ec98ffe8c24ac713.tar nixpkgs-07a2b17cbf541c485e04f1a8ec98ffe8c24ac713.tar.gz nixpkgs-07a2b17cbf541c485e04f1a8ec98ffe8c24ac713.tar.bz2 nixpkgs-07a2b17cbf541c485e04f1a8ec98ffe8c24ac713.tar.lz nixpkgs-07a2b17cbf541c485e04f1a8ec98ffe8c24ac713.tar.xz nixpkgs-07a2b17cbf541c485e04f1a8ec98ffe8c24ac713.tar.zst nixpkgs-07a2b17cbf541c485e04f1a8ec98ffe8c24ac713.zip |
top-level: Split some of `pkgs/top-level/default.nix` to `pkgs/top-level/stage.nix`
This is preparation for the latter just building a single stage, and the former building a package set with the bootstrapped stdenv.
Diffstat (limited to 'pkgs/top-level/default.nix')
-rw-r--r-- | pkgs/top-level/default.nix | 98 |
1 files changed, 8 insertions, 90 deletions
diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix index 831b1db0cea..c5b8bbac31c 100644 --- a/pkgs/top-level/default.nix +++ b/pkgs/top-level/default.nix @@ -4,37 +4,22 @@ packages in the Nix Packages collection for some particular platform. */ - { # The system (e.g., `i686-linux') for which to build the packages. system -, # The standard environment to use. Only used for bootstrapping. If - # null, the default standard environment is used. - bootStdenv ? null - -, # This is used because stdenv replacement and the stdenvCross do benefit from - # the overridden configuration provided by the user, as opposed to the normal - # bootstrapping stdenvs. - allowCustomOverrides ? (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") - , # Allow a configuration attribute set to be passed in as an argument. config ? {} , crossSystem ? null , platform ? null +, ... } @ args: +let # Rename the function arguments + configExpr = config; + platform_ = platform; -let configExpr = config; platform_ = platform; in # rename the function arguments - -let +in let lib = import ../../lib; # Allow both: @@ -72,75 +57,8 @@ let # deterministically inferred the same way. nixpkgsFun = newArgs: import ./. (args // newArgs); - stdenvAdapters = self: super: - let res = import ../stdenv/adapters.nix self; in res // { - stdenvAdapters = res; - }; - - trivialBuilders = self: super: - import ../build-support/trivial-builders.nix { - inherit lib; inherit (self) stdenv stdenvNoCC; inherit (self.xorg) lndir; - }; - - stdenvDefault = self: super: - import ./stdenv.nix { - inherit system bootStdenv crossSystem config platform lib nixpkgsFun; - }; - - allPackages = self: super: - let res = import ./all-packages.nix - { inherit system noSysDirs config crossSystem platform lib nixpkgsFun; } - res self; - in res; - - aliases = self: super: import ./aliases.nix super; - - # stdenvOverrides is used to avoid circular dependencies for building - # the standard build environment. This mechanism uses 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 overridden packages will not be built with the - # crossStdenv adapter. - stdenvOverrides = self: super: - lib.optionalAttrs (crossSystem == null && super.stdenv ? overrides) - (super.stdenv.overrides super); - - # Allow packages to be overridden globally via the `packageOverrides' - # configuration option, which must be a function that takes `pkgs' - # as an argument and returns a set of new or overridden packages. - # The `packageOverrides' function is called with the *original* - # (un-overridden) set of packages, allowing packageOverrides - # attributes to refer to the original attributes (e.g. "foo = - # ... pkgs.foo ..."). - configOverrides = self: super: - lib.optionalAttrs allowCustomOverrides - ((config.packageOverrides or (super: {})) super); - - # The complete chain of package set builders, applied from top to bottom - toFix = lib.foldl' (lib.flip lib.extends) (self: {}) [ - stdenvAdapters - trivialBuilders - stdenvDefault - allPackages - aliases - stdenvOverrides - configOverrides - ]; - - # Use `overridePackages` to easily override this package set. - # Warning: this function is very expensive and must not be used - # from within the nixpkgs repository. - # - # Example: - # pkgs.overridePackages (self: super: { - # foo = super.foo.override { ... }; - # } - # - # The result is `pkgs' where all the derivations depending on `foo' - # will use the new version. + pkgs = import ./stage.nix ({ + inherit lib nixpkgsFun config platform; + } // args); - # Return the complete set of packages. Warning: this function is very - # expensive! - pkgs = lib.makeExtensibleWithCustomName "overridePackages" toFix; in pkgs |