about summary refs log tree commit diff
path: root/pkgs/top-level/stage.nix
diff options
context:
space:
mode:
authorsternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-04-26 12:32:25 +0200
committersternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-05-10 12:45:33 +0200
commita13b1a7086ae6346977f103e4e29cdc28da34a29 (patch)
treebdac091a3baaac2e44553520691e31a3e284be3b /pkgs/top-level/stage.nix
parent594a8859129863e62326980556e3b5a6ee5252cb (diff)
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.
Diffstat (limited to 'pkgs/top-level/stage.nix')
-rw-r--r--pkgs/top-level/stage.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix
index 77f3cc677f656..931ad1f01ae9e 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.