about summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2018-10-29 13:33:42 -0500
committerMatthew Bauer <mjbauer95@gmail.com>2018-11-02 19:31:51 -0500
commit8dbfb61e4617050917ce6bb7c5f4efc902c2a36c (patch)
tree09b80532e781ecce4f18b846f28db6a050287850 /pkgs/stdenv
parenta4234645fe2445fe503413b159a842dbb280a777 (diff)
downloadnixlib-8dbfb61e4617050917ce6bb7c5f4efc902c2a36c.tar
nixlib-8dbfb61e4617050917ce6bb7c5f4efc902c2a36c.tar.gz
nixlib-8dbfb61e4617050917ce6bb7c5f4efc902c2a36c.tar.bz2
nixlib-8dbfb61e4617050917ce6bb7c5f4efc902c2a36c.tar.lz
nixlib-8dbfb61e4617050917ce6bb7c5f4efc902c2a36c.tar.xz
nixlib-8dbfb61e4617050917ce6bb7c5f4efc902c2a36c.tar.zst
nixlib-8dbfb61e4617050917ce6bb7c5f4efc902c2a36c.zip
make-derivation: add disallowedReferences in strictDeps
When strictDeps = true, we don’t want native build inputs to end up in
the output. For instance gcc is a builtin native build input and
should only show up in an output if it is also listed in buildInputs.

/cc @ericson2314
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/generic/make-derivation.nix16
1 files changed, 16 insertions, 0 deletions
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix
index e06faed30a1e..08a914787c35 100644
--- a/pkgs/stdenv/generic/make-derivation.nix
+++ b/pkgs/stdenv/generic/make-derivation.nix
@@ -226,6 +226,22 @@ rec {
           inherit doCheck doInstallCheck;
 
           inherit outputs;
+        } // lib.optionalAttrs strictDeps {
+          # Make sure "build" dependencies don’t leak into outputs. We
+          # want to disallow references to depsBuildBuild,
+          # nativeBuildInputs, and depsBuildTarget. But depsHostHost,
+          # buildInputs, and depsTargetTarget is okay, so we subtract
+          # those from disallowedReferences in case a dependency is
+          # listed in multiple dependency lists. We also include
+          # propagated dependencies here as well.
+          disallowedReferences = (attrs.disallowedReferences or [])
+          ++ (lib.subtractLists
+              (lib.concatLists ( (lib.elemAt propagatedDependencies 1) ++
+                                 (lib.elemAt dependencies 1) ++
+                                 (lib.elemAt propagatedDependencies 2) ++
+                                 (lib.elemAt dependencies 2) ) )
+              (lib.concatLists ( (lib.elemAt propagatedDependencies 0) ++
+                                 (lib.elemAt dependencies 0) ) ) );
         } // lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) {
           cmakeFlags =
             (/**/ if lib.isString cmakeFlags then [cmakeFlags]