@ -9,10 +9,43 @@
import ` pkgs/default.nix ` or ` default . nix ` . * /
{ # The system (e.g., `i686-linux') for which to build the packages.
system
, # the package set used at build-time
{ ## Misc parameters kept the same for all stages
##
# Utility functions, could just import but passing in for efficiency
lib
, # Use to reevaluate Nixpkgs; a dirty hack that should be removed
nixpkgsFun
## Platform parameters
##
## The "build" "host" "target" terminology below comes from GNU Autotools. See
## its documentation for more information on what those words mean. Note that
## each should always be defined, even when not cross compiling.
##
## For purposes of bootstrapping, think of each stage as a "sliding window"
## over a list of platforms. Specifically, the host platform of the previous
## stage becomes the build platform of the current one, and likewise the
## target platform of the previous stage becomes the host platform of the
## current one.
##
, # The platform on which packages are built. Consists of `system`, a
# string (e.g.,`i686-linux') identifying the most import attributes of the
# build platform, and `platform` a set of other details.
buildPlatform
, # The platform on which packages run.
hostPlatform
, # The platform which build tools (especially compilers) build for in this stage,
targetPlatform
## Other parameters
##
, # The package set used at build-time
buildPackages
, # The standard environment to use for building packages.
@ -24,21 +57,19 @@
allowCustomOverrides
, # 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 != " x 8 6 _ 6 4 - f r e e b s d " && system != " i 6 8 6 - f r e e b s d "
&& system != " x 8 6 _ 6 4 - s o l a r i s "
&& system != " x 8 6 _ 6 4 - k f r e e b s d - g n u " )
# outside of the store. Thus, GCC, GFortran, & co. must always look for files
# in standard system directories (/usr/include, etc.)
noSysDirs ? buildPlatform . system != " x 8 6 _ 6 4 - f r e e b s d "
&& buildPlatform . system != " i 6 8 6 - f r e e b s d "
&& buildPlatform . system != " x 8 6 _ 6 4 - s o l a r i s "
&& buildPlatform . system != " x 8 6 _ 6 4 - k f r e e b s d - g n u "
, # The configuration attribute set
config
, overlays # List of overlays to use in the fix-point.
, crossSystem
, platform
, lib
, nixpkgsFun
, # A list of overlays (Additional `self: super: { .. }` customization
# functions) to be fixed together in the produced package set
overlays
} :
let
@ -53,10 +84,24 @@ let
} ;
stdenvBootstappingAndPlatforms = self : super : {
stdenv = stdenv // { inherit platform ; } ;
buildPackages = buildPackages // { recurseForDerivations = false ; } ;
inherit
system platform crossSystem ;
inherit stdenv
buildPlatform hostPlatform targetPlatform ;
} ;
# The old identifiers for cross-compiling. These should eventually be removed,
# and the packages that rely on them refactored accordingly.
platformCompat = self : super : let
# TODO(@Ericson2314) this causes infinite recursion
#inherit (self) buildPlatform hostPlatform targetPlatform;
in {
stdenv = super . stdenv // {
inherit ( buildPlatform ) platform ;
} // lib . optionalAttrs ( targetPlatform != buildPlatform ) {
cross = targetPlatform ;
} ;
inherit ( buildPlatform ) system platform ;
crossSystem = if targetPlatform != buildPlatform then targetPlatform else null ;
} ;
splice = self : super : import ./splice.nix lib self ;
@ -89,6 +134,7 @@ let
# The complete chain of package set builders, applied from top to bottom
toFix = lib . foldl' ( lib . flip lib . extends ) ( self : { } ) ( [
stdenvBootstappingAndPlatforms
platformCompat
stdenvAdapters
trivialBuilders
splice