Merge pull request #15043 from Ericson2314/cross
top-level: simplify stdenv calling of top-level: fewer inferred and re-inferring arguments
This commit is contained in:
commit
e2ff3f160d
@ -1,14 +1,14 @@
|
|||||||
{ system, allPackages, platform, crossSystem, config, ... } @ args:
|
{ lib, allPackages
|
||||||
|
, system, platform, crossSystem, config
|
||||||
|
}:
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
argClobber = {
|
vanillaStdenv = (import ../. {
|
||||||
|
inherit lib allPackages system platform;
|
||||||
crossSystem = null;
|
crossSystem = null;
|
||||||
# Ignore custom stdenvs when cross compiling for compatability
|
# Ignore custom stdenvs when cross compiling for compatability
|
||||||
config = builtins.removeAttrs config [ "replaceStdenv" ];
|
config = builtins.removeAttrs config [ "replaceStdenv" ];
|
||||||
};
|
}) // {
|
||||||
vanillaStdenv = (import ../. (args // argClobber // {
|
|
||||||
allPackages = args: allPackages (argClobber // args);
|
|
||||||
})).stdenv // {
|
|
||||||
# Needed elsewhere as a hacky way to pass the target
|
# Needed elsewhere as a hacky way to pass the target
|
||||||
cross = crossSystem;
|
cross = crossSystem;
|
||||||
};
|
};
|
||||||
@ -17,10 +17,10 @@ rec {
|
|||||||
# be used to build compilers and other such tools targeting the cross
|
# be used to build compilers and other such tools targeting the cross
|
||||||
# platform. Then, `forceNativeDrv` can be removed.
|
# platform. Then, `forceNativeDrv` can be removed.
|
||||||
buildPackages = allPackages {
|
buildPackages = allPackages {
|
||||||
|
inherit system platform crossSystem config;
|
||||||
# It's OK to change the built-time dependencies
|
# It's OK to change the built-time dependencies
|
||||||
allowCustomOverrides = true;
|
allowCustomOverrides = true;
|
||||||
bootStdenv = vanillaStdenv;
|
stdenv = vanillaStdenv;
|
||||||
inherit system platform crossSystem config;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
stdenvCross = buildPackages.makeStdenvCross
|
stdenvCross = buildPackages.makeStdenvCross
|
||||||
|
@ -1,16 +1,21 @@
|
|||||||
{ system, allPackages, platform, crossSystem, config, ... } @ args:
|
{ lib, allPackages
|
||||||
|
, system, platform, crossSystem, config
|
||||||
|
}:
|
||||||
|
|
||||||
|
assert crossSystem == null;
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
vanillaStdenv = (import ../. (args // {
|
vanillaStdenv = import ../. {
|
||||||
|
inherit lib allPackages system platform crossSystem;
|
||||||
# Remove config.replaceStdenv to ensure termination.
|
# Remove config.replaceStdenv to ensure termination.
|
||||||
config = builtins.removeAttrs config [ "replaceStdenv" ];
|
config = builtins.removeAttrs config [ "replaceStdenv" ];
|
||||||
})).stdenv;
|
};
|
||||||
|
|
||||||
buildPackages = allPackages {
|
buildPackages = allPackages {
|
||||||
|
inherit system platform crossSystem config;
|
||||||
# It's OK to change the built-time dependencies
|
# It's OK to change the built-time dependencies
|
||||||
allowCustomOverrides = true;
|
allowCustomOverrides = true;
|
||||||
bootStdenv = vanillaStdenv;
|
stdenv = vanillaStdenv;
|
||||||
inherit system platform crossSystem config;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
stdenvCustom = config.replaceStdenv { pkgs = buildPackages; };
|
stdenvCustom = config.replaceStdenv { pkgs = buildPackages; };
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
{ system ? builtins.currentSystem
|
{ lib, allPackages
|
||||||
, allPackages ? import ../../..
|
, system, platform, crossSystem, config
|
||||||
, platform ? null
|
|
||||||
, config ? {}
|
|
||||||
|
|
||||||
# Allow passing in bootstrap files directly so we can test the stdenv bootstrap process when changing the bootstrap tools
|
# Allow passing in bootstrap files directly so we can test the stdenv bootstrap process when changing the bootstrap tools
|
||||||
, bootstrapFiles ? let
|
, bootstrapFiles ? let
|
||||||
@ -17,12 +15,14 @@
|
|||||||
}
|
}
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
assert crossSystem == null;
|
||||||
|
|
||||||
let
|
let
|
||||||
libSystemProfile = ''
|
libSystemProfile = ''
|
||||||
(import "${./standard-sandbox.sb}")
|
(import "${./standard-sandbox.sb}")
|
||||||
'';
|
'';
|
||||||
in rec {
|
in rec {
|
||||||
allPackages = import ../../..;
|
inherit allPackages;
|
||||||
|
|
||||||
commonPreHook = ''
|
commonPreHook = ''
|
||||||
export NIX_ENFORCE_PURITY="''${NIX_ENFORCE_PURITY-1}"
|
export NIX_ENFORCE_PURITY="''${NIX_ENFORCE_PURITY-1}"
|
||||||
@ -100,8 +100,9 @@ in rec {
|
|||||||
};
|
};
|
||||||
|
|
||||||
thisPkgs = allPackages {
|
thisPkgs = allPackages {
|
||||||
inherit system platform;
|
inherit system platform crossSystem config;
|
||||||
bootStdenv = thisStdenv;
|
allowCustomOverrides = false;
|
||||||
|
stdenv = thisStdenv;
|
||||||
};
|
};
|
||||||
in { stdenv = thisStdenv; pkgs = thisPkgs; };
|
in { stdenv = thisStdenv; pkgs = thisPkgs; };
|
||||||
|
|
||||||
|
@ -332,10 +332,10 @@ in rec {
|
|||||||
};
|
};
|
||||||
|
|
||||||
# The ultimate test: bootstrap a whole stdenv from the tools specified above and get a package set out of it
|
# The ultimate test: bootstrap a whole stdenv from the tools specified above and get a package set out of it
|
||||||
test-pkgs = let
|
test-pkgs = import test-pkgspath {
|
||||||
stdenv = import (test-pkgspath + "/pkgs/stdenv/darwin") { inherit system bootstrapFiles; };
|
|
||||||
in import test-pkgspath {
|
|
||||||
inherit system;
|
inherit system;
|
||||||
bootStdenv = stdenv.stdenvDarwin;
|
stdenv = args: let
|
||||||
|
args' = args // { inherit bootstrapFiles; };
|
||||||
|
in (import (test-pkgspath + "/pkgs/stdenv/darwin") args').stdenvDarwin;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -5,45 +5,48 @@
|
|||||||
# Posix utilities, the GNU C compiler, and so on. On other systems,
|
# Posix utilities, the GNU C compiler, and so on. On other systems,
|
||||||
# we use the native C library.
|
# we use the native C library.
|
||||||
|
|
||||||
{ system, allPackages ? import ../.., platform, config, crossSystem, lib }:
|
{ # Args just for stdenvs' usage
|
||||||
|
lib, allPackages
|
||||||
|
# Args to pass on to `allPacakges` too
|
||||||
rec {
|
, system, platform, crossSystem, config
|
||||||
|
} @ args:
|
||||||
|
|
||||||
|
let
|
||||||
# The native (i.e., impure) build environment. This one uses the
|
# The native (i.e., impure) build environment. This one uses the
|
||||||
# tools installed on the system outside of the Nix environment,
|
# tools installed on the system outside of the Nix environment,
|
||||||
# i.e., the stuff in /bin, /usr/bin, etc. This environment should
|
# i.e., the stuff in /bin, /usr/bin, etc. This environment should
|
||||||
# be used with care, since many Nix packages will not build properly
|
# be used with care, since many Nix packages will not build properly
|
||||||
# with it (e.g., because they require GNU Make).
|
# with it (e.g., because they require GNU Make).
|
||||||
inherit (import ./native { inherit system allPackages config; }) stdenvNative;
|
inherit (import ./native args) stdenvNative;
|
||||||
|
|
||||||
stdenvNativePkgs = allPackages {
|
stdenvNativePkgs = allPackages {
|
||||||
bootStdenv = stdenvNative;
|
inherit system platform crossSystem config;
|
||||||
|
allowCustomOverrides = false;
|
||||||
|
stdenv = stdenvNative;
|
||||||
noSysDirs = false;
|
noSysDirs = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
# The Nix build environment.
|
# The Nix build environment.
|
||||||
stdenvNix = import ./nix {
|
stdenvNix = assert crossSystem == null; import ./nix {
|
||||||
inherit config lib;
|
inherit config lib;
|
||||||
stdenv = stdenvNative;
|
stdenv = stdenvNative;
|
||||||
pkgs = stdenvNativePkgs;
|
pkgs = stdenvNativePkgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
inherit (import ./freebsd { inherit system allPackages platform config; }) stdenvFreeBSD;
|
inherit (import ./freebsd args) stdenvFreeBSD;
|
||||||
|
|
||||||
# Linux standard environment.
|
# Linux standard environment.
|
||||||
inherit (import ./linux { inherit system allPackages platform config lib; }) stdenvLinux;
|
inherit (import ./linux args) stdenvLinux;
|
||||||
|
|
||||||
inherit (import ./darwin { inherit system allPackages platform config; }) stdenvDarwin;
|
inherit (import ./darwin args) stdenvDarwin;
|
||||||
|
|
||||||
inherit (import ./cross { inherit system allPackages platform crossSystem config lib; }) stdenvCross stdenvCrossiOS;
|
inherit (import ./cross args) stdenvCross stdenvCrossiOS;
|
||||||
|
|
||||||
inherit (import ./custom { inherit system allPackages platform crossSystem config lib; }) stdenvCustom;
|
inherit (import ./custom args) stdenvCustom;
|
||||||
|
|
||||||
# Select the appropriate stdenv for the platform `system'.
|
# Select the appropriate stdenv for the platform `system'.
|
||||||
stdenv =
|
in
|
||||||
if crossSystem != null then
|
if crossSystem != null then
|
||||||
if crossSystem.useiOSCross or false then stdenvCrossiOS
|
if crossSystem.useiOSCross or false then stdenvCrossiOS
|
||||||
else stdenvCross else
|
else stdenvCross else
|
||||||
@ -60,5 +63,4 @@ rec {
|
|||||||
if system == "i686-cygwin" then stdenvNative else
|
if system == "i686-cygwin" then stdenvNative else
|
||||||
if system == "x86_64-cygwin" then stdenvNative else
|
if system == "x86_64-cygwin" then stdenvNative else
|
||||||
if system == "x86_64-freebsd" then stdenvFreeBSD else
|
if system == "x86_64-freebsd" then stdenvFreeBSD else
|
||||||
stdenvNative;
|
stdenvNative
|
||||||
}
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
{ system ? builtins.currentSystem
|
{ lib, allPackages
|
||||||
, allPackages ? import ../../..
|
, system, platform, crossSystem, config
|
||||||
, platform ? null
|
|
||||||
, config ? {}
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
assert crossSystem == null;
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
allPackages = import ../../..;
|
inherit allPackages;
|
||||||
|
|
||||||
bootstrapTools = derivation {
|
bootstrapTools = derivation {
|
||||||
inherit system;
|
inherit system;
|
||||||
|
@ -3,11 +3,9 @@
|
|||||||
# external (non-Nix) tools, such as /usr/bin/gcc, and it contains a C
|
# external (non-Nix) tools, such as /usr/bin/gcc, and it contains a C
|
||||||
# compiler and linker that do not search in default locations,
|
# compiler and linker that do not search in default locations,
|
||||||
# ensuring purity of components produced by it.
|
# ensuring purity of components produced by it.
|
||||||
|
{ lib, allPackages
|
||||||
|
, system, platform, crossSystem, config
|
||||||
|
|
||||||
# The function defaults are for easy testing.
|
|
||||||
{ system ? builtins.currentSystem
|
|
||||||
, allPackages ? import ../../..
|
|
||||||
, platform ? null, config ? {}, lib ? (import ../../../lib)
|
|
||||||
, bootstrapFiles ?
|
, bootstrapFiles ?
|
||||||
if system == "i686-linux" then import ./bootstrap/i686.nix
|
if system == "i686-linux" then import ./bootstrap/i686.nix
|
||||||
else if system == "x86_64-linux" then import ./bootstrap/x86_64.nix
|
else if system == "x86_64-linux" then import ./bootstrap/x86_64.nix
|
||||||
@ -18,6 +16,8 @@
|
|||||||
else abort "unsupported platform for the pure Linux stdenv"
|
else abort "unsupported platform for the pure Linux stdenv"
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
assert crossSystem == null;
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
|
|
||||||
commonPreHook =
|
commonPreHook =
|
||||||
@ -106,8 +106,9 @@ rec {
|
|||||||
};
|
};
|
||||||
|
|
||||||
thisPkgs = allPackages {
|
thisPkgs = allPackages {
|
||||||
inherit system platform;
|
inherit system platform crossSystem config;
|
||||||
bootStdenv = thisStdenv;
|
allowCustomOverrides = false;
|
||||||
|
stdenv = thisStdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
in { stdenv = thisStdenv; pkgs = thisPkgs; };
|
in { stdenv = thisStdenv; pkgs = thisPkgs; };
|
||||||
|
@ -175,6 +175,13 @@ rec {
|
|||||||
|
|
||||||
bootstrapTools = (import ./default.nix {
|
bootstrapTools = (import ./default.nix {
|
||||||
inherit system bootstrapFiles;
|
inherit system bootstrapFiles;
|
||||||
|
|
||||||
|
lib = assert false; null;
|
||||||
|
allPackages = assert false; null;
|
||||||
|
|
||||||
|
platform = assert false; null;
|
||||||
|
crossSystem = assert false; null;
|
||||||
|
config = assert false; null;
|
||||||
}).bootstrapTools;
|
}).bootstrapTools;
|
||||||
|
|
||||||
test = derivation {
|
test = derivation {
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
{ system, allPackages ? import ../../.., config }:
|
{ lib, allPackages
|
||||||
|
, system, platform, crossSystem, config
|
||||||
|
}:
|
||||||
|
|
||||||
|
assert crossSystem == null;
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
|
|
||||||
@ -126,8 +130,9 @@ rec {
|
|||||||
} // {inherit fetchurl;};
|
} // {inherit fetchurl;};
|
||||||
|
|
||||||
stdenvBoot1Pkgs = allPackages {
|
stdenvBoot1Pkgs = allPackages {
|
||||||
inherit system;
|
inherit system platform crossSystem config;
|
||||||
bootStdenv = stdenvBoot1;
|
allowCustomOverrides = false;
|
||||||
|
stdenv = stdenvBoot1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,40 +1,40 @@
|
|||||||
/* This file composes the Nix Packages collection. That is, it
|
/* This function composes the Nix Packages collection. 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. */
|
|
||||||
|
|
||||||
|
1. Applies the final stage to the given `config` if it is a function
|
||||||
|
|
||||||
|
2. Infers an appropriate `platform` based on the `system` if none is
|
||||||
|
provided
|
||||||
|
|
||||||
|
3. Defaults to no non-standard config and no cross-compilation target
|
||||||
|
|
||||||
|
4. Uses the above to infer the default standard environment (stdenv) if
|
||||||
|
none is provided
|
||||||
|
|
||||||
|
5. Builds the final stage --- a fully booted package set with the chosen
|
||||||
|
stdenv
|
||||||
|
|
||||||
|
Use `impure.nix` to also infer the `system` based on the one on which
|
||||||
|
evaluation is taking place, and the configuration from environment variables
|
||||||
|
or dot-files. */
|
||||||
|
|
||||||
{ # The system (e.g., `i686-linux') for which to build the packages.
|
{ # The system (e.g., `i686-linux') for which to build the packages.
|
||||||
system
|
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.
|
, # Allow a configuration attribute set to be passed in as an argument.
|
||||||
config ? {}
|
config ? {}
|
||||||
|
|
||||||
|
, # The standard environment for building packages, or rather a function
|
||||||
|
# providing it. See below for the arguments given to that function.
|
||||||
|
stdenv ? assert false; null
|
||||||
|
|
||||||
, crossSystem ? null
|
, crossSystem ? null
|
||||||
, platform ? null
|
, platform ? assert false; null
|
||||||
} @ args:
|
} @ args:
|
||||||
|
|
||||||
|
let # Rename the function arguments
|
||||||
|
configExpr = config;
|
||||||
|
|
||||||
let configExpr = config; platform_ = platform; in # rename the function arguments
|
in let
|
||||||
|
|
||||||
let
|
|
||||||
lib = import ../../lib;
|
lib = import ../../lib;
|
||||||
|
|
||||||
# Allow both:
|
# Allow both:
|
||||||
@ -45,21 +45,12 @@ let
|
|||||||
then configExpr { inherit pkgs; }
|
then configExpr { inherit pkgs; }
|
||||||
else configExpr;
|
else configExpr;
|
||||||
|
|
||||||
# Allow setting the platform in the config file. Otherwise, let's use a reasonable default (pc)
|
# Allow setting the platform in the config file. Otherwise, let's use a
|
||||||
|
# reasonable default.
|
||||||
platformAuto = let
|
platform =
|
||||||
platforms = (import ./platforms.nix);
|
args.platform
|
||||||
in
|
or (config.platform
|
||||||
if system == "armv6l-linux" then platforms.raspberrypi
|
or (import ./platforms.nix).selectPlatformBySystem system);
|
||||||
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;
|
|
||||||
|
|
||||||
# A few packages make a new package set to draw their dependencies from.
|
# A few packages make a new package set to draw their dependencies from.
|
||||||
# (Currently to get a cross tool chain, or forced-i686 package.) Rather than
|
# (Currently to get a cross tool chain, or forced-i686 package.) Rather than
|
||||||
@ -68,79 +59,27 @@ let
|
|||||||
# whatever arguments it doesn't explicitly provide. This way,
|
# whatever arguments it doesn't explicitly provide. This way,
|
||||||
# `all-packages.nix` doesn't know more than it needs too.
|
# `all-packages.nix` doesn't know more than it needs too.
|
||||||
#
|
#
|
||||||
# It's OK that `args` doesn't include the defaults: they'll be
|
# It's OK that `args` doesn't include default arguemtns from this file:
|
||||||
# deterministically inferred the same way.
|
# they'll be deterministically inferred. In fact we must *not* include them,
|
||||||
|
# because it's important that if some parameter which affects the default is
|
||||||
|
# substituted with a different argument, the default is re-inferred.
|
||||||
|
#
|
||||||
|
# To put this in concrete terms, this function is basically just used today to
|
||||||
|
# use package for a different platform for the current platform (namely cross
|
||||||
|
# compiling toolchains and 32-bit packages on x86_64). In both those cases we
|
||||||
|
# want the provided non-native `system` argument to affect the stdenv chosen.
|
||||||
nixpkgsFun = newArgs: import ./. (args // newArgs);
|
nixpkgsFun = newArgs: import ./. (args // newArgs);
|
||||||
|
|
||||||
stdenvAdapters = self: super:
|
# Partially apply some arguments for building bootstraping stage pkgs
|
||||||
let res = import ../stdenv/adapters.nix self; in res // {
|
# sets. Only apply arguments which no stdenv would want to override.
|
||||||
stdenvAdapters = res;
|
allPackages = newArgs: import ./stage.nix ({
|
||||||
};
|
inherit lib nixpkgsFun;
|
||||||
|
} // newArgs);
|
||||||
|
|
||||||
trivialBuilders = self: super:
|
stdenv = (args.stdenv or (import ../stdenv)) {
|
||||||
import ../build-support/trivial-builders.nix {
|
inherit lib allPackages system platform crossSystem config;
|
||||||
inherit lib; inherit (self) stdenv stdenvNoCC; inherit (self.xorg) lndir;
|
};
|
||||||
};
|
|
||||||
|
|
||||||
stdenvDefault = self: super:
|
pkgs = allPackages { inherit system stdenv config crossSystem platform; };
|
||||||
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.
|
|
||||||
|
|
||||||
# Return the complete set of packages. Warning: this function is very
|
|
||||||
# expensive!
|
|
||||||
pkgs = lib.makeExtensibleWithCustomName "overridePackages" toFix;
|
|
||||||
in pkgs
|
in pkgs
|
||||||
|
@ -443,4 +443,12 @@ rec {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
selectPlatformBySystem = system:
|
||||||
|
if system == "armv6l-linux" then raspberrypi
|
||||||
|
else if system == "armv7l-linux" then armv7l-hf-multiplatform
|
||||||
|
else if system == "armv5tel-linux" then sheevaplug
|
||||||
|
else if system == "mips64el-linux" then fuloong2f_n32
|
||||||
|
else if system == "x86_64-linux" then pc64
|
||||||
|
else if system == "i686-linux" then pc32
|
||||||
|
else pcBase;
|
||||||
}
|
}
|
||||||
|
108
pkgs/top-level/stage.nix
Normal file
108
pkgs/top-level/stage.nix
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
/* This file composes a single bootstrapping stage of 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
|
||||||
|
for some particular stage.
|
||||||
|
|
||||||
|
Default arguments are only provided for bootstrapping
|
||||||
|
arguments. Normal users should not import this directly but instead
|
||||||
|
import `pkgs/default.nix` or `default.nix`. */
|
||||||
|
|
||||||
|
|
||||||
|
{ # The system (e.g., `i686-linux') for which to build the packages.
|
||||||
|
system
|
||||||
|
|
||||||
|
, # The standard environment to use for building packages.
|
||||||
|
stdenv
|
||||||
|
|
||||||
|
, # 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 ? true
|
||||||
|
|
||||||
|
, # 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")
|
||||||
|
|
||||||
|
, # The configuration attribute set
|
||||||
|
config
|
||||||
|
|
||||||
|
, crossSystem
|
||||||
|
, platform
|
||||||
|
, lib
|
||||||
|
, nixpkgsFun
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
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:
|
||||||
|
{ stdenv = stdenv // { inherit platform; }; };
|
||||||
|
|
||||||
|
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: {}) [
|
||||||
|
stdenvDefault
|
||||||
|
stdenvAdapters
|
||||||
|
trivialBuilders
|
||||||
|
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.
|
||||||
|
|
||||||
|
# Return the complete set of packages. Warning: this function is very
|
||||||
|
# expensive!
|
||||||
|
in lib.makeExtensibleWithCustomName "overridePackages" toFix
|
@ -1,15 +0,0 @@
|
|||||||
{ system, bootStdenv, crossSystem, config, platform, lib, nixpkgsFun }:
|
|
||||||
|
|
||||||
rec {
|
|
||||||
allStdenvs = import ../stdenv {
|
|
||||||
inherit system platform config crossSystem lib;
|
|
||||||
allPackages = nixpkgsFun;
|
|
||||||
};
|
|
||||||
|
|
||||||
defaultStdenv = allStdenvs.stdenv // { inherit platform; };
|
|
||||||
|
|
||||||
stdenv =
|
|
||||||
if bootStdenv != null
|
|
||||||
then (bootStdenv // { inherit platform; })
|
|
||||||
else defaultStdenv;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user