stdenvs: Distinguish between `extraBuildInputs` and `extraNativeBuildInputs`

This version continues to use bash + stdenv/setup for the default
inputs.

+46 -22
+11 -4
pkgs/stdenv/darwin/default.nix
··· 59 59 stageFun = step: last: {shell ? "${bootstrapTools}/bin/bash", 60 60 overrides ? (self: super: {}), 61 61 extraPreHook ? "", 62 + extraNativeBuildInputs, 62 63 extraBuildInputs, 63 64 allowedRequisites ? null}: 64 65 let 65 66 thisStdenv = import ../generic { 66 - inherit config shell extraBuildInputs; 67 + inherit config shell extraNativeBuildInputs extraBuildInputs; 67 68 allowedRequisites = if allowedRequisites == null then null else allowedRequisites ++ [ 68 69 thisStdenv.cc.expand-response-params 69 70 ]; ··· 162 163 163 164 }; 164 165 166 + extraNativeBuildInputs = []; 165 167 extraBuildInputs = []; 166 168 }; 167 169 ··· 169 171 170 172 stage1 = prevStage: with prevStage; stageFun 1 prevStage { 171 173 extraPreHook = "export NIX_CFLAGS_COMPILE+=\" -F${bootstrapTools}/Library/Frameworks\""; 174 + extraNativeBuildInputs = []; 172 175 extraBuildInputs = [ pkgs.libcxx ]; 173 176 174 177 allowedRequisites = ··· 195 198 export PATH_LOCALE=${pkgs.darwin.locale}/share/locale 196 199 ''; 197 200 198 - extraBuildInputs = with pkgs; [ xz darwin.CF libcxx ]; 201 + extraNativeBuildInputs = [ pkgs.xz ]; 202 + extraBuildInputs = with pkgs; [ darwin.CF libcxx ]; 199 203 200 204 allowedRequisites = 201 205 [ bootstrapTools ] ++ ··· 226 230 # enables patchShebangs above. Unfortunately, patchShebangs ignores our $SHELL setting 227 231 # and instead goes by $PATH, which happens to contain bootstrapTools. So it goes and 228 232 # patches our shebangs back to point at bootstrapTools. This makes sure bash comes first. 229 - extraBuildInputs = with pkgs; [ xz darwin.CF libcxx pkgs.bash ]; 233 + extraNativeBuildInputs = with pkgs; [ xz pkgs.bash ]; 234 + extraBuildInputs = with pkgs; [ darwin.CF libcxx ]; 230 235 231 236 extraPreHook = '' 232 237 export PATH=${pkgs.bash}/bin:$PATH ··· 260 265 261 266 stage4 = prevStage: with prevStage; stageFun 4 prevStage { 262 267 shell = "${pkgs.bash}/bin/bash"; 263 - extraBuildInputs = with pkgs; [ xz darwin.CF libcxx pkgs.bash ]; 268 + extraNativeBuildInputs = with pkgs; [ xz pkgs.bash ]; 269 + extraBuildInputs = with pkgs; [ darwin.CF libcxx ]; 264 270 extraPreHook = '' 265 271 export PATH_LOCALE=${pkgs.darwin.locale}/share/locale 266 272 ''; ··· 321 327 libc = pkgs.darwin.Libsystem; 322 328 }; 323 329 330 + extraNativeBuildInputs = []; 324 331 extraBuildInputs = with pkgs; [ darwin.CF libcxx ]; 325 332 326 333 extraAttrs = {
+1
pkgs/stdenv/generic/builder.sh
··· 9 9 echo "export SHELL=$shell" > $out/setup 10 10 echo "initialPath=\"$initialPath\"" >> $out/setup 11 11 echo "defaultNativeBuildInputs=\"$defaultNativeBuildInputs\"" >> $out/setup 12 + echo "defaultBuildInputs=\"$defaultBuildInputs\"" >> $out/setup 12 13 echo "$preHook" >> $out/setup 13 14 cat "$setup" >> $out/setup 14 15
+13 -5
pkgs/stdenv/generic/default.nix
··· 9 9 10 10 , setupScript ? ./setup.sh 11 11 12 + , extraNativeBuildInputs ? [] 12 13 , extraBuildInputs ? [] 13 14 , __stdenvImpureHostDeps ? [] 14 15 , __extraImpureHostDeps ? [] ··· 41 42 }: 42 43 43 44 let 44 - defaultNativeBuildInputs = extraBuildInputs ++ 45 + defaultNativeBuildInputs = extraNativeBuildInputs ++ 45 46 [ ../../build-support/setup-hooks/move-docs.sh 46 47 ../../build-support/setup-hooks/compress-man-pages.sh 47 48 ../../build-support/setup-hooks/strip.sh ··· 58 59 cc 59 60 ]; 60 61 62 + defaultBuildInputs = extraBuildInputs; 63 + 61 64 # The stdenv that we are producing. 62 65 stdenv = 63 66 derivation ( 64 - (if isNull allowedRequisites then {} else { allowedRequisites = allowedRequisites ++ defaultNativeBuildInputs; }) // 65 - { 67 + lib.optionalAttrs (allowedRequisites != null) { 68 + allowedRequisites = allowedRequisites 69 + ++ defaultNativeBuildInputs ++ defaultBuildInputs; 70 + } 71 + // { 66 72 inherit name; 67 73 68 74 # Nix itself uses the `system` field of a derivation to decide where to ··· 75 81 76 82 setup = setupScript; 77 83 78 - inherit preHook initialPath shell defaultNativeBuildInputs; 84 + inherit preHook initialPath shell 85 + defaultNativeBuildInputs defaultBuildInputs; 79 86 } 80 87 // lib.optionalAttrs buildPlatform.isDarwin { 81 88 __sandboxProfile = stdenvSandboxProfile; ··· 91 98 92 99 inherit buildPlatform hostPlatform targetPlatform; 93 100 94 - inherit extraBuildInputs __extraImpureHostDeps extraSandboxProfile; 101 + inherit extraNativeBuildInputs extraBuildInputs 102 + __extraImpureHostDeps extraSandboxProfile; 95 103 96 104 # Utility flags to test the type of platform. 97 105 inherit (hostPlatform)
+12 -4
pkgs/stdenv/generic/make-derivation.nix
··· 65 65 "sandboxProfile" "propagatedSandboxProfile"]) 66 66 // (let 67 67 computedSandboxProfile = 68 - lib.concatMap (input: input.__propagatedSandboxProfile or []) (stdenv.extraBuildInputs ++ lib.concatLists dependencies); 68 + lib.concatMap (input: input.__propagatedSandboxProfile or []) 69 + (stdenv.extraNativeBuildInputs 70 + ++ stdenv.extraBuildInputs 71 + ++ lib.concatLists dependencies); 69 72 computedPropagatedSandboxProfile = 70 - lib.concatMap (input: input.__propagatedSandboxProfile or []) (lib.concatLists propagatedDependencies); 73 + lib.concatMap (input: input.__propagatedSandboxProfile or []) 74 + (lib.concatLists propagatedDependencies); 71 75 computedImpureHostDeps = 72 - lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (stdenv.extraBuildInputs ++ lib.concatLists dependencies)); 76 + lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) 77 + (stdenv.extraNativeBuildInputs 78 + ++ stdenv.extraBuildInputs 79 + ++ lib.concatLists dependencies)); 73 80 computedPropagatedImpureHostDeps = 74 - lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (lib.concatLists propagatedDependencies)); 81 + lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) 82 + (lib.concatLists propagatedDependencies)); 75 83 in 76 84 { 77 85 name = name + lib.optionalString
+5 -5
pkgs/stdenv/linux/default.nix
··· 47 47 # the bootstrap. In all stages, we build an stdenv and the package 48 48 # set that can be built with that stdenv. 49 49 stageFun = prevStage: 50 - { name, overrides ? (self: super: {}), extraBuildInputs ? [] }: 50 + { name, overrides ? (self: super: {}), extraNativeBuildInputs ? [] }: 51 51 52 52 let 53 53 ··· 56 56 buildPlatform = localSystem; 57 57 hostPlatform = localSystem; 58 58 targetPlatform = localSystem; 59 - inherit config extraBuildInputs; 59 + inherit config extraNativeBuildInputs; 60 60 preHook = 61 61 '' 62 62 # Don't patch #!/interpreter because it leads to retained ··· 219 219 isl = isl_0_14; 220 220 }; 221 221 }; 222 - extraBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++ 222 + extraNativeBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++ 223 223 # Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64. 224 224 lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook; 225 225 }) ··· 253 253 shell = self.bash + "/bin/bash"; 254 254 }; 255 255 }; 256 - extraBuildInputs = [ prevStage.patchelf prevStage.xz ] ++ 256 + extraNativeBuildInputs = [ prevStage.patchelf prevStage.xz ] ++ 257 257 # Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64. 258 258 lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook; 259 259 }) ··· 283 283 initialPath = 284 284 ((import ../common-path.nix) {pkgs = prevStage;}); 285 285 286 - extraBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++ 286 + extraNativeBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++ 287 287 # Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64. 288 288 lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook; 289 289
+4 -4
pkgs/stdenv/native/default.nix
··· 66 66 export lt_cv_deplibs_check_method=pass_all 67 67 ''; 68 68 69 - extraBuildInputsCygwin = [ 69 + extraNativeBuildInputsCygwin = [ 70 70 ../cygwin/all-buildinputs-as-runtimedep.sh 71 71 ../cygwin/wrap-exes-to-find-dlls.sh 72 72 ] ++ (if system == "i686-cygwin" then [ ··· 94 94 if system == "x86_64-cygwin" then prehookCygwin else 95 95 prehookBase; 96 96 97 - extraBuildInputs = 98 - if system == "i686-cygwin" then extraBuildInputsCygwin else 99 - if system == "x86_64-cygwin" then extraBuildInputsCygwin else 97 + extraNativeBuildInputs = 98 + if system == "i686-cygwin" then extraNativeBuildInputsCygwin else 99 + if system == "x86_64-cygwin" then extraNativeBuildInputsCygwin else 100 100 []; 101 101 102 102 initialPath = extraPath ++ path;