21 python3Packages.buildPythonApplication rec {
25 disabled = !stdenv.hostPlatform.isLinux;
27 src = fetchFromGitHub {
30 rev = "refs/tags/v${version}";
31 hash = "sha256-ludgmHFOyBu1CwUiaqczmNui0J8bUBAA5QGBiado8yw=";
35 buildInputs = with llvmPackages; [
36 llvm llvm.dev libclang
37 elfutils luajit netperf iperf
42 # This is needed until we fix
43 # https://github.com/NixOS/nixpkgs/issues/40427
44 ./fix-deadlock-detector-import.patch
47 propagatedBuildInputs = [ python3Packages.netaddr ];
54 python3Packages.setuptools
59 "-DBCC_KERNEL_MODULES_DIR=/run/booted-system/kernel-modules/lib/modules"
60 "-DREVISION=${version}"
63 "-DCMAKE_USE_LIBBPF_PACKAGE=ON"
64 "-DENABLE_LIBDEBUGINFOD=OFF"
67 # to replace this executable path:
68 # https://github.com/iovisor/bcc/blob/master/src/python/bcc/syscall.py#L384
69 ausyscall = "${audit}/bin/ausyscall";
72 substituteAll ${./libbcc-path.patch} ./libbcc-path.patch
73 patch -p1 < libbcc-path.patch
75 substituteAll ${./absolute-ausyscall.patch} ./absolute-ausyscall.patch
76 patch -p1 < absolute-ausyscall.patch
78 # https://github.com/iovisor/bcc/issues/3996
79 substituteInPlace src/cc/libbcc.pc.in \
80 --replace '$'{exec_prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@
84 # required for setuptool during install
85 export PYTHONPATH=$out/${python3Packages.python.sitePackages}:$PYTHONPATH
88 mkdir -p $out/bin $out/share
89 rm -r $out/share/bcc/tools/old
90 mv $out/share/bcc/tools/doc $out/share
91 mv $out/share/bcc/man $out/share/
93 find $out/share/bcc/tools -type f -executable -print0 | \
94 while IFS= read -r -d ''$'\0' f; do
95 bin=$out/bin/$(basename $f)
96 if [ ! -e $bin ]; then
99 substituteInPlace "$f" \
100 --replace '$(dirname $0)/lib' "$out/share/bcc/tools/lib"
103 sed -i -e "s!lib=.*!lib=$out/bin!" $out/bin/{java,ruby,node,python}gc
107 wrapPythonProgramsIn "$out/share/bcc/tools" "$out $pythonPath"
110 outputs = [ "out" "man" ];
113 bpf = nixosTests.bpf;
117 description = "Dynamic Tracing Tools for Linux";
118 homepage = "https://iovisor.github.io/bcc/";
119 license = licenses.asl20;
120 maintainers = with maintainers; [ ragge mic92 thoughtpolice martinetd ];
121 platforms = platforms.linux;