diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 00f7f3523aa482..a6bbdf69b30c97 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -91,7 +91,7 @@ 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; + useLLVM = final.isFreeBSD || final.isOpenBSD || final.isLLVMLibc; libc = /**/ if final.isDarwin then "libSystem" @@ -102,6 +102,7 @@ let else if final.isMusl then "musl" else if final.isUClibc then "uclibc" else if final.isAndroid then "bionic" + else if final.isLLVMLibc then "llvm" else if final.isLinux /* default */ then "glibc" else if final.isFreeBSD then "fblibc" else if final.isOpenBSD then "oblibc" diff --git a/lib/systems/inspect.nix b/lib/systems/inspect.nix index ebc7ab36687634..de4df13cd81166 100644 --- a/lib/systems/inspect.nix +++ b/lib/systems/inspect.nix @@ -113,6 +113,7 @@ rec { isGnu = with abis; map (a: { abi = a; }) [ gnuabi64 gnuabin32 gnu gnueabi gnueabihf gnuabielfv1 gnuabielfv2 ]; isMusl = with abis; map (a: { abi = a; }) [ musl musleabi musleabihf muslabin32 muslabi64 ]; isUClibc = with abis; map (a: { abi = a; }) [ uclibc uclibceabi uclibceabihf ]; + isLLVMLibc = [ { abi = abis.llvm; } ]; isEfi = [ { cpu = { family = "arm"; version = "6"; }; } diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index fa3cc02647aed2..e3e6ef16c6b07d 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -416,6 +416,9 @@ rec { uclibceabihf = { float = "hard"; }; uclibc = {}; + # LLVM libc + llvm = {}; + unknown = {}; }; diff --git a/pkgs/top-level/release-attrpaths-superset.nix b/pkgs/top-level/release-attrpaths-superset.nix index 9a89062bd1749a..f27ec0cbc5b73c 100644 --- a/pkgs/top-level/release-attrpaths-superset.nix +++ b/pkgs/top-level/release-attrpaths-superset.nix @@ -50,6 +50,7 @@ let # cross packagesets pkgsLLVM = true; + pkgsLLVMLibc = true; pkgsMusl = true; pkgsStatic = true; pkgsCross = true; @@ -190,6 +191,10 @@ let "pkgsLLVM" "stdenv" ] + [ + "pkgsLLVMLibc" + "stdenv" + ] [ "pkgsStatic" "stdenv" diff --git a/pkgs/top-level/release.nix b/pkgs/top-level/release.nix index 0140f0bd9d6a49..167e546654b5fa 100644 --- a/pkgs/top-level/release.nix +++ b/pkgs/top-level/release.nix @@ -341,6 +341,7 @@ let agdaPackages = packagePlatforms pkgs.agdaPackages; pkgsLLVM.stdenv = [ "x86_64-linux" "aarch64-linux" ]; + pkgsLLVMLibc.stdenv = [ "x86_64-linux" "aarch64-linux" ]; pkgsArocc.stdenv = [ "x86_64-linux" "aarch64-linux" ]; pkgsZig.stdenv = [ "x86_64-linux" "aarch64-linux" ]; pkgsMusl.stdenv = [ "x86_64-linux" "aarch64-linux" ]; diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix index 1cedd8dd184587..3b088d8507dabc 100644 --- a/pkgs/top-level/stage.nix +++ b/pkgs/top-level/stage.nix @@ -98,6 +98,10 @@ let or lib.systems.parse.abis.musl; }); + makeLLVMParsedPlatform = parsed: + (parsed // { + abi = lib.systems.parse.abis.llvm; + }); stdenvAdapters = self: super: let @@ -207,6 +211,20 @@ let }; }; + pkgsLLVMLibc = nixpkgsFun { + overlays = [ (self': super': { + pkgsLLVMLibc = super'; + })] ++ overlays; + # Bootstrap a cross stdenv using the LLVM toolchain and libc. + # This is currently not possible when compiling natively, + # so we don't need to check hostPlatform != buildPlatform. + crossSystem = stdenv.hostPlatform // { + config = lib.systems.parse.tripleFromSystem (makeLLVMParsedPlatform stdenv.hostPlatform.parsed); + useLLVM = true; + linker = "lld"; + }; + }; + pkgsArocc = nixpkgsFun { overlays = [ (self': super': {