Skip to content

Commit

Permalink
pkgs/top-level/stage.nix: add pkgsLLVMLibc
Browse files Browse the repository at this point in the history
  • Loading branch information
RossComputerGuy committed Dec 25, 2024
1 parent f72b341 commit f1645ab
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/systems/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
1 change: 1 addition & 0 deletions lib/systems/inspect.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"; }; }
Expand Down
3 changes: 3 additions & 0 deletions lib/systems/parse.nix
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ rec {
uclibceabihf = { float = "hard"; };
uclibc = {};

# LLVM libc
llvm = {};

unknown = {};
};

Expand Down
5 changes: 5 additions & 0 deletions pkgs/top-level/release-attrpaths-superset.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ let

# cross packagesets
pkgsLLVM = true;
pkgsLLVMLibc = true;
pkgsMusl = true;
pkgsStatic = true;
pkgsCross = true;
Expand Down Expand Up @@ -190,6 +191,10 @@ let
"pkgsLLVM"
"stdenv"
]
[
"pkgsLLVMLibc"
"stdenv"
]
[
"pkgsStatic"
"stdenv"
Expand Down
1 change: 1 addition & 0 deletions pkgs/top-level/release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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" ];
Expand Down
18 changes: 18 additions & 0 deletions pkgs/top-level/stage.nix
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ let
or lib.systems.parse.abis.musl;
});

makeLLVMParsedPlatform = parsed:
(parsed // {
abi = lib.systems.parse.abis.llvm;
});

stdenvAdapters = self: super:
let
Expand Down Expand Up @@ -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': {
Expand Down

0 comments on commit f1645ab

Please sign in to comment.