Building rustc with system LLVM on NixOS

Today, while waiting for LLVM to build, I've spend some time figuring out what should I do, on NixOS, to avoid building LLVM :slight_smile: I want to document this here, so that I can refer to this post if I accidentally delete my config :slight_smile:

So, I have the following shell.nix in the repository's root folder:

with import <nixpkgs> {};
pkgs.mkShell {
  buildInputs = [
    pkgconfig openssl cmake zlib libgit2 python llvm_7 libxml2
  ];
  shellHook = ''
    export TMPDIR=/tmp
    export RUSTC_BOOTSTRAP=1
  '';
}

and the following in config.toml:

[target.x86_64-unknown-linux-gnu]
llvm-config = "/nix/store/5fh968hna30c87bldn30wgi1j7vhrd5y-llvm-7.0.1/bin/llvm-config"
1 Like