From efe6967e9359bda4b9407e0d2cf9d0b0a6666652 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Sat, 4 Dec 2021 00:11:22 +0900 Subject: [PATCH] bcc: move from linux-kernels packages to normal packages bcc doesn't really need kernel itself, it just cares about module path. It's actually better to use /run/booted-system/kernel-modules/lib/modules for two reasons: - no need to rebuild bcc for each new kernel - can use a newer bcc with a booted kernel that doesn't match the current system --- nixos/modules/programs/bcc.nix | 6 +++--- pkgs/os-specific/linux/bcc/default.nix | 14 ++++++-------- pkgs/top-level/all-packages.nix | 4 ++++ pkgs/top-level/linux-kernels.nix | 5 +---- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/nixos/modules/programs/bcc.nix b/nixos/modules/programs/bcc.nix index d76249bb5cab..e475c6ceaa6c 100644 --- a/nixos/modules/programs/bcc.nix +++ b/nixos/modules/programs/bcc.nix @@ -1,9 +1,9 @@ -{ config, lib, ... }: +{ config, pkgs, lib, ... }: { options.programs.bcc.enable = lib.mkEnableOption "bcc"; config = lib.mkIf config.programs.bcc.enable { - environment.systemPackages = [ config.boot.kernelPackages.bcc ]; - boot.extraModulePackages = [ config.boot.kernelPackages.bcc ]; + environment.systemPackages = [ pkgs.bcc ]; + boot.extraModulePackages = [ pkgs.bcc ]; }; } diff --git a/pkgs/os-specific/linux/bcc/default.nix b/pkgs/os-specific/linux/bcc/default.nix index 91e53d686a1b..4e8f28a0eda1 100644 --- a/pkgs/os-specific/linux/bcc/default.nix +++ b/pkgs/os-specific/linux/bcc/default.nix @@ -1,7 +1,7 @@ { lib, stdenv, fetchFromGitHub -, makeWrapper, cmake, llvmPackages, kernel +, makeWrapper, cmake, llvmPackages , flex, bison, elfutils, python, luajit, netperf, iperf, libelf -, systemtap, bash +, bash }: python.pkgs.buildPythonApplication rec { @@ -20,9 +20,9 @@ python.pkgs.buildPythonApplication rec { format = "other"; buildInputs = with llvmPackages; [ - llvm llvm.dev libclang kernel + llvm llvm.dev libclang elfutils luajit netperf iperf - systemtap.stapBuild flex bash + flex bash ]; patches = [ @@ -32,12 +32,10 @@ python.pkgs.buildPythonApplication rec { ]; propagatedBuildInputs = [ python.pkgs.netaddr ]; - nativeBuildInputs = [ makeWrapper cmake flex bison llvmPackages.llvm.dev ] - # libelf is incompatible with elfutils-libelf - ++ lib.filter (x: x != libelf) kernel.moduleBuildDependencies; + nativeBuildInputs = [ makeWrapper cmake flex bison llvmPackages.llvm.dev ]; cmakeFlags = [ - "-DBCC_KERNEL_MODULES_DIR=${kernel.dev}/lib/modules" + "-DBCC_KERNEL_MODULES_DIR=/run/booted-system/kernel-modules/lib/modules" "-DREVISION=${version}" "-DENABLE_USDT=ON" "-DENABLE_CPP_API=ON" diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index eabb434a3299..fd5a63bdc2cb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14149,6 +14149,10 @@ with pkgs; bpftools = callPackage ../os-specific/linux/bpftools { }; + bcc = callPackage ../os-specific/linux/bcc { + python = pkgs.python3; + }; + bpm-tools = callPackage ../tools/audio/bpm-tools { }; byacc = callPackage ../development/tools/parsing/byacc { }; diff --git a/pkgs/top-level/linux-kernels.nix b/pkgs/top-level/linux-kernels.nix index 2aa9f8482f18..e17bef470559 100644 --- a/pkgs/top-level/linux-kernels.nix +++ b/pkgs/top-level/linux-kernels.nix @@ -250,6 +250,7 @@ in { inherit (kernel) kernelOlder kernelAtLeast; # Obsolete aliases (these packages do not depend on the kernel). inherit (pkgs) odp-dpdk pktgen; # added 2018-05 + inherit (pkgs) bcc; # added 2021-12 acpi_call = callPackage ../os-specific/linux/acpi-call {}; @@ -263,10 +264,6 @@ in { batman_adv = callPackage ../os-specific/linux/batman-adv {}; - bcc = callPackage ../os-specific/linux/bcc { - python = pkgs.python3; - }; - bpftrace = callPackage ../os-specific/linux/bpftrace { }; bbswitch = callPackage ../os-specific/linux/bbswitch {};