summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>2017-08-18 05:07:03 +0300
committerTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>2017-08-18 13:21:56 +0300
commit7320fa9d4581e634fec4db848d7a4d157a51303d (patch)
treebf13c19fab45fd47363661a48e3050e9ab40a0eb /pkgs/stdenv
parent6a60cca7ab2ed7f69528b5ae961211853e91905f (diff)
downloadnixlib-7320fa9d4581e634fec4db848d7a4d157a51303d.tar
nixlib-7320fa9d4581e634fec4db848d7a4d157a51303d.tar.gz
nixlib-7320fa9d4581e634fec4db848d7a4d157a51303d.tar.bz2
nixlib-7320fa9d4581e634fec4db848d7a4d157a51303d.tar.lz
nixlib-7320fa9d4581e634fec4db848d7a4d157a51303d.tar.xz
nixlib-7320fa9d4581e634fec4db848d7a4d157a51303d.tar.zst
nixlib-7320fa9d4581e634fec4db848d7a4d157a51303d.zip
Revert "stdenvs: Distinguish between `extraBuildInputs` and `extraNativeBuildInputs`"
This reverts commit eeabf85780e7fccc0289b4015b695e28ef166ab7.

This change suddenly makes tons of stdenv internals visible in
nativeBuildInputs of every derivation, which doesn't seem desirable.
E.g:

````
nix-repl> hello.nativeBuildInputs
[ «derivation /nix/store/bcfkyf6bhssxd2vzwgzmsbn7b5b9rpxc-patchelf-0.9.drv»
  «derivation /nix/store/4wnshnz9wwanpfzcrdd76rri7pyqn9sk-paxctl-0.9.drv»
  << snip 10+ lines >>
  «derivation /nix/store/d35pgh1lcg5nm0x28d899pxj30b8c9b2-gcc-wrapper-6.4.0.drv»
]
````
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/darwin/default.nix15
-rw-r--r--pkgs/stdenv/generic/builder.sh11
-rw-r--r--pkgs/stdenv/generic/default.nix18
-rw-r--r--pkgs/stdenv/generic/make-derivation.nix8
-rw-r--r--pkgs/stdenv/generic/setup.sh5
-rw-r--r--pkgs/stdenv/linux/default.nix10
-rw-r--r--pkgs/stdenv/native/default.nix8
7 files changed, 28 insertions, 47 deletions
diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix
index 2eeab14b1c79..74dcf2f009b3 100644
--- a/pkgs/stdenv/darwin/default.nix
+++ b/pkgs/stdenv/darwin/default.nix
@@ -59,12 +59,11 @@ in rec {
   stageFun = step: last: {shell             ? "${bootstrapTools}/bin/bash",
                           overrides         ? (self: super: {}),
                           extraPreHook      ? "",
-                          extraNativeBuildInputs,
                           extraBuildInputs,
                           allowedRequisites ? null}:
     let
       thisStdenv = import ../generic {
-        inherit config shell extraNativeBuildInputs extraBuildInputs;
+        inherit config shell extraBuildInputs;
         allowedRequisites = if allowedRequisites == null then null else allowedRequisites ++ [
           thisStdenv.cc.expand-response-params
         ];
@@ -163,7 +162,6 @@ in rec {
 
     };
 
-    extraNativeBuildInputs = [];
     extraBuildInputs = [];
   };
 
@@ -171,7 +169,6 @@ in rec {
 
   stage1 = prevStage: with prevStage; stageFun 1 prevStage {
     extraPreHook = "export NIX_CFLAGS_COMPILE+=\" -F${bootstrapTools}/Library/Frameworks\"";
-    extraNativeBuildInputs = [];
     extraBuildInputs = [ pkgs.libcxx ];
 
     allowedRequisites =
@@ -198,8 +195,7 @@ in rec {
       export PATH_LOCALE=${pkgs.darwin.locale}/share/locale
     '';
 
-    extraNativeBuildInputs = [ pkgs.xz ];
-    extraBuildInputs = with pkgs; [ darwin.CF libcxx ];
+    extraBuildInputs = with pkgs; [ xz darwin.CF libcxx ];
 
     allowedRequisites =
       [ bootstrapTools ] ++
@@ -230,8 +226,7 @@ in rec {
     # enables patchShebangs above. Unfortunately, patchShebangs ignores our $SHELL setting
     # and instead goes by $PATH, which happens to contain bootstrapTools. So it goes and
     # patches our shebangs back to point at bootstrapTools. This makes sure bash comes first.
-    extraNativeBuildInputs = with pkgs; [ xz pkgs.bash ];
-    extraBuildInputs = with pkgs; [ darwin.CF libcxx ];
+    extraBuildInputs = with pkgs; [ xz darwin.CF libcxx pkgs.bash ];
 
     extraPreHook = ''
       export PATH=${pkgs.bash}/bin:$PATH
@@ -265,8 +260,7 @@ in rec {
 
   stage4 = prevStage: with prevStage; stageFun 4 prevStage {
     shell = "${pkgs.bash}/bin/bash";
-    extraNativeBuildInputs = with pkgs; [ xz pkgs.bash ];
-    extraBuildInputs = with pkgs; [ darwin.CF libcxx ];
+    extraBuildInputs = with pkgs; [ xz darwin.CF libcxx pkgs.bash ];
     extraPreHook = ''
       export PATH_LOCALE=${pkgs.darwin.locale}/share/locale
     '';
@@ -327,7 +321,6 @@ in rec {
       libc = pkgs.darwin.Libsystem;
     };
 
-    extraNativeBuildInputs = [];
     extraBuildInputs = with pkgs; [ darwin.CF libcxx ];
 
     extraAttrs = {
diff --git a/pkgs/stdenv/generic/builder.sh b/pkgs/stdenv/generic/builder.sh
index bc8f23333f78..42e1a029e584 100644
--- a/pkgs/stdenv/generic/builder.sh
+++ b/pkgs/stdenv/generic/builder.sh
@@ -6,20 +6,15 @@ done
 
 mkdir $out
 
-# Buid the setup script
 echo "export SHELL=$shell" > $out/setup
 echo "initialPath=\"$initialPath\"" >> $out/setup
+echo "defaultNativeBuildInputs=\"$defaultNativeBuildInputs\"" >> $out/setup
 echo "$preHook" >> $out/setup
 cat "$setup" >> $out/setup
 
 # Allow the user to install stdenv using nix-env and get the packages
 # in stdenv.
-mkdir -p "$out/nix-support"
-echo '# Hack to induce runtime dependencies on the default inputs' \
-    > "$out/nix-support/default-inputs.txt"
-printf '%s\n' $defaultNativeBuildInputs $defaultBuildInputs \
-    >> "$out/nix-support/default-inputs.txt"
+mkdir $out/nix-support
 if [ "$propagatedUserEnvPkgs" ]; then
-    printf '%s ' $propagatedUserEnvPkgs \
-        > "$out/nix-support/propagated-user-env-packages"
+    printf '%s ' $propagatedUserEnvPkgs > $out/nix-support/propagated-user-env-packages
 fi
diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix
index 17bf1f8b428c..a5d3c5a8ff5c 100644
--- a/pkgs/stdenv/generic/default.nix
+++ b/pkgs/stdenv/generic/default.nix
@@ -9,7 +9,6 @@ let lib = import ../../../lib; in lib.makeOverridable (
 
 , setupScript ? ./setup.sh
 
-, extraNativeBuildInputs ? []
 , extraBuildInputs ? []
 , __stdenvImpureHostDeps ? []
 , __extraImpureHostDeps ? []
@@ -42,7 +41,7 @@ let lib = import ../../../lib; in lib.makeOverridable (
 }:
 
 let
-  defaultNativeBuildInputs = extraNativeBuildInputs ++
+  defaultNativeBuildInputs = extraBuildInputs ++
     [ ../../build-support/setup-hooks/move-docs.sh
       ../../build-support/setup-hooks/compress-man-pages.sh
       ../../build-support/setup-hooks/strip.sh
@@ -59,16 +58,11 @@ let
       cc
     ];
 
-  defaultBuildInputs = extraBuildInputs;
-
   # The stdenv that we are producing.
   stdenv =
     derivation (
-    lib.optionalAttrs (allowedRequisites != null) {
-      allowedRequisites = allowedRequisites
-        ++ defaultNativeBuildInputs ++ defaultBuildInputs;
-    }
-    // {
+    (if isNull allowedRequisites then {} else { allowedRequisites = allowedRequisites ++ defaultNativeBuildInputs; }) //
+    {
       inherit name;
 
       # Nix itself uses the `system` field of a derivation to decide where to
@@ -81,8 +75,7 @@ let
 
       setup = setupScript;
 
-      inherit preHook initialPath shell
-        defaultNativeBuildInputs defaultBuildInputs;
+      inherit preHook initialPath shell defaultNativeBuildInputs;
     }
     // lib.optionalAttrs buildPlatform.isDarwin {
       __sandboxProfile = stdenvSandboxProfile;
@@ -98,8 +91,7 @@ let
 
       inherit buildPlatform hostPlatform targetPlatform;
 
-      inherit extraNativeBuildInputs extraBuildInputs
-        __extraImpureHostDeps extraSandboxProfile;
+      inherit extraBuildInputs __extraImpureHostDeps extraSandboxProfile;
 
       # Utility flags to test the type of platform.
       inherit (hostPlatform)
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix
index 0f76e09469fc..74d387e353c5 100644
--- a/pkgs/stdenv/generic/make-derivation.nix
+++ b/pkgs/stdenv/generic/make-derivation.nix
@@ -44,10 +44,10 @@ rec {
     , ... } @ attrs:
     let
       dependencies = map lib.chooseDevOutputs [
-        (map (drv: drv.nativeDrv or drv) (nativeBuildInputs ++ stdenv.defaultNativeBuildInputs)
+        (map (drv: drv.nativeDrv or drv) nativeBuildInputs
            ++ lib.optional separateDebugInfo ../../build-support/setup-hooks/separate-debug-info.sh
            ++ lib.optional stdenv.hostPlatform.isWindows ../../build-support/setup-hooks/win-dll-link.sh)
-        (map (drv: drv.crossDrv or drv) (buildInputs ++ stdenv.defaultBuildInputs))
+        (map (drv: drv.crossDrv or drv) buildInputs)
       ];
       propagatedDependencies = map lib.chooseDevOutputs [
         (map (drv: drv.nativeDrv or drv) propagatedNativeBuildInputs)
@@ -65,11 +65,11 @@ rec {
            "sandboxProfile" "propagatedSandboxProfile"])
         // (let
           computedSandboxProfile =
-            lib.concatMap (input: input.__propagatedSandboxProfile or []) (lib.concatLists dependencies);
+            lib.concatMap (input: input.__propagatedSandboxProfile or []) (stdenv.extraBuildInputs ++ lib.concatLists dependencies);
           computedPropagatedSandboxProfile =
             lib.concatMap (input: input.__propagatedSandboxProfile or []) (lib.concatLists propagatedDependencies);
           computedImpureHostDeps =
-            lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (lib.concatLists dependencies));
+            lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (stdenv.extraBuildInputs ++ lib.concatLists dependencies));
           computedPropagatedImpureHostDeps =
             lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (lib.concatLists propagatedDependencies));
         in
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index c8313b7ce236..b6bca3e1f562 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -317,17 +317,18 @@ if [ -z "$crossConfig" ]; then
     # are handled identically to nativeBuildInputs
     declare -a nativePkgs
     for i in $nativeBuildInputs $buildInputs \
+             $defaultNativeBuildInputs $defaultBuildInputs \
              $propagatedNativeBuildInputs $propagatedBuildInputs; do
         findInputs "$i" nativePkgs propagated-native-build-inputs
     done
 else
     declare -a crossPkgs
-    for i in $buildInputs $propagatedBuildInputs; do
+    for i in $buildInputs $defaultBuildInputs $propagatedBuildInputs; do
         findInputs "$i" crossPkgs propagated-build-inputs
     done
 
     declare -a nativePkgs
-    for i in $nativeBuildInputs $propagatedNativeBuildInputs; do
+    for i in $nativeBuildInputs $defaultNativeBuildInputs $propagatedNativeBuildInputs; do
         findInputs "$i" nativePkgs propagated-native-build-inputs
     done
 fi
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index 0167e51f2fdd..61262e1a64e5 100644
--- a/pkgs/stdenv/linux/default.nix
+++ b/pkgs/stdenv/linux/default.nix
@@ -47,7 +47,7 @@ let
   # the bootstrap.  In all stages, we build an stdenv and the package
   # set that can be built with that stdenv.
   stageFun = prevStage:
-    { name, overrides ? (self: super: {}), extraNativeBuildInputs ? [] }:
+    { name, overrides ? (self: super: {}), extraBuildInputs ? [] }:
 
     let
 
@@ -56,7 +56,7 @@ let
         buildPlatform = localSystem;
         hostPlatform = localSystem;
         targetPlatform = localSystem;
-        inherit config extraNativeBuildInputs;
+        inherit config extraBuildInputs;
         preHook =
           ''
             # Don't patch #!/interpreter because it leads to retained
@@ -219,7 +219,7 @@ in
         isl = isl_0_14;
       };
     };
-    extraNativeBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++
+    extraBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++
       # Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
       lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook;
   })
@@ -253,7 +253,7 @@ in
         shell = self.bash + "/bin/bash";
       };
     };
-    extraNativeBuildInputs = [ prevStage.patchelf prevStage.xz ] ++
+    extraBuildInputs = [ prevStage.patchelf prevStage.xz ] ++
       # Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
       lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook;
   })
@@ -283,7 +283,7 @@ in
       initialPath =
         ((import ../common-path.nix) {pkgs = prevStage;});
 
-      extraNativeBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++
+      extraBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++
         # Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
         lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook;
 
diff --git a/pkgs/stdenv/native/default.nix b/pkgs/stdenv/native/default.nix
index 9ecb56028bc0..02734f2f3e59 100644
--- a/pkgs/stdenv/native/default.nix
+++ b/pkgs/stdenv/native/default.nix
@@ -66,7 +66,7 @@ let
     export lt_cv_deplibs_check_method=pass_all
   '';
 
-  extraNativeBuildInputsCygwin = [
+  extraBuildInputsCygwin = [
     ../cygwin/all-buildinputs-as-runtimedep.sh
     ../cygwin/wrap-exes-to-find-dlls.sh
   ] ++ (if system == "i686-cygwin" then [
@@ -94,9 +94,9 @@ let
         if system == "x86_64-cygwin" then prehookCygwin else
         prehookBase;
 
-      extraNativeBuildInputs =
-        if system == "i686-cygwin" then extraNativeBuildInputsCygwin else
-        if system == "x86_64-cygwin" then extraNativeBuildInputsCygwin else
+      extraBuildInputs =
+        if system == "i686-cygwin" then extraBuildInputsCygwin else
+        if system == "x86_64-cygwin" then extraBuildInputsCygwin else
         [];
 
       initialPath = extraPath ++ path;