How to llvm-tools-preview without rustup?

Hi,

I need llvm-tools-preview, but I dont use rustup. I installed everything Rust related like this:

environment.systemPackages = with pkgs; [
    .
    .
    .
    rustc
    cargo
    rustfmt
    clippy
    grcov
    cargo-binutils
    rust-analyzer
    .
    .
    .
  ];

But I cant find a Nix package for llvm-tools-preview.

Please help :slight_smile:
Thanks in advance :slight_smile:

Just add rustc.llvmPackages.llvm which will contain all the tools also contained in llvm-tools-preview (which is “llvm-tools-preview is a rustup component that contains some LLVM tools”) matching the LLVM version used by rust.

Note that in general I would not recommend installing development utilities globally. Usually it makes more sense to create granular dev environments per project using shell.nix etc.

3 Likes

Thank you very much. That helped partialy. Now its complaining that it needs llvm-profdata, and I cant find a NixOS package for it either. More help is needed :slight_smile:

Note that in general I would not recommend installing development utilities globally. Usually it makes more sense to create granular dev environments per project using shell.nix etc.

Yes yes, off course. I am aware of that. I am just experimenting with NixOS after rediscovering it a few weeks a go.

1 Like

llvm-profdata is part of that package as well. Something else must be the problem.

1 Like

Oh! In that case I will continue investigating. Thank you :slight_smile:

I could not find what is the problem with the missing llvm-profdata. For future people who see this, I’ve opened a separate topic on this: Llvm-profdata, grcov and Rust code coverage.

Hi, if you use toolchain file, you can add components instead add rustc.llvmPackages.llvm just like this:

[toolchain]
channel = "nightly"
targets = ["thumbv7m-none-eabi"]
components = [ "llvm-tools-preview" ]