the configuration for all my nixos machines (hacky! bad! ugly!)
1# Configuration for Linux performance profiling tools (perf, ebpf tracing,
2# flamegraphs).
3{
4 config,
5 lib,
6 pkgs,
7 ...
8}:
9with lib; let
10 linuxpkgs = config.boot.kernelPackages;
11 cfg = config.profiles.perftools.enable;
12in {
13 options.profiles.perftools.enable = mkEnableOption "perftools";
14
15 config = mkIf cfg {
16 environment.systemPackages = with pkgs; [
17 # use the correct version of `perf` for the configured `linuxPackages`
18 perf
19 # also include userspace perf-tools and flamegraph scripts
20 perf-tools
21 flamegraph
22 ];
23 # this does the same thing as above (using the correct `linuxPackages`) but
24 # for `bcc`...sad there's no version of this for perf out of the box.
25 programs.bcc.enable = true;
26 };
27}