Llvm-profdata, grcov and Rust code coverage

I am rediscovering NixOS and trying to setup a development environment for Rust.
So far, I have the following default.nix file in my repo:

# default.nix
with import <nixpkgs> { };
stdenv.mkDerivation {
  name = "dev-environment";
  buildInputs = [
    pkg-config
    openssl
    libgit2
    zlib
    rustc
    cargo
    llvm
    rustc.llvmPackages.llvm
    grcov
    wxGTK30-gtk3
  ];
}

Everything works except code ceverage. Here is what happens when I run grcov:

❯ grcov . -s . --binary-path target/debug/
17:47:35 [ERROR] Error while executing llvm tools: We couldn't find llvm-profdata. Try installing the llvm-tools component with `rustup component add llvm-tools-preview`.

But llvm-profdata does exists on PATH:

❯ llvm-profdata
llvm-profdata: No command specified!
USAGE: llvm-profdata <merge|show|overlap> [args...]

I dont know how to solve it. Please help :slight_smile:

Hosted by Flying Circus.