diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 5dddbde9eec..648b8b4ffa9 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -66,7 +66,7 @@ let else null; expand-response-params = - if buildPackages.stdenv.cc or null != null && buildPackages.stdenv.cc != "/dev/null" + if buildPackages ? stdenv && buildPackages.stdenv.hasCC && buildPackages.stdenv.cc != "/dev/null" then import ../expand-response-params { inherit (buildPackages) stdenv; } else ""; diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 9851602179c..a4ece85e619 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -59,7 +59,7 @@ let infixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config; expand-response-params = - if buildPackages.stdenv.cc or null != null && buildPackages.stdenv.cc != "/dev/null" + if buildPackages.stdenv.hasCC && buildPackages.stdenv.cc != "/dev/null" then import ../expand-response-params { inherit (buildPackages) stdenv; } else ""; diff --git a/pkgs/development/interpreters/perl/default.nix b/pkgs/development/interpreters/perl/default.nix index 2ecc5cbb2ef..5ad19ce9f3d 100644 --- a/pkgs/development/interpreters/perl/default.nix +++ b/pkgs/development/interpreters/perl/default.nix @@ -136,7 +136,7 @@ let substituteInPlace "$out"/lib/perl5/*/*/Config_heavy.pl \ --replace "${libcInc}" /no-such-path \ --replace "${ - if stdenv.cc.cc or null != null then stdenv.cc.cc else "/no-such-path" + if stdenv.hasCC then stdenv.cc.cc else "/no-such-path" }" /no-such-path \ --replace "${stdenv.cc}" /no-such-path \ --replace "$man" /no-such-path diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 2f43db9cfc2..befeb450997 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -1,6 +1,15 @@ let lib = import ../../../lib; in lib.makeOverridable ( -{ name ? "stdenv", preHook ? "", initialPath, cc, shell +{ name ? "stdenv", preHook ? "", initialPath + +, # If we don't have a C compiler, we might either have `cc = null` or `cc = + # throw ...`, but if we do have a C compiler we should definiely have `cc != + # null`. + # + # TODO(@Ericson2314): Add assert without creating infinite recursion + hasCC ? cc != null, cc + +, shell , allowedRequisites ? null, extraAttrs ? {}, overrides ? (self: super: {}), config , # The `fetchurl' to use for downloading curl and its dependencies @@ -57,7 +66,8 @@ let ../../build-support/setup-hooks/move-sbin.sh ../../build-support/setup-hooks/move-lib64.sh ../../build-support/setup-hooks/set-source-date-epoch-to-latest.sh - cc + # TODO use lib.optional instead + (if hasCC then cc else null) ]; defaultBuildInputs = extraBuildInputs; @@ -145,7 +155,7 @@ let inherit overrides; - inherit cc; + inherit cc hasCC; } # Propagate any extra attributes. For instance, we use this to