Skip to content

Commit

Permalink
make-derivation: add disallowedReferences in strictDeps
Browse files Browse the repository at this point in the history
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
  • Loading branch information
matthewbauer committed Nov 3, 2018
1 parent a423464 commit 8dbfb61
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkgs/stdenv/generic/make-derivation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

1 comment on commit 8dbfb61

@nixos-discourse
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Nix community. There might be relevant details there:

https://discourse.nixos.org/t/introducing-error-codes/1469/4

Please sign in to comment.