perf: extract from linuxPackages; deduplicate

There's no reason for us to be packaging old versions of perf. You
don't need to match it with a kernel version. Let's build it from the
latest kernel sources, so it'll get kept up to date.

+10 -63
+2 -2
pkgs/by-name/ho/hotspot/package.nix
··· 10 10 kddockwidgets, 11 11 kdePackages, 12 12 libelf, 13 - linuxPackages, 13 + perf, 14 14 qt6, 15 15 rustc-demangle, 16 16 zstd, ··· 74 74 qtWrapperArgs = [ 75 75 "--suffix PATH : ${ 76 76 lib.makeBinPath [ 77 - linuxPackages.perf 77 + perf 78 78 binutils 79 79 ] 80 80 }"
+7 -43
pkgs/os-specific/linux/kernel/perf/default.nix pkgs/by-name/pe/perf/package.nix
··· 2 2 lib, 3 3 stdenv, 4 4 fetchurl, 5 - kernel, 5 + linux_latest, 6 6 elfutils, 7 7 python3, 8 8 newt, ··· 21 21 libiberty, 22 22 audit, 23 23 libbfd, 24 - libbfd_2_38, 25 24 libopcodes, 26 - libopcodes_2_38, 27 25 libpfm, 28 26 libtraceevent, 29 27 openssl, ··· 57 55 58 56 stdenv.mkDerivation { 59 57 pname = "perf-linux"; 60 - inherit (kernel) version src; 58 + inherit (linux_latest) version src; 61 59 62 60 strictDeps = true; 63 61 64 62 depsBuildBuild = [ buildPackages.stdenv.cc ]; 65 - 66 - patches = 67 - lib.optionals (lib.versionAtLeast kernel.version "5.10" && lib.versionOlder kernel.version "6.13") 68 - [ 69 - # fix wrong path to dmesg 70 - ./fix-dmesg-path.diff 71 - ]; 72 63 73 64 postPatch = '' 74 65 # Linux scripts 75 66 patchShebangs scripts 76 67 patchShebangs tools/perf/check-headers.sh 77 - '' 78 - + lib.optionalString (lib.versionAtLeast kernel.version "6.3") '' 79 68 # perf-specific scripts 80 69 patchShebangs tools/perf/pmu-events 81 - '' 82 - + '' 83 70 cd tools/perf 84 71 85 72 for x in util/build-id.c util/dso.c; do 86 73 substituteInPlace $x --replace /usr/lib/debug /run/current-system/sw/lib/debug 87 74 done 88 75 89 - '' 90 - + lib.optionalString (lib.versionAtLeast kernel.version "5.8") '' 91 76 substituteInPlace scripts/python/flamegraph.py \ 92 77 --replace "/usr/share/d3-flame-graph/d3-flamegraph-base.html" \ 93 78 "${d3-flame-graph-templates}/share/d3-flame-graph/d3-flamegraph-base.html" 94 79 95 - '' 96 - + lib.optionalString (lib.versionAtLeast kernel.version "6.0") '' 97 80 patchShebangs pmu-events/jevents.py 98 81 ''; 99 82 ··· 137 120 numactl 138 121 python3 139 122 babeltrace 123 + libbfd 124 + libopcodes 125 + libpfm 126 + python3.pkgs.setuptools 140 127 ] 141 - ++ ( 142 - if (lib.versionAtLeast kernel.version "5.19") then 143 - [ 144 - libbfd 145 - libopcodes 146 - ] 147 - else 148 - [ 149 - libbfd_2_38 150 - libopcodes_2_38 151 - ] 152 - ) 153 128 ++ lib.optional (lib.meta.availableOn stdenv.hostPlatform systemtap-unwrapped) systemtap-unwrapped 154 129 ++ lib.optional withGtk gtk2 155 130 ++ lib.optional withZstd zstd 156 - ++ lib.optional withLibcap libcap 157 - ++ lib.optional (lib.versionAtLeast kernel.version "5.8") libpfm 158 - ++ lib.optional (lib.versionAtLeast kernel.version "6.0") python3.pkgs.setuptools 159 - # Python 3.12 no longer includes distutils, not needed for 6.0 and newer. 160 - ++ 161 - lib.optional 162 - (!(lib.versionAtLeast kernel.version "6.0") && lib.versionAtLeast python3.version "3.12") 163 - [ 164 - python3.pkgs.distutils 165 - python3.pkgs.packaging 166 - ]; 131 + ++ lib.optional withLibcap libcap; 167 132 168 133 env.NIX_CFLAGS_COMPILE = toString [ 169 134 "-Wno-error=cpp" ··· 206 171 mainProgram = "perf"; 207 172 maintainers = with maintainers; [ tobim ]; 208 173 platforms = platforms.linux; 209 - broken = kernel.kernelOlder "5"; 210 174 }; 211 175 }
-11
pkgs/os-specific/linux/kernel/perf/fix-dmesg-path.diff
··· 1 - --- a/tools/perf/util/evsel.c 2023-10-20 15:50:53.011023294 +0200 2 - +++ b/tools/perf/util/evsel.c 2023-10-20 15:51:03.205997633 +0200 3 - @@ -3076,7 +3076,7 @@ 4 - 5 - return scnprintf(msg, size, 6 - "The sys_perf_event_open() syscall returned with %d (%s) for event (%s).\n" 7 - - "/bin/dmesg | grep -i perf may provide additional information.\n", 8 - + "\"dmesg | grep -i perf\" may provide additional information.\n", 9 - err, str_error_r(err, sbuf, sizeof(sbuf)), evsel__name(evsel)); 10 - } 11 -
-5
pkgs/top-level/all-packages.nix
··· 5683 5683 ); 5684 5684 buildRustCrateHelpers = callPackage ../build-support/rust/build-rust-crate/helpers.nix { }; 5685 5685 5686 - cargo-flamegraph = callPackage ../by-name/ca/cargo-flamegraph/package.nix { 5687 - inherit (linuxPackages) perf; 5688 - }; 5689 - 5690 5686 defaultCrateOverrides = callPackage ../build-support/rust/default-crate-overrides.nix { }; 5691 5687 5692 5688 inherit (callPackages ../development/tools/rust/cargo-pgrx { }) ··· 7126 7122 pycritty = with python3Packages; toPythonApplication pycritty; 7127 7123 7128 7124 qtcreator = qt6Packages.callPackage ../development/tools/qtcreator { 7129 - inherit (linuxPackages) perf; 7130 7125 llvmPackages = llvmPackages_21; 7131 7126 stdenv = llvmPackages_21.stdenv; 7132 7127 };
+1 -2
pkgs/top-level/linux-kernels.nix
··· 584 584 585 585 netatop = callPackage ../os-specific/linux/netatop { }; 586 586 587 - perf = callPackage ../os-specific/linux/kernel/perf { }; 588 - 589 587 prl-tools = callPackage ../os-specific/linux/prl-tools { }; 590 588 591 589 isgx = callPackage ../os-specific/linux/isgx { }; ··· 714 712 xmm7360-pci = throw "Support for the XMM7360 WWAN card was added to the iosm kmod in mainline kernel version 5.18"; 715 713 amdgpu-pro = throw "amdgpu-pro was removed due to lack of maintenance"; # Added 2024-06-16 716 714 kvdo = throw "kvdo was removed, because it was added to mainline in kernel version 6.9"; # Added 2024-07-08 715 + perf = lib.warnOnInstantiate "linuxPackages.perf is now perf" pkgs.perf; # Added 2025-08-28 717 716 system76-power = lib.warnOnInstantiate "kernelPackages.system76-power is now pkgs.system76-power" pkgs.system76-power; # Added 2024-10-16 718 717 system76-scheduler = lib.warnOnInstantiate "kernelPackages.system76-scheduler is now pkgs.system76-scheduler" pkgs.system76-scheduler; # Added 2024-10-16 719 718 tuxedo-keyboard = self.tuxedo-drivers; # Added 2024-09-28