summary refs log blame commit diff
path: root/pkgs/stdenv/cross/default.nix
blob: 125c4300975a0f42d2d4eeb2fcc990514480f335 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
     
                                            
  
 

                            
                                     
                       

                                                                  
    
 

                  
                  
                     



                                 
                      

                                                   
                                     
    
 
                
                   



                                 
                      








                                                 
    
 
 
{ lib
, localSystem, crossSystem, config, overlays
}:

let
  bootStages = import ../. {
    inherit lib localSystem overlays;
    crossSystem = null;
    # Ignore custom stdenvs when cross compiling for compatability
    config = builtins.removeAttrs config [ "replaceStdenv" ];
  };

in bootStages ++ [

  # Build Packages
  (vanillaPackages: {
    buildPlatform = localSystem;
    hostPlatform = localSystem;
    targetPlatform = crossSystem;
    inherit config overlays;
    selfBuild = false;
    # It's OK to change the built-time dependencies
    allowCustomOverrides = true;
    inherit (vanillaPackages) stdenv;
  })

  # Run Packages
  (buildPackages: {
    buildPlatform = localSystem;
    hostPlatform = crossSystem;
    targetPlatform = crossSystem;
    inherit config overlays;
    selfBuild = false;
    stdenv = buildPackages.makeStdenvCross {
      inherit (buildPackages) stdenv;
      buildPlatform = localSystem;
      hostPlatform = crossSystem;
      targetPlatform = crossSystem;
      cc = if crossSystem.useiOSCross or false
           then buildPackages.darwin.ios-cross
           else buildPackages.gccCrossStageFinal;
    };
  })

]