Clean up cross bootstrapping

For a long time, we've had `crossLibcStdenv`, `*Cross` libc attributes,
and `*bsdCross` pre-libc package sets. This was always bad because
having "cross" things is "not declarative": the naming doesn't reflect
what packages *need* but rather how we *provide* something. This is
ugly, and creates needless friction between cross and native building.

Now, almost all of these `*Cross` attributes are gone: just these are
kept:

- Glibc's and Musl's are kept, because those packages are widely used
and I didn't want to risk changing the native builds of those at this
time.

- generic `libcCross`, `theadsCross`, and friends, because these relate
to the convolulted GCC bootstrap which still needs to be redone.

The BSD and obscure Linux or freestnanding libcs have conversely all
been made to use a new `stdenvNoLibc`, which is like the old
`crossLibcStdenv` except:

1. It usable for native and cross alike

2. It named according to what it *is* ("a standard environment without
libc but with a C compiler"), rather than some non-compositional
jargon ("the stdenv used for building libc when cross compiling",
yuck).

I should have done this change long ago, but I was stymied because of
"infinite recursions". The problem was that in too many cases we are
overriding `stdenv` to *remove* things we don't need, and this risks
cyles since those more minimal stdenvs are used to build things in the
more maximal stdenvs.

The solution is to pass `stage.nix` `stdenvNoCC`, so we can override to
*build up* rather than *tear down*. For now, the full `stdenv` is also
passed, so I don't need to change the native bootstraps, but I can see
this changing as we make things more uniform and clean those up.

(adapted from commit 51f1ecaa59a3b7c182b24e71a3176c83d6cd601e)
(adapted from commit 1743662e55669081056743f22f6e616588061cba)

+101 -101
+4 -4
pkgs/build-support/bintools-wrapper/default.nix
··· 10 , stdenvNoCC 11 , runtimeShell 12 , bintools ? null, libc ? null, coreutils ? null, gnugrep ? null 13 - , netbsd ? null, netbsdCross ? null 14 , sharedLibraryLoader ? 15 if libc == null then 16 null 17 else if stdenvNoCC.targetPlatform.isNetBSD then 18 - if !(targetPackages ? netbsdCross) then 19 netbsd.ld_elf_so 20 - else if libc != targetPackages.netbsdCross.headers then 21 - targetPackages.netbsdCross.ld_elf_so 22 else 23 null 24 else
··· 10 , stdenvNoCC 11 , runtimeShell 12 , bintools ? null, libc ? null, coreutils ? null, gnugrep ? null 13 + , netbsd ? null 14 , sharedLibraryLoader ? 15 if libc == null then 16 null 17 else if stdenvNoCC.targetPlatform.isNetBSD then 18 + if !(targetPackages ? netbsd) then 19 netbsd.ld_elf_so 20 + else if libc != targetPackages.netbsd.headers then 21 + targetPackages.netbsd.ld_elf_so 22 else 23 null 24 else
+2 -1
pkgs/by-name/uc/uclibc-ng/package.nix
··· 1 { lib 2 - , stdenv 3 , buildPackages 4 , fetchurl 5 , gitUpdater ··· 9 }: 10 11 let 12 isCross = (stdenv.buildPlatform != stdenv.hostPlatform); 13 configParser = '' 14 function parseconfig {
··· 1 { lib 2 + , stdenvNoLibc 3 , buildPackages 4 , fetchurl 5 , gitUpdater ··· 9 }: 10 11 let 12 + stdenv = stdenvNoLibc; 13 isCross = (stdenv.buildPlatform != stdenv.hostPlatform); 14 configParser = '' 15 function parseconfig {
+2 -2
pkgs/development/misc/or1k/newlib.nix
··· 1 - { stdenv, fetchFromGitHub, crossLibcStdenv, buildPackages }: 2 3 - crossLibcStdenv.mkDerivation { 4 name = "newlib"; 5 src = fetchFromGitHub { 6 owner = "openrisc";
··· 1 + { stdenv, fetchFromGitHub, stdenvNoLibc, buildPackages }: 2 3 + stdenvNoLibc.mkDerivation { 4 name = "newlib"; 5 src = fetchFromGitHub { 6 owner = "openrisc";
+2 -2
pkgs/development/misc/vc4/newlib.nix
··· 1 - { stdenv, texinfo, flex, bison, fetchFromGitHub, crossLibcStdenv, buildPackages }: 2 3 - crossLibcStdenv.mkDerivation { 4 name = "newlib"; 5 src = fetchFromGitHub { 6 owner = "itszor";
··· 1 + { stdenv, texinfo, flex, bison, fetchFromGitHub, stdenvNoLibc, buildPackages }: 2 3 + stdenvNoLibc.mkDerivation { 4 name = "newlib"; 5 src = fetchFromGitHub { 6 owner = "itszor";
+2 -2
pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix
··· 2 lib, 3 stdenv, 4 stdenvNoCC, 5 - stdenvNoLibs, 6 overrideCC, 7 buildPackages, 8 stdenvNoLibcxx ? overrideCC stdenv buildPackages.llvmPackages.clangNoLibcxx, ··· 28 if attrs.noCC or false then 29 stdenvNoCC 30 else if attrs.noLibc or false then 31 - stdenvNoLibs 32 else if attrs.noLibcxx or false then 33 stdenvNoLibcxx 34 else
··· 2 lib, 3 stdenv, 4 stdenvNoCC, 5 + stdenvNoLibc, 6 overrideCC, 7 buildPackages, 8 stdenvNoLibcxx ? overrideCC stdenv buildPackages.llvmPackages.clangNoLibcxx, ··· 28 if attrs.noCC or false then 29 stdenvNoCC 30 else if attrs.noLibc or false then 31 + stdenvNoLibc 32 else if attrs.noLibcxx or false then 33 stdenvNoLibcxx 34 else
+2 -2
pkgs/os-specific/bsd/netbsd/default.nix
··· 1 { 2 lib, 3 - crossLibcStdenv, 4 stdenvNoCC, 5 makeScopeWithSplicing', 6 generateSplicesForMkScope, ··· 37 38 compatIfNeeded = lib.optional (!stdenvNoCC.hostPlatform.isNetBSD) self.compat; 39 40 - stdenvLibcMinimal = crossLibcStdenv.override (old: { 41 cc = old.cc.override { 42 libc = self.libcMinimal; 43 noLibc = false;
··· 1 { 2 lib, 3 + stdenvNoLibc, 4 stdenvNoCC, 5 makeScopeWithSplicing', 6 generateSplicesForMkScope, ··· 37 38 compatIfNeeded = lib.optional (!stdenvNoCC.hostPlatform.isNetBSD) self.compat; 39 40 + stdenvLibcMinimal = stdenvNoLibc.override (old: { 41 cc = old.cc.override { 42 libc = self.libcMinimal; 43 noLibc = false;
+2 -2
pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix
··· 2 lib, 3 stdenv, 4 stdenvNoCC, 5 - crossLibcStdenv, 6 stdenvLibcMinimal, 7 runCommand, 8 rsync, ··· 28 if attrs.noCC or false then 29 stdenvNoCC 30 else if attrs.noLibc or false then 31 - crossLibcStdenv 32 else if attrs.libcMinimal or false then 33 stdenvLibcMinimal 34 else
··· 2 lib, 3 stdenv, 4 stdenvNoCC, 5 + stdenvNoLibc, 6 stdenvLibcMinimal, 7 runCommand, 8 rsync, ··· 28 if attrs.noCC or false then 29 stdenvNoCC 30 else if attrs.noLibc or false then 31 + stdenvNoLibc 32 else if attrs.libcMinimal or false then 33 stdenvLibcMinimal 34 else
+2 -2
pkgs/os-specific/bsd/openbsd/default.nix
··· 1 { 2 lib, 3 - crossLibcStdenv, 4 makeScopeWithSplicing', 5 generateSplicesForMkScope, 6 buildPackages, ··· 22 // { 23 version = "7.5"; 24 25 - stdenvLibcMinimal = crossLibcStdenv.override (old: { 26 cc = old.cc.override { 27 libc = self.libcMinimal; 28 noLibc = false;
··· 1 { 2 lib, 3 + stdenvNoLibc, 4 makeScopeWithSplicing', 5 generateSplicesForMkScope, 6 buildPackages, ··· 22 // { 23 version = "7.5"; 24 25 + stdenvLibcMinimal = stdenvNoLibc.override (old: { 26 cc = old.cc.override { 27 libc = self.libcMinimal; 28 noLibc = false;
+2 -2
pkgs/os-specific/bsd/openbsd/pkgs/libcMinimal/package.nix
··· 1 { 2 lib, 3 - crossLibcStdenv, 4 mkDerivation, 5 fetchpatch, 6 bsdSetupHook, ··· 65 # Suppress lld >= 16 undefined version errors 66 # https://github.com/freebsd/freebsd-src/commit/2ba84b4bcdd6012e8cfbf8a0d060a4438623a638 67 env.NIX_LDFLAGS = lib.optionalString ( 68 - crossLibcStdenv.hostPlatform.linker == "lld" 69 ) "--undefined-version"; 70 71 makeFlags = [
··· 1 { 2 lib, 3 + stdenvNoLibc, 4 mkDerivation, 5 fetchpatch, 6 bsdSetupHook, ··· 65 # Suppress lld >= 16 undefined version errors 66 # https://github.com/freebsd/freebsd-src/commit/2ba84b4bcdd6012e8cfbf8a0d060a4438623a638 67 env.NIX_LDFLAGS = lib.optionalString ( 68 + stdenvNoLibc.hostPlatform.linker == "lld" 69 ) "--undefined-version"; 70 71 makeFlags = [
+2 -2
pkgs/os-specific/bsd/openbsd/pkgs/mkDerivation.nix
··· 2 lib, 3 stdenv, 4 stdenvNoCC, 5 - crossLibcStdenv, 6 stdenvLibcMinimal, 7 runCommand, 8 rsync, ··· 22 if attrs.noCC or false then 23 stdenvNoCC 24 else if attrs.noLibc or false then 25 - crossLibcStdenv 26 else if attrs.libcMinimal or false then 27 stdenvLibcMinimal 28 else
··· 2 lib, 3 stdenv, 4 stdenvNoCC, 5 + stdenvNoLibc, 6 stdenvLibcMinimal, 7 runCommand, 8 rsync, ··· 22 if attrs.noCC or false then 23 stdenvNoCC 24 else if attrs.noLibc or false then 25 + stdenvNoLibc 26 else if attrs.libcMinimal or false then 27 stdenvLibcMinimal 28 else
+3 -3
pkgs/os-specific/windows/default.nix
··· 1 { lib, stdenv, buildPackages 2 - , newScope, overrideCC, crossLibcStdenv, libcCross 3 }: 4 5 lib.makeScope newScope (self: with self; { ··· 14 mingw_runtime = mingwrt; 15 16 mingw_w64 = callPackage ./mingw-w64 { 17 - stdenv = crossLibcStdenv; 18 }; 19 20 # FIXME untested with llvmPackages_16 was using llvmPackages_8 21 - crossThreadsStdenv = overrideCC crossLibcStdenv 22 (if stdenv.hostPlatform.useLLVM or false 23 then buildPackages.llvmPackages.clangNoLibcxx 24 else buildPackages.gccWithoutTargetLibc.override (old: {
··· 1 { lib, stdenv, buildPackages 2 + , newScope, overrideCC, stdenvNoLibc, libcCross 3 }: 4 5 lib.makeScope newScope (self: with self; { ··· 14 mingw_runtime = mingwrt; 15 16 mingw_w64 = callPackage ./mingw-w64 { 17 + stdenv = stdenvNoLibc; 18 }; 19 20 # FIXME untested with llvmPackages_16 was using llvmPackages_8 21 + crossThreadsStdenv = overrideCC stdenvNoLibc 22 (if stdenv.hostPlatform.useLLVM or false 23 then buildPackages.llvmPackages.clangNoLibcxx 24 else buildPackages.gccWithoutTargetLibc.override (old: {
+33 -23
pkgs/stdenv/cross/default.nix
··· 41 if crossSystem.isStatic 42 then buildPackages.stdenvAdapters.makeStatic 43 else lib.id; 44 in { 45 inherit config; 46 overlays = overlays ++ crossOverlays; 47 selfBuild = false; 48 stdenv = let 49 - baseStdenv = adaptStdenv (buildPackages.stdenv.override (old: rec { 50 - buildPlatform = localSystem; 51 - hostPlatform = crossSystem; 52 - targetPlatform = crossSystem; 53 54 - # Prior overrides are surely not valid as packages built with this run on 55 - # a different platform, and so are disabled. 56 - overrides = _: _: {}; 57 - extraBuildInputs = [ ] # Old ones run on wrong platform 58 - ++ lib.optionals hostPlatform.isDarwin [ buildPackages.targetPackages.darwin.apple_sdk.frameworks.CoreFoundation ] 59 - ; 60 - allowedRequisites = null; 61 - 62 - hasCC = !targetPlatform.isGhcjs; 63 64 cc = if crossSystem.useiOSPrebuilt or false 65 then buildPackages.darwin.iosSdkPkgs.clang ··· 81 then buildPackages.arocc 82 else buildPackages.gcc; 83 84 - extraNativeBuildInputs = old.extraNativeBuildInputs 85 - ++ lib.optionals 86 - (hostPlatform.isLinux && !buildPlatform.isLinux) 87 - [ buildPackages.patchelf ] 88 - ++ lib.optional 89 - (let f = p: !p.isx86 || builtins.elem p.libc [ "musl" "wasilibc" "relibc" ] || p.isiOS || p.isGenode; 90 - in f hostPlatform && !(f buildPlatform) ) 91 - buildPackages.updateAutotoolsGnuConfigScriptsHook 92 - ; 93 - })); 94 in if config ? replaceCrossStdenv then config.replaceCrossStdenv { inherit buildPackages baseStdenv; } else baseStdenv; 95 }) 96
··· 41 if crossSystem.isStatic 42 then buildPackages.stdenvAdapters.makeStatic 43 else lib.id; 44 + stdenvNoCC = adaptStdenv (buildPackages.stdenv.override (old: rec { 45 + buildPlatform = localSystem; 46 + hostPlatform = crossSystem; 47 + targetPlatform = crossSystem; 48 + 49 + # Prior overrides are surely not valid as packages built with this run on 50 + # a different platform, and so are disabled. 51 + overrides = _: _: {}; 52 + extraBuildInputs = [ ]; # Old ones run on wrong platform 53 + allowedRequisites = null; 54 + 55 + cc = null; 56 + hasCC = false; 57 + 58 + extraNativeBuildInputs = old.extraNativeBuildInputs 59 + ++ lib.optionals 60 + (hostPlatform.isLinux && !buildPlatform.isLinux) 61 + [ buildPackages.patchelf ] 62 + ++ lib.optional 63 + (let f = p: !p.isx86 || builtins.elem p.libc [ "musl" "wasilibc" "relibc" ] || p.isiOS || p.isGenode; 64 + in f hostPlatform && !(f buildPlatform) ) 65 + buildPackages.updateAutotoolsGnuConfigScriptsHook 66 + ; 67 + })); 68 in { 69 inherit config; 70 overlays = overlays ++ crossOverlays; 71 selfBuild = false; 72 + inherit stdenvNoCC; 73 stdenv = let 74 + inherit (stdenvNoCC) hostPlatform targetPlatform; 75 + baseStdenv = stdenvNoCC.override { 76 + # Old ones run on wrong platform 77 + extraBuildInputs = lib.optionals hostPlatform.isDarwin [ 78 + buildPackages.targetPackages.darwin.apple_sdk.frameworks.CoreFoundation 79 + ]; 80 81 + hasCC = !stdenvNoCC.targetPlatform.isGhcjs; 82 83 cc = if crossSystem.useiOSPrebuilt or false 84 then buildPackages.darwin.iosSdkPkgs.clang ··· 100 then buildPackages.arocc 101 else buildPackages.gcc; 102 103 + }; 104 in if config ? replaceCrossStdenv then config.replaceCrossStdenv { inherit buildPackages baseStdenv; } else baseStdenv; 105 }) 106
+2
pkgs/stdenv/darwin/default.nix
··· 1225 1226 # libc++, and libc++abi do not need CoreFoundation. Avoid propagating the CF from prior 1227 # stages to the final stdenv via rpath by dropping it from `extraBuildInputs`. 1228 stdenvNoCF = self.stdenv.override { extraBuildInputs = [ ]; }; 1229 1230 libcxxBootstrapStdenv = self.overrideCC stdenvNoCF ( ··· 1543 1544 # Don’t link anything in this stage against CF to prevent propagating CF from prior stages to 1545 # the final stdenv, which happens because of the rpath hook. 1546 stdenv = 1547 let 1548 stdenvNoCF = super.stdenv.override { extraBuildInputs = [ ]; };
··· 1225 1226 # libc++, and libc++abi do not need CoreFoundation. Avoid propagating the CF from prior 1227 # stages to the final stdenv via rpath by dropping it from `extraBuildInputs`. 1228 + stdenvNoCC = super.stdenvNoCC.override { extraBuildInputs = [ ]; }; 1229 stdenvNoCF = self.stdenv.override { extraBuildInputs = [ ]; }; 1230 1231 libcxxBootstrapStdenv = self.overrideCC stdenvNoCF ( ··· 1544 1545 # Don’t link anything in this stage against CF to prevent propagating CF from prior stages to 1546 # the final stdenv, which happens because of the rpath hook. 1547 + stdenvNoCC = super.stdenvNoCC.override { extraBuildInputs = [ ]; }; 1548 stdenv = 1549 let 1550 stdenvNoCF = super.stdenv.override { extraBuildInputs = [ ]; };
+10 -3
pkgs/top-level/aliases.nix
··· 138 auditBlasHook = throw "'auditBlasHook' has been removed since it never worked"; # Added 2024-04-02 139 authy = throw "'authy' has been removed since it reached end of life"; # Added 2024-04-19 140 avldrums-lv2 = x42-avldrums; # Added 2020-03-29 141 awesome-4-0 = awesome; # Added 2022-05-05 142 aws-env = throw "aws-env has been removed as the upstream project was unmaintained"; # Added 2024-06-11 143 aws-google-auth = throw "aws-google-auth has been removed as the upstream project was unmaintained"; # Added 2024-07-31 ··· 251 cosmic-tasks = tasks; # Added 2024-07-04 252 cpp-ipfs-api = cpp-ipfs-http-client; # Project has been renamed. Added 2022-05-15 253 crispyDoom = crispy-doom; # Added 2023-05-01 254 cryptowatch-desktop = throw "Cryptowatch Desktop was sunset on September 30th 2023 and has been removed from nixpkgs"; # Added 2023-12-22 255 clash = throw "'clash' has been removed, upstream gone. Consider using 'mihomo' instead."; # added 2023-11-10 256 clasp = clingo; # added 2022-12-22 ··· 979 mpd_clientlib = libmpdclient; # Added 2021-02-11 980 mpdevil = plattenalbum; # Added 2024-05-22 981 mpg321 = throw "'mpg321' has been removed due to it being unmaintained by upstream. Consider using mpg123 instead."; # Added 2024-05-10 982 mumble_git = throw "'mumble_git' has been renamed to/replaced by 'pkgs.mumble'"; # Converted to throw 2023-09-10 983 murmur_git = throw "'murmur_git' has been renamed to/replaced by 'pkgs.murmur'"; # Converted to throw 2023-09-10 984 mutt-with-sidebar = mutt; # Added 2022-09-17 ··· 1010 nagiosPluginsOfficial = monitoring-plugins; 1011 neochat = libsForQt5.kdeGear.neochat; # added 2022-05-10 1012 neoload = throw "'neoload' has been removed as it is broken and unmaintained"; # Added 2024-03-02 1013 nitrokey-udev-rules = libnitrokey; # Added 2023-03-25 1014 nix-direnv-flakes = nix-direnv; 1015 nix-repl = throw ( ··· 1487 uberwriter = apostrophe; # Added 2020-04-23 1488 ubootBeagleboneBlack = ubootAmx335xEVM; # Added 2020-01-21 1489 ubuntu_font_family = ubuntu-classic; # Added 2024-02-19 1490 ue4 = throw "ue4 has been removed, because the package was broken for years"; # Added 2023-11-22 1491 uefi-firmware-parser = throw "The uefi-firmware-parser package was dropped since it was unmaintained."; # Added 2024-06-21 1492 uhd3_5 = throw "uhd3_5 has been removed, because it was no longer needed"; # Added 2023-10-07 ··· 1636 inherit (stdenv.hostPlatform) system; # Added 2021-10-22 1637 inherit (stdenv) buildPlatform hostPlatform targetPlatform; # Added 2023-01-09 1638 1639 - freebsdCross = freebsd; # Added 2024-06-18 1640 - netbsdCross = netbsd; # Added 2024-06-18 1641 - openbsdCross = openbsd; # Added 2024-06-18 1642 1643 # LLVM packages for (integration) testing that should not be used inside Nixpkgs: 1644 llvmPackages_latest = llvmPackages_18;
··· 138 auditBlasHook = throw "'auditBlasHook' has been removed since it never worked"; # Added 2024-04-02 139 authy = throw "'authy' has been removed since it reached end of life"; # Added 2024-04-19 140 avldrums-lv2 = x42-avldrums; # Added 2020-03-29 141 + avrlibcCross = avrlibc; # Added 2024-09-06 142 awesome-4-0 = awesome; # Added 2022-05-05 143 aws-env = throw "aws-env has been removed as the upstream project was unmaintained"; # Added 2024-06-11 144 aws-google-auth = throw "aws-google-auth has been removed as the upstream project was unmaintained"; # Added 2024-07-31 ··· 252 cosmic-tasks = tasks; # Added 2024-07-04 253 cpp-ipfs-api = cpp-ipfs-http-client; # Project has been renamed. Added 2022-05-15 254 crispyDoom = crispy-doom; # Added 2023-05-01 255 + crossLibcStdenv = stdenvNoLibc; # Added 2024-09-06 256 cryptowatch-desktop = throw "Cryptowatch Desktop was sunset on September 30th 2023 and has been removed from nixpkgs"; # Added 2023-12-22 257 clash = throw "'clash' has been removed, upstream gone. Consider using 'mihomo' instead."; # added 2023-11-10 258 clasp = clingo; # added 2022-12-22 ··· 981 mpd_clientlib = libmpdclient; # Added 2021-02-11 982 mpdevil = plattenalbum; # Added 2024-05-22 983 mpg321 = throw "'mpg321' has been removed due to it being unmaintained by upstream. Consider using mpg123 instead."; # Added 2024-05-10 984 + msp430NewlibCross = msp430Newlib; # Added 2024-09-06 985 mumble_git = throw "'mumble_git' has been renamed to/replaced by 'pkgs.mumble'"; # Converted to throw 2023-09-10 986 murmur_git = throw "'murmur_git' has been renamed to/replaced by 'pkgs.murmur'"; # Converted to throw 2023-09-10 987 mutt-with-sidebar = mutt; # Added 2022-09-17 ··· 1013 nagiosPluginsOfficial = monitoring-plugins; 1014 neochat = libsForQt5.kdeGear.neochat; # added 2022-05-10 1015 neoload = throw "'neoload' has been removed as it is broken and unmaintained"; # Added 2024-03-02 1016 + newlibCross = newlib; # Added 2024-09-06 1017 + newlib-nanoCross = newlib-nano; # Added 2024-09-06 1018 nitrokey-udev-rules = libnitrokey; # Added 2023-03-25 1019 nix-direnv-flakes = nix-direnv; 1020 nix-repl = throw ( ··· 1492 uberwriter = apostrophe; # Added 2020-04-23 1493 ubootBeagleboneBlack = ubootAmx335xEVM; # Added 2020-01-21 1494 ubuntu_font_family = ubuntu-classic; # Added 2024-02-19 1495 + uclibc = uclibc-ng; # Added 2022-06-16 1496 + uclibcCross = uclibc-ng; # Added 2022-06-16 1497 ue4 = throw "ue4 has been removed, because the package was broken for years"; # Added 2023-11-22 1498 uefi-firmware-parser = throw "The uefi-firmware-parser package was dropped since it was unmaintained."; # Added 2024-06-21 1499 uhd3_5 = throw "uhd3_5 has been removed, because it was no longer needed"; # Added 2023-10-07 ··· 1643 inherit (stdenv.hostPlatform) system; # Added 2021-10-22 1644 inherit (stdenv) buildPlatform hostPlatform targetPlatform; # Added 2023-01-09 1645 1646 + freebsdCross = freebsd; # Added 2024-09-06 1647 + netbsdCross = netbsd; # Added 2024-09-06 1648 + openbsdCross = openbsd; # Added 2024-09-06 1649 1650 # LLVM packages for (integration) testing that should not be used inside Nixpkgs: 1651 llvmPackages_latest = llvmPackages_18;
+26 -50
pkgs/top-level/all-packages.nix
··· 31 # it's just the plain stdenv. 32 stdenv_32bit = lowPrio (if stdenv.hostPlatform.is32bit then stdenv else multiStdenv); 33 34 - stdenvNoCC = stdenv.override ( 35 - { cc = null; hasCC = false; } 36 - 37 - // lib.optionalAttrs (stdenv.hostPlatform.isDarwin && (stdenv.hostPlatform != stdenv.buildPlatform)) { 38 - # TODO: This is a hack to use stdenvNoCC to produce a CF when cross 39 - # compiling. It's not very sound. The cross stdenv has: 40 - # extraBuildInputs = [ targetPackages.darwin.apple_sdks.frameworks.CoreFoundation ] 41 - # and uses stdenvNoCC. In order to make this not infinitely recursive, we 42 - # need to exclude this extraBuildInput. 43 - extraBuildInputs = []; 44 - } 45 - ); 46 - 47 mkStdenvNoLibs = stdenv: let 48 bintools = stdenv.cc.bintools.override { 49 libc = null; ··· 61 }; 62 63 stdenvNoLibs = 64 - if stdenvNoCC.hostPlatform != stdenvNoCC.buildPlatform && (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.useLLVM or false) 65 then 66 # We cannot touch binutils or cc themselves, because that will cause 67 # infinite recursion. So instead, we just choose a libc based on the ··· 74 # thing to to create an earlier thing (leading to infinite recursion) and 75 # we also would still respect the stage arguments choices for these 76 # things. 77 - overrideCC stdenv buildPackages.llvmPackages.clangNoCompilerRt 78 else mkStdenvNoLibs stdenv; 79 80 gccStdenvNoLibs = mkStdenvNoLibs gccStdenv; ··· 15109 15110 gccCrossLibcStdenv = overrideCC stdenvNoCC buildPackages.gccWithoutTargetLibc; 15111 15112 - crossLibcStdenv = 15113 - if stdenv.hostPlatform.useLLVM or false || stdenv.hostPlatform.isDarwin 15114 - then overrideCC stdenv buildPackages.llvmPackages.clangNoLibc 15115 - else gccCrossLibcStdenv; 15116 - 15117 # The GCC used to build libc for the target platform. Normal gccs will be 15118 # built with, and use, that cross-compiled libc. 15119 gccWithoutTargetLibc = assert stdenv.targetPlatform != stdenv.hostPlatform; let ··· 17157 17158 h3 = h3_3; 17159 17160 - avrlibc = callPackage ../development/misc/avr/libc { }; 17161 - avrlibcCross = callPackage ../development/misc/avr/libc { 17162 - stdenv = crossLibcStdenv; 17163 }; 17164 17165 avr8burnomat = callPackage ../development/misc/avr8-burn-omat { }; ··· 17233 17234 msp430GccSupport = callPackage ../development/misc/msp430/gcc-support.nix { }; 17235 17236 - msp430Newlib = callPackage ../development/misc/msp430/newlib.nix { }; 17237 - msp430NewlibCross = callPackage ../development/misc/msp430/newlib.nix { 17238 - newlib = newlibCross; 17239 - }; 17240 17241 mspds = callPackage ../development/misc/msp430/mspds { }; 17242 mspds-bin = callPackage ../development/misc/msp430/mspds/binary.nix { }; ··· 20413 }; 20414 20415 muslCross = musl.override { 20416 - stdenv = crossLibcStdenv; 20417 }; 20418 20419 # These are used when buiding compiler-rt / libgcc, prior to building libc. 20420 preLibcCrossHeaders = let 20421 inherit (stdenv.targetPlatform) libc; 20422 in if stdenv.targetPlatform.isMinGW then targetPackages.windows.mingw_w64_headers or windows.mingw_w64_headers 20423 - else if libc == "nblibc" then targetPackages.netbsdCross.headers or netbsdCross.headers 20424 else if libc == "libSystem" && stdenv.targetPlatform.isAarch64 then targetPackages.darwin.LibsystemCross or darwin.LibsystemCross 20425 else null; 20426 ··· 20431 /**/ if name == null then null 20432 else if name == "glibc" then targetPackages.glibcCross or glibcCross 20433 else if name == "bionic" then targetPackages.bionic or bionic 20434 - else if name == "uclibc" then targetPackages.uclibcCross or uclibcCross 20435 - else if name == "avrlibc" then targetPackages.avrlibcCross or avrlibcCross 20436 - else if name == "newlib" && stdenv.targetPlatform.isMsp430 then targetPackages.msp430NewlibCross or msp430NewlibCross 20437 else if name == "newlib" && stdenv.targetPlatform.isVc4 then targetPackages.vc4-newlib or vc4-newlib 20438 else if name == "newlib" && stdenv.targetPlatform.isOr1k then targetPackages.or1k-newlib or or1k-newlib 20439 - else if name == "newlib" then targetPackages.newlibCross or newlibCross 20440 - else if name == "newlib-nano" then targetPackages.newlib-nanoCross or newlib-nanoCross 20441 else if name == "musl" then targetPackages.muslCross or muslCross 20442 else if name == "msvcrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64 20443 else if name == "ucrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64 ··· 20463 }; 20464 20465 wasilibc = callPackage ../development/libraries/wasilibc { 20466 - stdenv = crossLibcStdenv; 20467 }; 20468 20469 relibc = callPackage ../development/libraries/relibc { }; ··· 27415 inherit (callPackage ../misc/barebox {}) 27416 buildBarebox 27417 bareboxTools; 27418 - 27419 - uclibc-ng-cross = uclibc-ng.override { 27420 - stdenv = crossLibcStdenv; 27421 - }; 27422 - 27423 - # Aliases 27424 - uclibc = uclibc-ng; 27425 - uclibcCross = uclibc-ng-cross; 27426 27427 eudev = callPackage ../by-name/eu/eudev/package.nix { 27428 util-linux = util-linuxMinimal; ··· 39778 39779 new-session-manager = callPackage ../applications/audio/new-session-manager { }; 39780 39781 - newlib = callPackage ../development/misc/newlib { }; 39782 - newlibCross = callPackage ../development/misc/newlib { 39783 - stdenv = crossLibcStdenv; 39784 }; 39785 39786 newlib-nano = callPackage ../development/misc/newlib { 39787 nanoizeNewlib = true; 39788 - }; 39789 - newlib-nanoCross = callPackage ../development/misc/newlib { 39790 - nanoizeNewlib = true; 39791 - stdenv = crossLibcStdenv; 39792 }; 39793 39794 omnisharp-roslyn = callPackage ../development/tools/omnisharp-roslyn { };
··· 31 # it's just the plain stdenv. 32 stdenv_32bit = lowPrio (if stdenv.hostPlatform.is32bit then stdenv else multiStdenv); 33 34 mkStdenvNoLibs = stdenv: let 35 bintools = stdenv.cc.bintools.override { 36 libc = null; ··· 48 }; 49 50 stdenvNoLibs = 51 + if stdenvNoCC.hostPlatform != stdenvNoCC.buildPlatform 52 then 53 # We cannot touch binutils or cc themselves, because that will cause 54 # infinite recursion. So instead, we just choose a libc based on the ··· 61 # thing to to create an earlier thing (leading to infinite recursion) and 62 # we also would still respect the stage arguments choices for these 63 # things. 64 + (if stdenvNoCC.hostPlatform.isDarwin || stdenvNoCC.hostPlatform.useLLVM or false 65 + then overrideCC stdenvNoCC buildPackages.llvmPackages.clangNoCompilerRt 66 + else gccCrossLibcStdenv) 67 + else mkStdenvNoLibs stdenv; 68 + 69 + stdenvNoLibc = 70 + if stdenvNoCC.hostPlatform != stdenvNoCC.buildPlatform 71 + then 72 + (if stdenvNoCC.hostPlatform.isDarwin || stdenvNoCC.hostPlatform.useLLVM or false 73 + then overrideCC stdenvNoCC buildPackages.llvmPackages.clangNoLibc 74 + else gccCrossLibcStdenv) 75 else mkStdenvNoLibs stdenv; 76 77 gccStdenvNoLibs = mkStdenvNoLibs gccStdenv; ··· 15106 15107 gccCrossLibcStdenv = overrideCC stdenvNoCC buildPackages.gccWithoutTargetLibc; 15108 15109 # The GCC used to build libc for the target platform. Normal gccs will be 15110 # built with, and use, that cross-compiled libc. 15111 gccWithoutTargetLibc = assert stdenv.targetPlatform != stdenv.hostPlatform; let ··· 17149 17150 h3 = h3_3; 17151 17152 + avrlibc = callPackage ../development/misc/avr/libc { 17153 + stdenv = stdenvNoLibc; 17154 }; 17155 17156 avr8burnomat = callPackage ../development/misc/avr8-burn-omat { }; ··· 17224 17225 msp430GccSupport = callPackage ../development/misc/msp430/gcc-support.nix { }; 17226 17227 + msp430Newlib = callPackage ../development/misc/msp430/newlib.nix { }; 17228 17229 mspds = callPackage ../development/misc/msp430/mspds { }; 17230 mspds-bin = callPackage ../development/misc/msp430/mspds/binary.nix { }; ··· 20401 }; 20402 20403 muslCross = musl.override { 20404 + stdenv = stdenvNoLibc; 20405 }; 20406 20407 # These are used when buiding compiler-rt / libgcc, prior to building libc. 20408 preLibcCrossHeaders = let 20409 inherit (stdenv.targetPlatform) libc; 20410 in if stdenv.targetPlatform.isMinGW then targetPackages.windows.mingw_w64_headers or windows.mingw_w64_headers 20411 + else if libc == "nblibc" then targetPackages.netbsd.headers or netbsd.headers 20412 else if libc == "libSystem" && stdenv.targetPlatform.isAarch64 then targetPackages.darwin.LibsystemCross or darwin.LibsystemCross 20413 else null; 20414 ··· 20419 /**/ if name == null then null 20420 else if name == "glibc" then targetPackages.glibcCross or glibcCross 20421 else if name == "bionic" then targetPackages.bionic or bionic 20422 + else if name == "uclibc" then targetPackages.uclibc or uclibc 20423 + else if name == "avrlibc" then targetPackages.avrlibc or avrlibc 20424 + else if name == "newlib" && stdenv.targetPlatform.isMsp430 then targetPackages.msp430Newlib or msp430Newlib 20425 else if name == "newlib" && stdenv.targetPlatform.isVc4 then targetPackages.vc4-newlib or vc4-newlib 20426 else if name == "newlib" && stdenv.targetPlatform.isOr1k then targetPackages.or1k-newlib or or1k-newlib 20427 + else if name == "newlib" then targetPackages.newlib or newlib 20428 + else if name == "newlib-nano" then targetPackages.newlib-nano or newlib-nano 20429 else if name == "musl" then targetPackages.muslCross or muslCross 20430 else if name == "msvcrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64 20431 else if name == "ucrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64 ··· 20451 }; 20452 20453 wasilibc = callPackage ../development/libraries/wasilibc { 20454 + stdenv = stdenvNoLibc; 20455 }; 20456 20457 relibc = callPackage ../development/libraries/relibc { }; ··· 27403 inherit (callPackage ../misc/barebox {}) 27404 buildBarebox 27405 bareboxTools; 27406 27407 eudev = callPackage ../by-name/eu/eudev/package.nix { 27408 util-linux = util-linuxMinimal; ··· 39758 39759 new-session-manager = callPackage ../applications/audio/new-session-manager { }; 39760 39761 + newlib = callPackage ../development/misc/newlib { 39762 + stdenv = stdenvNoLibc; 39763 }; 39764 39765 newlib-nano = callPackage ../development/misc/newlib { 39766 + stdenv = stdenvNoLibc; 39767 nanoizeNewlib = true; 39768 }; 39769 39770 omnisharp-roslyn = callPackage ../development/tools/omnisharp-roslyn { };
+5 -1
pkgs/top-level/stage.nix
··· 49 , # The standard environment to use for building packages. 50 stdenv 51 52 , # This is used because stdenv replacement and the stdenvCross do benefit from 53 # the overridden configuration provided by the user, as opposed to the normal 54 # bootstrapping stdenvs. ··· 141 pkgs = self.pkgsHostTarget; 142 targetPackages = self.pkgsTargetTarget; 143 144 - inherit stdenv; 145 }; 146 147 splice = self: super: import ./splice.nix lib self (adjacentPackages != null);
··· 49 , # The standard environment to use for building packages. 50 stdenv 51 52 + , # `stdenv` without a C compiler. Passing in this helps avoid infinite 53 + # recursions, and may eventually replace passing in the full stdenv. 54 + stdenvNoCC ? stdenv.override { cc = null; hasCC = false; } 55 + 56 , # This is used because stdenv replacement and the stdenvCross do benefit from 57 # the overridden configuration provided by the user, as opposed to the normal 58 # bootstrapping stdenvs. ··· 145 pkgs = self.pkgsHostTarget; 146 targetPackages = self.pkgsTargetTarget; 147 148 + inherit stdenv stdenvNoCC; 149 }; 150 151 splice = self: super: import ./splice.nix lib self (adjacentPackages != null);