ce641f4048
GitOrigin-RevId: bc5d68306b40b8522ffb69ba6cff91898c2fbbff
62 lines
1.6 KiB
Nix
62 lines
1.6 KiB
Nix
{ lib, stdenv, fetchFromGitHub
|
|
, cmake, pkg-config, flex, bison
|
|
, llvmPackages, elfutils
|
|
, libelf, libbfd, libbpf, libopcodes, bcc
|
|
, cereal, asciidoctor
|
|
, nixosTests
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "bpftrace";
|
|
version = "0.14.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "iovisor";
|
|
repo = "bpftrace";
|
|
rev = "v${version}";
|
|
sha256 = "sha256-rlaajNfpoiMtU/4aNAnbQ0VixPz9/302TZMarGzsb58=";
|
|
};
|
|
|
|
# libbpf 0.6.0 relies on typeof in bpf/btf.h to pick the right version of
|
|
# btf_dump__new() but that's not valid c++.
|
|
# see https://github.com/iovisor/bpftrace/issues/2068
|
|
patches = [ ./btf-dump-new-0.6.0.patch ];
|
|
|
|
buildInputs = with llvmPackages;
|
|
[ llvm libclang
|
|
elfutils libelf bcc
|
|
libbpf libbfd libopcodes
|
|
cereal asciidoctor
|
|
];
|
|
|
|
nativeBuildInputs = [ cmake pkg-config flex bison llvmPackages.llvm.dev ];
|
|
|
|
# tests aren't built, due to gtest shenanigans. see:
|
|
#
|
|
# https://github.com/iovisor/bpftrace/issues/161#issuecomment-453606728
|
|
# https://github.com/iovisor/bpftrace/pull/363
|
|
#
|
|
cmakeFlags =
|
|
[ "-DBUILD_TESTING=FALSE"
|
|
"-DLIBBCC_INCLUDE_DIRS=${bcc}/include"
|
|
];
|
|
|
|
# nuke the example/reference output .txt files, for the included tools,
|
|
# stuffed inside $out. we don't need them at all.
|
|
postInstall = ''
|
|
rm -rf $out/share/bpftrace/tools/doc
|
|
'';
|
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
passthru.tests = {
|
|
bpf = nixosTests.bpf;
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "High-level tracing language for Linux eBPF";
|
|
homepage = "https://github.com/iovisor/bpftrace";
|
|
license = licenses.asl20;
|
|
maintainers = with maintainers; [ rvl thoughtpolice martinetd ];
|
|
};
|
|
}
|