1# This file chooses a sane default stdenv given the system, platform, etc.
2#
3# Rather than returning a stdenv, this returns a list of functions---one per
4# each bootstrapping stage. See `./booter.nix` for exactly what this list should
5# contain.
6
7{
8 # Args just for stdenvs' usage
9 lib,
10 # Args to pass on to the pkgset builder, too
11 localSystem,
12 crossSystem,
13 config,
14 overlays,
15 crossOverlays ? [ ],
16}@args:
17
18let
19 # The native (i.e., impure) build environment. This one uses the
20 # tools installed on the system outside of the Nix environment,
21 # i.e., the stuff in /bin, /usr/bin, etc. This environment should
22 # be used with care, since many Nix packages will not build properly
23 # with it (e.g., because they require GNU Make).
24 stagesNative = import ./native args;
25
26 # The Nix build environment.
27 stagesNix = import ./nix (args // { bootStages = stagesNative; });
28
29 stagesFreeBSD = import ./freebsd args;
30
31 # On Linux systems, the standard build environment consists of Nix-built
32 # instances glibc and the `standard' Unix tools, i.e., the Posix utilities,
33 # the GNU C compiler, and so on.
34 stagesLinux = import ./linux args;
35
36 stagesDarwin = import ./darwin args;
37
38 stagesCross = import ./cross args;
39
40 stagesCustom = import ./custom args;
41
42in
43# Select the appropriate stages for the platform `system'.
44if crossSystem != localSystem || crossOverlays != [ ] then
45 stagesCross
46else if config ? replaceStdenv then
47 stagesCustom
48else if localSystem.isLinux then
49 stagesLinux
50else if localSystem.isDarwin then
51 stagesDarwin
52# misc special cases
53else
54 {
55 # switch
56 x86_64-solaris = stagesNix;
57 i686-cygwin = stagesNative;
58 x86_64-cygwin = stagesNative;
59 x86_64-freebsd = stagesFreeBSD;
60 }
61 .${localSystem.system} or stagesNative