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`.
This commit is contained in:
Wolfgang Walther
2025-07-20 15:33:56 +02:00
parent f115f69d47
commit 6de5573eb9
+9 -3
View File
@@ -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