Which perf package?

I am on nixos 22.05 and need the perf cli tool installed. I did a search on search.nixos.org and I can see a few possible packages. Which one do I install? I have
boot.kernelPackages = pkgs.linuxPackages_latest and want the perf cli tool to match it. Is there a meta package that install the correct perf tool which matches the kernel version?

perf-tools nixpkgs/default.nix at e179d1e57ad07f1294dcc29ad5283b214a6ae21e · NixOS/nixpkgs · GitHub only depend on Perl, so you can use the perf-tools package on any kernel.

Thanks. Installed that. However, it perf binary wasn’t installed.

perf is specified as part of the kernel package. I believe what you want is pkgs.linuxPackages_latest.perf.

You can get help with finding binaries in nixpkgs using GitHub - bennofs/nix-index: Quickly locate nix packages with specific files, or GitHub - nix-community/comma: Comma runs software without installing it. [maintainers=@Artturin,@burke,@DavHau], or with the command-not-found tool in nixos (if on nixos, just enter perf at the cmd line).

1 Like

I think you should be able to use boot.kernelPackages.perf as is. Otherwise perf does not have to match kernel version you run. linuxPackages_latest.perf should be safe to use.