nixpkgs/pkgs/os-specific/linux/bpftrace/default.nix
Dominique Martinet c09962fb2c bpftrace: 0.15.0 -> 0.16.0
note bcc 0.25.0 breaks bpftrace 0.15.0, so this needs to be together
with bcc upgrade
2022-12-01 12:51:25 +09:00

60 lines
1.5 KiB
Nix

{ lib, stdenv, fetchFromGitHub
, cmake, pkg-config, flex, bison
, llvmPackages, elfutils
, libbfd, libbpf, libopcodes, bcc
, cereal, asciidoctor
, nixosTests
, util-linux
}:
stdenv.mkDerivation rec {
pname = "bpftrace";
version = "0.16.0";
src = fetchFromGitHub {
owner = "iovisor";
repo = "bpftrace";
rev = "v${version}";
sha256 = "sha256-S43KS/qpzxU+Sgkcud4Cyx4yRjaT6SZzLv6R6bg5I2w=";
};
buildInputs = with llvmPackages;
[ llvm libclang
elfutils bcc
libbpf libbfd libopcodes
cereal asciidoctor
];
nativeBuildInputs = [ cmake pkg-config flex bison llvmPackages.llvm.dev util-linux ];
# 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"
"-DINSTALL_TOOL_DOCS=off"
];
# Pull BPF scripts into $PATH (next to their bcc program equivalents), but do
# not move them to keep `${pkgs.bpftrace}/share/bpftrace/tools/...` working.
postInstall = ''
ln -s $out/share/bpftrace/tools/*.bt $out/bin/
'';
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 ];
};
}