From 6de5573eb944e5ed9af5c484d2244ba66907e3f9 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sat, 19 Jul 2025 11:33:34 +0200 Subject: [PATCH] gccWithoutTargetLibc: move assert to meta.badPlatforms An assert can't be caught by CI for generation of attrpaths during Eval. An error reported via meta.badPlatforms can be. The alternative of returning null in the CI case, similar to the commits before, is not helpful, because it only causes failed builds or eval downstream - when this dependency is passed on and used as `null`. --- pkgs/top-level/all-packages.nix | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ada05947688f..eef806d93839 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5108,11 +5108,10 @@ with pkgs; # The GCC used to build libc for the target platform. Normal gccs will be # built with, and use, that cross-compiled libc. gccWithoutTargetLibc = - assert stdenv.targetPlatform != stdenv.hostPlatform; let libc1 = binutilsNoLibc.libc; in - wrapCCWith { + (wrapCCWith { cc = gccFun { # copy-pasted inherit noSysDirs; @@ -5138,7 +5137,14 @@ with pkgs; bintools = binutilsNoLibc; libc = libc1; extraPackages = [ ]; - }; + }).overrideAttrs + (prevAttrs: { + meta = prevAttrs.meta // { + badPlatforms = + (prevAttrs.meta.badPlatforms or [ ]) + ++ lib.optionals (stdenv.targetPlatform == stdenv.hostPlatform) [ stdenv.hostPlatform.system ]; + }; + }); inherit (callPackage ../development/compilers/gcc/all.nix { inherit noSysDirs; }) gcc9