at 18.09-beta 56 lines 2.0 kB view raw
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{ # Args just for stdenvs' usage 8 lib 9 # Args to pass on to the pkgset builder, too 10, localSystem, crossSystem, config, overlays 11} @ args: 12 13let 14 # The native (i.e., impure) build environment. This one uses the 15 # tools installed on the system outside of the Nix environment, 16 # i.e., the stuff in /bin, /usr/bin, etc. This environment should 17 # be used with care, since many Nix packages will not build properly 18 # with it (e.g., because they require GNU Make). 19 stagesNative = import ./native args; 20 21 # The Nix build environment. 22 stagesNix = import ./nix (args // { bootStages = stagesNative; }); 23 24 stagesFreeBSD = import ./freebsd args; 25 26 # On Linux systems, the standard build environment consists of Nix-built 27 # instances glibc and the `standard' Unix tools, i.e., the Posix utilities, 28 # the GNU C compiler, and so on. 29 stagesLinux = import ./linux args; 30 31 inherit (import ./darwin args) stagesDarwin; 32 33 stagesCross = import ./cross args; 34 35 stagesCustom = import ./custom args; 36 37 # Select the appropriate stages for the platform `system'. 38in 39 if crossSystem != null then stagesCross 40 else if config ? replaceStdenv then stagesCustom 41 else { # switch 42 "i686-linux" = stagesLinux; 43 "x86_64-linux" = stagesLinux; 44 "armv5tel-linux" = stagesLinux; 45 "armv6l-linux" = stagesLinux; 46 "armv7l-linux" = stagesLinux; 47 "aarch64-linux" = stagesLinux; 48 "mipsel-linux" = stagesLinux; 49 "powerpc-linux" = /* stagesLinux */ stagesNative; 50 "powerpc64le-linux" = stagesLinux; 51 "x86_64-darwin" = stagesDarwin; 52 "x86_64-solaris" = stagesNix; 53 "i686-cygwin" = stagesNative; 54 "x86_64-cygwin" = stagesNative; 55 "x86_64-freebsd" = stagesFreeBSD; 56 }.${localSystem.system} or stagesNative