From 8940dd0559f0f6a14b4ef174f0a3c7538bbed69e Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sun, 14 Aug 2022 09:12:16 +0100 Subject: [PATCH] linuxPackages.perf: move from perf.nix to perf/ directory While at it dropped top-level 'with lib;'. --- .../{ => perf}/5.19-binutils-2.39-support.patch | 0 .../linux/kernel/{perf.nix => perf/default.nix} | 14 +++++--------- pkgs/top-level/linux-kernels.nix | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) rename pkgs/os-specific/linux/kernel/{ => perf}/5.19-binutils-2.39-support.patch (100%) rename pkgs/os-specific/linux/kernel/{perf.nix => perf/default.nix} (84%) diff --git a/pkgs/os-specific/linux/kernel/5.19-binutils-2.39-support.patch b/pkgs/os-specific/linux/kernel/perf/5.19-binutils-2.39-support.patch similarity index 100% rename from pkgs/os-specific/linux/kernel/5.19-binutils-2.39-support.patch rename to pkgs/os-specific/linux/kernel/perf/5.19-binutils-2.39-support.patch diff --git a/pkgs/os-specific/linux/kernel/perf.nix b/pkgs/os-specific/linux/kernel/perf/default.nix similarity index 84% rename from pkgs/os-specific/linux/kernel/perf.nix rename to pkgs/os-specific/linux/kernel/perf/default.nix index 199c12b8e24d..d481eea7e753 100644 --- a/pkgs/os-specific/linux/kernel/perf.nix +++ b/pkgs/os-specific/linux/kernel/perf/default.nix @@ -7,15 +7,13 @@ , withLibcap ? true, libcap }: -with lib; - stdenv.mkDerivation { pname = "perf-linux"; version = kernel.version; inherit (kernel) src; - patches = optionals (versionAtLeast kernel.version "5.19" && versionOlder kernel.version "5.20") [ + patches = lib.optionals (lib.versionAtLeast kernel.version "5.19" && lib.versionOlder kernel.version "5.20") [ # binutils-2.39 support around init_disassemble_info() # API change. # Will be included in 5.20. @@ -50,12 +48,10 @@ stdenv.mkDerivation { elfutils newt slang libunwind libbfd zlib openssl systemtap.stapBuild numactl libopcodes python3 perl ] ++ lib.optional withGtk gtk2 - ++ (if (versionAtLeast kernel.version "4.19") then [ python3 ] else [ python2 ]) + ++ (if (lib.versionAtLeast kernel.version "4.19") then [ python3 ] else [ python2 ]) ++ lib.optional withZstd zstd ++ lib.optional withLibcap libcap; - # Note: we don't add elfutils to buildInputs, since it provides a - # bad `ld' and other stuff. NIX_CFLAGS_COMPILE = toString [ "-Wno-error=cpp" "-Wno-error=bool-compare" @@ -79,11 +75,11 @@ stdenv.mkDerivation { --prefix PATH : "${binutils-unwrapped}/bin" ''; - meta = { + meta = with lib; { homepage = "https://perf.wiki.kernel.org/"; description = "Linux tools to profile with performance counters"; - maintainers = with lib.maintainers; [viric]; - platforms = with lib.platforms; linux; + maintainers = with maintainers; [ viric ]; + platforms = platforms.linux; broken = kernel.kernelOlder "5"; }; } diff --git a/pkgs/top-level/linux-kernels.nix b/pkgs/top-level/linux-kernels.nix index 7f7c4bb4e9c6..bb19710ffd87 100644 --- a/pkgs/top-level/linux-kernels.nix +++ b/pkgs/top-level/linux-kernels.nix @@ -430,7 +430,7 @@ in { oci-seccomp-bpf-hook = if lib.versionAtLeast kernel.version "5.4" then callPackage ../os-specific/linux/oci-seccomp-bpf-hook { } else null; - perf = callPackage ../os-specific/linux/kernel/perf.nix { }; + perf = callPackage ../os-specific/linux/kernel/perf { }; phc-intel = if lib.versionAtLeast kernel.version "4.10" then callPackage ../os-specific/linux/phc-intel { } else null;