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