From ec43413ac95f853f071e92f307c1d81ca8f6d1fb Mon Sep 17 00:00:00 2001 From: Tristan Ross Date: Wed, 25 Dec 2024 11:22:29 -0800 Subject: [PATCH] pkgs/top-level/stage.nix: add pkgsLLVMLibc --- lib/systems/default.nix | 1 + lib/systems/inspect.nix | 1 + lib/systems/parse.nix | 3 +++ pkgs/top-level/stage.nix | 16 ++++++++++++++++ 4 files changed, 21 insertions(+) diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 00f7f3523aa482..ec0106a13dacf6 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -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/stage.nix b/pkgs/top-level/stage.nix index 1cedd8dd184587..30b5524d350017 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,18 @@ let }; }; + pkgsLLVMLibc = nixpkgsFun { + overlays = [ (self': super': { + pkgsLLVMLibc = super'; + })] ++ overlays; + ${if stdenv.hostPlatform == stdenv.buildPlatform + then "localSystem" else "crossSystem"} = { + config = lib.systems.parse.tripleFromSystem (makeLLVMParsedPlatform stdenv.hostPlatform.parsed); + useLLVM = true; + linker = "lld"; + }; + }; + pkgsArocc = nixpkgsFun { overlays = [ (self': super': {