I’m trying to create a cross-compilation environment using clang for RISC-V. After reading Clang can't be used to cross-build packages. · Issue #40934 · NixOS/nixpkgs · GitHub, I managed to get this to evaluate:
{ nixpkgs ? <nixpkgs>
, pkgs ? import nixpkgs { }}:
let
lib = pkgs.lib;
in rec {
# gccRiscvPkgs = pkgs.pkgsCross.riscv64;
clangRiscvPkgs = import nixpkgs { crossSystem = lib.systems.examples.riscv64 // { useLLVM = true; }; };
hello = clangRiscvPkgs.hello;
}
The problem is that this tries to build a toolchain with LLVM 8, which doesn’t yet have full RISC-V support. This was introduced in LLVM 9. I can see that LLVM 8 is hardcoded in https://github.com/NixOS/nixpkgs/blob/a5661135f29f4b2603c41690a01c3168bc8760ae/pkgs/stdenv/cross/default.nix#L67 for this usecase.
Is there a way to override the version of LLVM without patching nixpkgs?