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
This commit is contained in:
Dominique Martinet 2021-12-04 00:11:22 +09:00
parent c52ea537b3
commit efe6967e93
4 changed files with 14 additions and 15 deletions

View file

@ -1,9 +1,9 @@
{ config, lib, ... }: { config, pkgs, lib, ... }:
{ {
options.programs.bcc.enable = lib.mkEnableOption "bcc"; options.programs.bcc.enable = lib.mkEnableOption "bcc";
config = lib.mkIf config.programs.bcc.enable { config = lib.mkIf config.programs.bcc.enable {
environment.systemPackages = [ config.boot.kernelPackages.bcc ]; environment.systemPackages = [ pkgs.bcc ];
boot.extraModulePackages = [ config.boot.kernelPackages.bcc ]; boot.extraModulePackages = [ pkgs.bcc ];
}; };
} }

View file

@ -1,7 +1,7 @@
{ lib, stdenv, fetchFromGitHub { lib, stdenv, fetchFromGitHub
, makeWrapper, cmake, llvmPackages, kernel , makeWrapper, cmake, llvmPackages
, flex, bison, elfutils, python, luajit, netperf, iperf, libelf , flex, bison, elfutils, python, luajit, netperf, iperf, libelf
, systemtap, bash , bash
}: }:
python.pkgs.buildPythonApplication rec { python.pkgs.buildPythonApplication rec {
@ -20,9 +20,9 @@ python.pkgs.buildPythonApplication rec {
format = "other"; format = "other";
buildInputs = with llvmPackages; [ buildInputs = with llvmPackages; [
llvm llvm.dev libclang kernel llvm llvm.dev libclang
elfutils luajit netperf iperf elfutils luajit netperf iperf
systemtap.stapBuild flex bash flex bash
]; ];
patches = [ patches = [
@ -32,12 +32,10 @@ python.pkgs.buildPythonApplication rec {
]; ];
propagatedBuildInputs = [ python.pkgs.netaddr ]; propagatedBuildInputs = [ python.pkgs.netaddr ];
nativeBuildInputs = [ makeWrapper cmake flex bison llvmPackages.llvm.dev ] nativeBuildInputs = [ makeWrapper cmake flex bison llvmPackages.llvm.dev ];
# libelf is incompatible with elfutils-libelf
++ lib.filter (x: x != libelf) kernel.moduleBuildDependencies;
cmakeFlags = [ cmakeFlags = [
"-DBCC_KERNEL_MODULES_DIR=${kernel.dev}/lib/modules" "-DBCC_KERNEL_MODULES_DIR=/run/booted-system/kernel-modules/lib/modules"
"-DREVISION=${version}" "-DREVISION=${version}"
"-DENABLE_USDT=ON" "-DENABLE_USDT=ON"
"-DENABLE_CPP_API=ON" "-DENABLE_CPP_API=ON"

View file

@ -14149,6 +14149,10 @@ with pkgs;
bpftools = callPackage ../os-specific/linux/bpftools { }; bpftools = callPackage ../os-specific/linux/bpftools { };
bcc = callPackage ../os-specific/linux/bcc {
python = pkgs.python3;
};
bpm-tools = callPackage ../tools/audio/bpm-tools { }; bpm-tools = callPackage ../tools/audio/bpm-tools { };
byacc = callPackage ../development/tools/parsing/byacc { }; byacc = callPackage ../development/tools/parsing/byacc { };

View file

@ -250,6 +250,7 @@ in {
inherit (kernel) kernelOlder kernelAtLeast; inherit (kernel) kernelOlder kernelAtLeast;
# Obsolete aliases (these packages do not depend on the kernel). # Obsolete aliases (these packages do not depend on the kernel).
inherit (pkgs) odp-dpdk pktgen; # added 2018-05 inherit (pkgs) odp-dpdk pktgen; # added 2018-05
inherit (pkgs) bcc; # added 2021-12
acpi_call = callPackage ../os-specific/linux/acpi-call {}; acpi_call = callPackage ../os-specific/linux/acpi-call {};
@ -263,10 +264,6 @@ in {
batman_adv = callPackage ../os-specific/linux/batman-adv {}; batman_adv = callPackage ../os-specific/linux/batman-adv {};
bcc = callPackage ../os-specific/linux/bcc {
python = pkgs.python3;
};
bpftrace = callPackage ../os-specific/linux/bpftrace { }; bpftrace = callPackage ../os-specific/linux/bpftrace { };
bbswitch = callPackage ../os-specific/linux/bbswitch {}; bbswitch = callPackage ../os-specific/linux/bbswitch {};