From ce56c99edcbc1b61ec2fc2ccfc7bfc035cbcb99f Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Wed, 1 Mar 2017 16:09:18 +0200 Subject: mkDerivation: Don't pass buildInputs to stdenv builder in nativeBuildInputs When not cross compiling, nativeBuildInputs and buildInputs have identical behaviour. Currently that is implemented by having mkDerivation do a concatenation of those variables in Nix code and pass that to the builder via the nativeBuildInputs attribute. However, that has some annoying side effects, like `foo.buildInputs` evaluating to `[ ]` even if buildInputs were specified in the nix expression for foo. Instead, pass buildInputs and nativeBuildInputs in separate variables as usual, and move the logic of cross compilation vs. native compilation to the stdenv builder script. This is probably a tiny bit uglier but fixes the previous problem. Issue #4855. --- pkgs/stdenv/generic/default.nix | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'pkgs/stdenv/generic/default.nix') diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index cb94db48f4bdc..69bcd6490594a 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -264,18 +264,16 @@ let __ignoreNulls = true; # Inputs built by the cross compiler. - buildInputs = if crossConfig != null then buildInputs' else []; - propagatedBuildInputs = if crossConfig != null then propagatedBuildInputs' else []; + buildInputs = buildInputs'; + propagatedBuildInputs = propagatedBuildInputs'; # Inputs built by the usual native compiler. nativeBuildInputs = nativeBuildInputs' - ++ lib.optionals (crossConfig == null) buildInputs' ++ lib.optional (result.isCygwin || (crossConfig != null && lib.hasSuffix "mingw32" crossConfig)) ../../build-support/setup-hooks/win-dll-link.sh ; - propagatedNativeBuildInputs = propagatedNativeBuildInputs' ++ - (if crossConfig == null then propagatedBuildInputs' else []); + propagatedNativeBuildInputs = propagatedNativeBuildInputs'; } // ifDarwin { # TODO: remove lib.unique once nix has a list canonicalization primitive __sandboxProfile = -- cgit 1.4.1