From a13b1a7086ae6346977f103e4e29cdc28da34a29 Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Mon, 26 Apr 2021 12:32:25 +0200 Subject: [PATCH] pkgsLLVM: cross compiled package set using llvm compilers Provide a version of nixpkgs which is built using the LLVM toolchain. This is achieved by reusing the useLLVM attribute usable in the cross toolchain bootstrapping which is a) perfectly acceptable and b) the only way to bootstrap a LLVM stdenv across platforms without unreasonable amounts of work. This is mostly working now since we fixed some issues with llvmPackages_7.lldClang in #119717 and compile glibc with gcc at all times as of #119786 (since clang can't compile our glibc at the moment). There are seemingly some issues left to be ironed out, for example the C++ library of ncurses fails to build with a linking issue. I have attempted to alleviate that problem with #120790, but to no avail so far. Nonetheless, having a working pkgsLLVM.hello is a good start. A currently present issue is that there is no way to change the libc since there is some issue with lldClang actually picking up on the set libc. This will need investigation and fixing. --- pkgs/top-level/stage.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix index 77f3cc677f6..931ad1f01ae 100644 --- a/pkgs/top-level/stage.nix +++ b/pkgs/top-level/stage.nix @@ -158,6 +158,20 @@ let nixpkgsFun { inherit crossSystem; }) lib.systems.examples; + pkgsLLVM = nixpkgsFun { + overlays = [ + (self': super': { + pkgsLLVM = super'; + }) + ] ++ overlays; + # Bootstrap a cross stdenv using the LLVM toolchain. + # This is currently not possible when compiling natively, + # so we don't need to check hostPlatform != buildPlatform. + crossSystem = stdenv.hostPlatform // { + useLLVM = true; + }; + }; + # All packages built with the Musl libc. This will override the # default GNU libc on Linux systems. Non-Linux systems are not # supported.