From f734056102ac70e840f624326c582c35298e10a6 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Fri, 12 Jan 2024 17:46:19 +0100 Subject: [PATCH] stdenv: fix evaluation if !stdenv.cc.hasCC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit stdenv.cc may throw, e.g. in the case of pkgsCross.ghcjs where we must not force it for the purpose of attribute accessing (`or` doesn't implicitly tryEval…). Regression introduced in 1a5bd697adecf27385b69352485baa52a6e02fe9. --- pkgs/stdenv/generic/make-derivation.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 78e3f87daabe0..cb1607c5e63aa 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -250,9 +250,10 @@ let "stackprotector" "strictoverflow" ]; - defaultHardeningFlags = stdenv.cc.defaultHardeningFlags or - # fallback safe-ish set of flags - (remove "pie" knownHardeningFlags); + defaultHardeningFlags = + (if stdenv.hasCC then stdenv.cc else {}).defaultHardeningFlags or + # fallback safe-ish set of flags + (remove "pie" knownHardeningFlags); enabledHardeningOptions = if builtins.elem "all" hardeningDisable' then []