diff --git a/lib/systems/default.nix b/lib/systems/default.nix index d682eb815003c..a9c0edd2d6e06 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -91,7 +91,19 @@ let && final.parsed.kernel == platform.parsed.kernel; isCompatible = _: throw "2022-05-23: isCompatible has been removed in favor of canExecute, refer to the 22.11 changelog for details"; # Derived meta-data - useLLVM = final.isFreeBSD || final.isOpenBSD; + + toolchain = + /**/ if final.isDarwin then "apple" + else if final.isFreeBSD || final.isOpenBSD then "llvm" + else "gnu"; + + cc = if final.toolchain == "apple" || final.toolchain == "llvm" then + "clang" + else "gcc"; + + bintools = if final.toolchain == "apple" || final.toolchain == "bintools" then + "llvm" + else "gnu"; libc = /**/ if final.isDarwin then "libSystem" @@ -118,8 +130,8 @@ let # independently, so we are just doing `linker` and keeping `useLLVM` for # now. linker = - /**/ if final.useLLVM or false then "lld" - else if final.isDarwin then "cctools" + /**/ if final.toolchain == "llvm" then "lld" + else if final.toolchain == "apple" then "cctools" # "bfd" and "gold" both come from GNU binutils. The existence of Gold # is why we use the more obscure "bfd" and not "binutils" for this # choice. diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 001123fe3d857..a2789f401c5aa 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -121,7 +121,7 @@ let useGccForLibs = useCcForLibs && libcxx == null && !targetPlatform.isDarwin - && !(targetPlatform.useLLVM or false) + && !(targetPlatform.cc == "clang") && !(targetPlatform.useAndroidPrebuilt or false) && !(targetPlatform.isiOS or false) && gccForLibs != null; @@ -514,7 +514,7 @@ stdenvNoCC.mkDerivation { + optionalString (isClang && targetPlatform.isLinux && !(targetPlatform.useAndroidPrebuilt or false) - && !(targetPlatform.useLLVM or false) + && !(targetPlatform.cc == "clang") && gccForLibs != null) ('' echo "--gcc-toolchain=${gccForLibs}" >> $out/nix-support/cc-cflags diff --git a/pkgs/by-name/cy/cyrus_sasl/package.nix b/pkgs/by-name/cy/cyrus_sasl/package.nix index 68d019ca2619b..738db8c71b506 100644 --- a/pkgs/by-name/cy/cyrus_sasl/package.nix +++ b/pkgs/by-name/cy/cyrus_sasl/package.nix @@ -74,7 +74,7 @@ stdenv.mkDerivation rec { "--enable-shared" ] ++ lib.optional enableLdap "--with-ldap=${openldap.dev}" - ++ lib.optionals (stdenv.targetPlatform.useLLVM or false) [ + ++ lib.optionals (stdenv.targetPlatform.cc == "clang") [ "--disable-sample" "CFLAGS=-DTIME_WITH_SYS_TIME" ]; diff --git a/pkgs/by-name/el/elfutils/package.nix b/pkgs/by-name/el/elfutils/package.nix index e29b8b5c1c02e..22e8e4f7e5e56 100644 --- a/pkgs/by-name/el/elfutils/package.nix +++ b/pkgs/by-name/el/elfutils/package.nix @@ -62,7 +62,7 @@ stdenv.mkDerivation rec { ++ lib.optionals stdenv.hostPlatform.isMusl [ ./musl-error_h.patch ] # Prevent headers and binaries from colliding which results in an error. # https://sourceware.org/pipermail/elfutils-devel/2024q3/007281.html - ++ lib.optional (stdenv.targetPlatform.useLLVM or false) ./cxx-header-collision.patch; + ++ lib.optional (stdenv.targetPlatform.cc == "clang") ./cxx-header-collision.patch; postPatch = '' @@ -93,7 +93,7 @@ stdenv.mkDerivation rec { bzip2 ] ++ lib.optional enableDebuginfod pkg-config - ++ lib.optional (stdenv.targetPlatform.useLLVM or false) autoreconfHook; + ++ lib.optional (stdenv.targetPlatform.cc == "clang") autoreconfHook; buildInputs = [ zlib @@ -126,7 +126,7 @@ stdenv.mkDerivation rec { # Versioned symbols are nice to have, but we can do without. (lib.enableFeature (!stdenv.hostPlatform.isMicroBlaze) "symbol-versioning") ] - ++ lib.optional (stdenv.targetPlatform.useLLVM or false) "--disable-demangler" + ++ lib.optional (stdenv.targetPlatform.cc == "clang") "--disable-demangler" ++ lib.optionals stdenv.cc.isClang [ "CFLAGS=-Wno-unused-private-field" "CXXFLAGS=-Wno-unused-private-field" diff --git a/pkgs/by-name/ke/kexec-tools/package.nix b/pkgs/by-name/ke/kexec-tools/package.nix index 5eef5475390ed..972d286e5809b 100644 --- a/pkgs/by-name/ke/kexec-tools/package.nix +++ b/pkgs/by-name/ke/kexec-tools/package.nix @@ -25,7 +25,7 @@ stdenv.mkDerivation rec { url = "https://raw.githubusercontent.com/void-linux/void-packages/6c1192cbf166698932030c2e3de71db1885a572d/srcpkgs/kexec-tools/patches/ppc64-elfv2.patch"; sha256 = "19wzfwb0azm932v0vhywv4221818qmlmvdfwpvvpfyw4hjsc2s1l"; }) - ] ++ lib.optional (stdenv.hostPlatform.useLLVM or false) ./fix-purgatory-llvm-libunwind.patch; + ] ++ lib.optional (stdenv.hostPlatform.cc == "clang") ./fix-purgatory-llvm-libunwind.patch; hardeningDisable = [ "format" diff --git a/pkgs/by-name/li/libseccomp/package.nix b/pkgs/by-name/li/libseccomp/package.nix index 9ff313c84a65e..373e1565e0201 100644 --- a/pkgs/by-name/li/libseccomp/package.nix +++ b/pkgs/by-name/li/libseccomp/package.nix @@ -37,7 +37,7 @@ stdenv.mkDerivation rec { util-linuxMinimal which ]; - doCheck = !(stdenv.targetPlatform.useLLVM or false); + doCheck = !(stdenv.targetPlatform.cc == "clang"); # Hack to ensure that patchelf --shrink-rpath get rids of a $TMPDIR reference. preFixup = "rm -rfv src"; diff --git a/pkgs/by-name/so/sourceHighlight/package.nix b/pkgs/by-name/so/sourceHighlight/package.nix index 16eaa9e42e6ab..95f5806049f5f 100644 --- a/pkgs/by-name/so/sourceHighlight/package.nix +++ b/pkgs/by-name/so/sourceHighlight/package.nix @@ -62,7 +62,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ]; buildInputs = [ boost ] - ++ lib.optional (stdenv.targetPlatform.useLLVM or false) ( + ++ lib.optional (stdenv.targetPlatform.cc == "clang") ( llvmPackages.compiler-rt.override { doFakeLibgcc = true; } @@ -92,7 +92,7 @@ stdenv.mkDerivation rec { maintainers = with maintainers; [ SuperSandro2000 ]; }; } -// lib.optionalAttrs (stdenv.targetPlatform.useLLVM or false) { +// lib.optionalAttrs (stdenv.targetPlatform.cc == "clang") { # Force linking to "libgcc" so tests pass NIX_CFLAGS_COMPILE = "-lgcc"; } diff --git a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix index f859a415b5db2..8e6730402aa62 100644 --- a/pkgs/development/compilers/llvm/common/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/common/compiler-rt/default.nix @@ -34,7 +34,7 @@ let - useLLVM = stdenv.hostPlatform.useLLVM or false; + useLLVM = stdenv.hostPlatform.cc == "clang"; bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none"; haveLibc = stdenv.cc.libc != null; # TODO: Make this account for GCC having libstdcxx, which will help diff --git a/pkgs/development/compilers/llvm/common/default.nix b/pkgs/development/compilers/llvm/common/default.nix index b53f76e96c11f..1862308444353 100644 --- a/pkgs/development/compilers/llvm/common/default.nix +++ b/pkgs/development/compilers/llvm/common/default.nix @@ -626,7 +626,7 @@ let clang = if stdenv.targetPlatform.libc == null then tools.clangNoLibc - else if stdenv.targetPlatform.useLLVM or false then + else if stdenv.targetPlatform.toolchain == "llvm" then tools.clangUseLLVM else if (pkgs.targetPackages.stdenv or args.stdenv).cc.isGNU then tools.libstdcxxClang @@ -780,7 +780,7 @@ let echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags echo "-L${targetLlvmLibraries.libunwind}/lib" >> $out/nix-support/cc-ldflags '' - + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' + + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.cc == "clang") '' echo "-lunwind" >> $out/nix-support/cc-ldflags '' + lib.optionalString stdenv.targetPlatform.isWasm '' @@ -802,7 +802,7 @@ let ++ lib.optional ( !stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD - && stdenv.targetPlatform.useLLVM or false + && stdenv.targetPlatform.cc == "clang" ) "-lunwind" ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions"; nixSupport.cc-ldflags = lib.optionals ( @@ -835,7 +835,7 @@ let echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags echo "-L${targetLlvmLibraries.libunwind}/lib" >> $out/nix-support/cc-ldflags '' - + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' + + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.cc == "clang") '' echo "-lunwind" >> $out/nix-support/cc-ldflags '' + lib.optionalString stdenv.targetPlatform.isWasm '' @@ -857,7 +857,7 @@ let ++ lib.optional ( !stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD - && stdenv.targetPlatform.useLLVM or false + && stdenv.targetPlatform.cc == "clang" ) "-lunwind" ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions"; nixSupport.cc-ldflags = lib.optionals ( @@ -1073,7 +1073,7 @@ let # Darwin needs to use a bootstrap stdenv to avoid an infinite recursion when cross-compiling. if args.stdenv.hostPlatform.isDarwin then overrideCC darwin.bootstrapStdenv buildLlvmTools.clangWithLibcAndBasicRtAndLibcxx - else if args.stdenv.hostPlatform.useLLVM or false then + else if args.stdenv.hostPlatform.cc == "clang" then overrideCC args.stdenv buildLlvmTools.clangWithLibcAndBasicRtAndLibcxx else args.stdenv; @@ -1082,7 +1082,7 @@ let patches = compiler-rtPatches; inherit stdenv; } - // lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) { + // lib.optionalAttrs (stdenv.hostPlatform.cc == "clang") { libxcrypt = (libxcrypt.override { inherit stdenv; }).overrideAttrs (old: { configureFlags = old.configureFlags ++ [ "--disable-symvers" ]; }); @@ -1091,7 +1091,7 @@ let compiler-rt-no-libc = callPackage ./compiler-rt { patches = compiler-rtPatches; - doFakeLibgcc = stdenv.hostPlatform.useLLVM or false; + doFakeLibgcc = stdenv.hostPlatform.cc == "clang"; stdenv = # Darwin needs to use a bootstrap stdenv to avoid an infinite recursion when cross-compiling. if stdenv.hostPlatform.isDarwin then diff --git a/pkgs/development/compilers/llvm/common/libcxx/default.nix b/pkgs/development/compilers/llvm/common/libcxx/default.nix index fe9ae5d0d502b..e891065604200 100644 --- a/pkgs/development/compilers/llvm/common/libcxx/default.nix +++ b/pkgs/development/compilers/llvm/common/libcxx/default.nix @@ -31,7 +31,7 @@ let runtimes = [ "libcxx" ] ++ lib.optional (cxxabi == null) "libcxxabi"; # Note: useLLVM is likely false for Darwin but true under pkgsLLVM - useLLVM = stdenv.hostPlatform.useLLVM or false; + useLLVM = stdenv.hostPlatform.cc == "clang"; src' = if monorepoSrc != null then runCommand "${pname}-src-${version}" {} ('' diff --git a/pkgs/development/compilers/rust/1_82.nix b/pkgs/development/compilers/rust/1_82.nix index 9d1281352ee1f..08beecd4c57ac 100644 --- a/pkgs/development/compilers/rust/1_82.nix +++ b/pkgs/development/compilers/rust/1_82.nix @@ -37,7 +37,7 @@ let { enableSharedLibraries = true; } - // lib.optionalAttrs (stdenv.targetPlatform.useLLVM or false) { + // lib.optionalAttrs (stdenv.targetPlatform.cc == "clang") { # Force LLVM to compile using clang + LLVM libs when targeting pkgsLLVM stdenv = pkgSet.stdenv.override { allowedRequisites = null; @@ -60,7 +60,7 @@ import ./default.nix # Expose llvmPackages used for rustc from rustc via passthru for LTO in Firefox llvmPackages = - if (stdenv.targetPlatform.useLLVM or false) then + if (stdenv.targetPlatform.cc == "clang") then callPackage ( { pkgs, diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix index 2641755a86d46..5f155fc5a6539 100644 --- a/pkgs/development/compilers/rust/rustc.nix +++ b/pkgs/development/compilers/rust/rustc.nix @@ -52,7 +52,7 @@ let concatStringsSep ; inherit (darwin.apple_sdk.frameworks) Security; - useLLVM = stdenv.targetPlatform.useLLVM or false; + useLLVM = stdenv.targetPlatform.cc == "clang"; in stdenv.mkDerivation (finalAttrs: { pname = "${targetPackages.stdenv.cc.targetPrefix}rustc"; @@ -207,7 +207,7 @@ stdenv.mkDerivation (finalAttrs: { # doesn't work) to build a linker. "--disable-llvm-bitcode-linker" ] - ++ optionals (stdenv.targetPlatform.isLinux && !(stdenv.targetPlatform.useLLVM or false)) [ + ++ optionals (stdenv.targetPlatform.isLinux && !(stdenv.targetPlatform.cc == "clang")) [ "--enable-profiler" # build libprofiler_builtins ] ++ optionals stdenv.buildPlatform.isMusl [ diff --git a/pkgs/development/libraries/kerberos/krb5.nix b/pkgs/development/libraries/kerberos/krb5.nix index 7a4df60f0ae5b..752b8c47929f6 100644 --- a/pkgs/development/libraries/kerberos/krb5.nix +++ b/pkgs/development/libraries/kerberos/krb5.nix @@ -89,7 +89,7 @@ stdenv.mkDerivation rec { ++ lib.optionals ( stdenv.hostPlatform.isLinux && stdenv.hostPlatform.libc != "bionic" - && !(stdenv.hostPlatform.useLLVM or false) + && !(stdenv.hostPlatform.cc == "clang") ) [ keyutils ] ++ lib.optionals withLdap [ openldap ] ++ lib.optionals withLibedit [ libedit ] diff --git a/pkgs/development/libraries/libunwind/default.nix b/pkgs/development/libraries/libunwind/default.nix index f0f7de192f448..06359801d316e 100644 --- a/pkgs/development/libraries/libunwind/default.nix +++ b/pkgs/development/libraries/libunwind/default.nix @@ -20,7 +20,7 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-rCFBHs6rCSnp5FEwbUR5veNNTqSQpFblAv8ebSPX0qE="; }; - patches = lib.optional (stdenv.targetPlatform.useLLVM or false) (fetchpatch { + patches = lib.optional (stdenv.targetPlatform.cc == "clang") (fetchpatch { url = "https://github.com/libunwind/libunwind/pull/770/commits/a69d0f14c9e6c46e82ba6e02fcdedb2eb63b7f7f.patch"; hash = "sha256-9oBZimCXonNN++jJs3emp9w+q1aj3eNzvSKPgh92itA="; }); diff --git a/pkgs/development/libraries/libva/default.nix b/pkgs/development/libraries/libva/default.nix index 9fd523a70610c..a0ee6feb8dc05 100644 --- a/pkgs/development/libraries/libva/default.nix +++ b/pkgs/development/libraries/libva/default.nix @@ -69,7 +69,7 @@ stdenv.mkDerivation (finalAttrs: { { NIX_LDFLAGS = "--undefined-version"; } - // lib.optionalAttrs (stdenv.targetPlatform.useLLVM or false) { + // lib.optionalAttrs (stdenv.targetPlatform.cc == "clang") { NIX_CFLAGS_COMPILE = "-DHAVE_SECURE_GETENV"; }; diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix index f0cf68f8b6aa6..5de255f09363a 100644 --- a/pkgs/development/libraries/openssl/default.nix +++ b/pkgs/development/libraries/openssl/default.nix @@ -98,7 +98,7 @@ let ++ lib.optional static "etc"; setOutputFlags = false; separateDebugInfo = - !stdenv.hostPlatform.isDarwin && !(stdenv.hostPlatform.useLLVM or false) && stdenv.cc.isGNU; + !stdenv.hostPlatform.isDarwin && !(stdenv.hostPlatform.cc == "clang") && stdenv.cc.isGNU; nativeBuildInputs = lib.optional (!stdenv.hostPlatform.isWindows) makeBinaryWrapper diff --git a/pkgs/development/libraries/quictls/default.nix b/pkgs/development/libraries/quictls/default.nix index 63ddc6313d6a7..8602ad3730054 100644 --- a/pkgs/development/libraries/quictls/default.nix +++ b/pkgs/development/libraries/quictls/default.nix @@ -64,7 +64,7 @@ stdenv.mkDerivation rec { separateDebugInfo = !stdenv.hostPlatform.isDarwin && - !(stdenv.hostPlatform.useLLVM or false) && + !(stdenv.hostPlatform.cc == "clang") && stdenv.cc.isGNU; # TODO(@Ericson2314): Improve with mass rebuild diff --git a/pkgs/development/libraries/silgraphite/graphite2.nix b/pkgs/development/libraries/silgraphite/graphite2.nix index 7289820b60df1..bc05903255ecb 100644 --- a/pkgs/development/libraries/silgraphite/graphite2.nix +++ b/pkgs/development/libraries/silgraphite/graphite2.nix @@ -32,7 +32,7 @@ stdenv.mkDerivation (finalAttrs: { ]; buildInputs = [ freetype ] - ++ lib.optional (stdenv.targetPlatform.useLLVM or false) ( + ++ lib.optional (stdenv.targetPlatform.cc == "clang") ( llvmPackages.compiler-rt.override { doFakeLibgcc = true; } diff --git a/pkgs/development/python-modules/jedi/default.nix b/pkgs/development/python-modules/jedi/default.nix index b88dc9311e91b..99158971e561a 100644 --- a/pkgs/development/python-modules/jedi/default.nix +++ b/pkgs/development/python-modules/jedi/default.nix @@ -62,7 +62,7 @@ buildPythonPackage rec { # AssertionError: assert 'foo' in ['setup'] "test_init_extension_module" ] - ++ lib.optionals (stdenv.targetPlatform.useLLVM or false) [ + ++ lib.optionals (stdenv.targetPlatform.cc == "clang") [ # InvalidPythonEnvironment: The python binary is potentially unsafe. "test_create_environment_executable" # AssertionError: assert ['', '.1000000000000001'] == ['', '.1'] diff --git a/pkgs/development/python-modules/mako/default.nix b/pkgs/development/python-modules/mako/default.nix index 0735cf8f2c9e7..04df5dfa08373 100644 --- a/pkgs/development/python-modules/mako/default.nix +++ b/pkgs/development/python-modules/mako/default.nix @@ -61,7 +61,7 @@ buildPythonPackage rec { "test_bytestring_passthru" ] # https://github.com/sqlalchemy/mako/issues/408 - ++ lib.optional (stdenv.targetPlatform.useLLVM or false) "test_future_import"; + ++ lib.optional (stdenv.targetPlatform.cc == "clang") "test_future_import"; meta = with lib; { description = "Super-fast templating language"; diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix index 425775e9dd163..131b556a2d6ab 100644 --- a/pkgs/os-specific/linux/systemd/default.nix +++ b/pkgs/os-specific/linux/systemd/default.nix @@ -375,7 +375,7 @@ stdenv.mkDerivation (finalAttrs: { ++ lib.optionals withPasswordQuality [ libpwquality ] ++ lib.optionals withQrencode [ qrencode ] ++ lib.optionals withLibarchive [ libarchive ] - ++ lib.optional (withBootloader && stdenv.targetPlatform.useLLVM or false) (llvmPackages.compiler-rt.override { + ++ lib.optional (withBootloader && stdenv.targetPlatform.cc == "clang") (llvmPackages.compiler-rt.override { doFakeLibgcc = true; }) ; diff --git a/pkgs/os-specific/windows/default.nix b/pkgs/os-specific/windows/default.nix index 59806318a23ec..5921d78ff30ac 100644 --- a/pkgs/os-specific/windows/default.nix +++ b/pkgs/os-specific/windows/default.nix @@ -26,7 +26,7 @@ lib.makeScope newScope ( # FIXME untested with llvmPackages_16 was using llvmPackages_8 crossThreadsStdenv = overrideCC stdenvNoLibc ( - if stdenv.hostPlatform.useLLVM or false then + if stdenv.hostPlatform.cc == "clang" then buildPackages.llvmPackages.clangNoLibcxx else buildPackages.gccWithoutTargetLibc.override (old: { diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix index 94158aa99fcd9..c8fdf6c11bb28 100644 --- a/pkgs/servers/x11/xorg/overrides.nix +++ b/pkgs/servers/x11/xorg/overrides.nix @@ -159,7 +159,7 @@ self: super: ]; configureFlags = attrs.configureFlags or [] ++ malloc0ReturnsNullCrossFlag - ++ lib.optional (stdenv.targetPlatform.useLLVM or false) "ac_cv_path_RAWCPP=cpp"; + ++ lib.optional (stdenv.targetPlatform.cc == "clang") "ac_cv_path_RAWCPP=cpp"; depsBuildBuild = [ buildPackages.stdenv.cc ] ++ lib.optionals stdenv.hostPlatform.isStatic [ @@ -269,7 +269,7 @@ self: super: ''; configureFlags = attrs.configureFlags or [] ++ malloc0ReturnsNullCrossFlag - ++ lib.optional (stdenv.targetPlatform.useLLVM or false) "ac_cv_path_RAWCPP=cpp"; + ++ lib.optional (stdenv.targetPlatform.cc == "clang") "ac_cv_path_RAWCPP=cpp"; propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ xorg.libSM ]; depsBuildBuild = [ buildPackages.stdenv.cc ]; CPP = if stdenv.hostPlatform.isDarwin then "clang -E -" else "${stdenv.cc.targetPrefix}cc -E -"; diff --git a/pkgs/stdenv/cross/default.nix b/pkgs/stdenv/cross/default.nix index 69ea14be5c83d..7fdfcdfcedb35 100644 --- a/pkgs/stdenv/cross/default.nix +++ b/pkgs/stdenv/cross/default.nix @@ -118,14 +118,16 @@ lib.init bootStages throw "no C compiler provided for this platform" else if crossSystem.isDarwin then buildPackages.llvmPackages.libcxxClang - else if crossSystem.useLLVM or false then + else if crossSystem.cc == "clang" then buildPackages.llvmPackages.clang - else if crossSystem.useZig or false then + else if crossSystem.cc == "zig" then buildPackages.zig.cc - else if crossSystem.useArocc or false then + else if crossSystem.cc == "arocc" then buildPackages.arocc + else if crossSystem.cc == "gcc" then + buildPackages.gcc else - buildPackages.gcc; + throw "no C compiler provided for this platform"; }; in diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d0967333170e1..198fdb6231589 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -61,7 +61,7 @@ with pkgs; # thing to to create an earlier thing (leading to infinite recursion) and # we also would still respect the stage arguments choices for these # things. - (if stdenvNoCC.hostPlatform.isDarwin || stdenvNoCC.hostPlatform.useLLVM or false + (if stdenvNoCC.hostPlatform.isDarwin || stdenvNoCC.hostPlatform.toolchain == "llvm" then overrideCC stdenvNoCC buildPackages.llvmPackages.clangNoCompilerRt else gccCrossLibcStdenv) else mkStdenvNoLibs stdenv; @@ -69,7 +69,7 @@ with pkgs; stdenvNoLibc = if stdenvNoCC.hostPlatform != stdenvNoCC.buildPlatform then - (if stdenvNoCC.hostPlatform.isDarwin || stdenvNoCC.hostPlatform.useLLVM or false + (if stdenvNoCC.hostPlatform.isDarwin || stdenvNoCC.hostPlatform.toolchain == "llvm" then overrideCC stdenvNoCC buildPackages.llvmPackages.clangNoLibc else gccCrossLibcStdenv) else mkStdenvNoLibs stdenv; @@ -6126,7 +6126,7 @@ with pkgs; # temporarily disabled due to breakage; # see https://github.com/NixOS/nixpkgs/pull/243249 && !stdenv.targetPlatform.isWindows - && !(stdenv.targetPlatform.useLLVM or false) + && !(stdenv.targetPlatform.toolchain == "llvm") ; }; bintools = binutilsNoLibc; @@ -9234,7 +9234,7 @@ with pkgs; else libcCrossChooser stdenv.targetPlatform.libc; threadsCross = - lib.optionalAttrs (stdenv.targetPlatform.isMinGW && !(stdenv.targetPlatform.useLLVM or false)) { + lib.optionalAttrs (stdenv.targetPlatform.isMinGW && stdenv.targetPlatform.toolchain != "llvm") { # other possible values: win32 or posix model = "mcf"; # For win32 or posix set this to null @@ -9707,7 +9707,7 @@ with pkgs; libcomps = callPackage ../tools/package-management/libcomps { python = python3; }; libcxxrt = callPackage ../development/libraries/libcxxrt { - stdenv = if stdenv.hostPlatform.useLLVM or false + stdenv = if stdenv.hostPlatform.cc == "clang" then overrideCC stdenv buildPackages.llvmPackages.tools.clangNoLibcxx else stdenv; }; @@ -12249,7 +12249,7 @@ with pkgs; busybox = callPackage ../os-specific/linux/busybox { # Fixes libunwind from being dynamically linked to a static binary. - stdenv = if (stdenv.targetPlatform.useLLVM or false) then + stdenv = if stdenv.targetPlatform.toolchain == "llvm" then overrideCC stdenv buildPackages.llvmPackages.clangNoLibcxx else stdenv; }; diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix index 78c22d4f70e2f..1a052111efe81 100644 --- a/pkgs/top-level/stage.nix +++ b/pkgs/top-level/stage.nix @@ -202,8 +202,7 @@ let # This is currently not possible when compiling natively, # so we don't need to check hostPlatform != buildPlatform. crossSystem = stdenv.targetPlatform // { - useLLVM = true; - linker = "lld"; + toolchain = "llvm"; }; }; @@ -217,7 +216,8 @@ let # This is currently not possible when compiling natively, # so we don't need to check hostPlatform != buildPlatform. crossSystem = stdenv.hostPlatform // { - useArocc = true; + toolchain = "llvm"; + cc = "arocc"; linker = "lld"; }; }; @@ -232,7 +232,8 @@ let # This is currently not possible when compiling natively, # so we don't need to check hostPlatform != buildPlatform. crossSystem = stdenv.hostPlatform // { - useZig = true; + toolchain = "llvm"; + cc = "zig"; linker = "lld"; }; };