1 { lib, stdenv, fetchFromGitHub
2 , llvmPackages, elfutils, bcc
3 , libbpf, libbfd, libopcodes, glibc
5 , cmake, pkg-config, flex, bison
11 stdenv.mkDerivation rec {
15 src = fetchFromGitHub {
19 hash = "sha256-/2m+5iFE7R+ZEc/VcgWAhkLD/jEK88roUUOUyYODi0U=";
23 buildInputs = with llvmPackages; [
26 libbpf libbfd libopcodes
31 cmake pkg-config flex bison
36 # tests aren't built, due to gtest shenanigans. see:
38 # https://github.com/iovisor/bpftrace/issues/161#issuecomment-453606728
39 # https://github.com/iovisor/bpftrace/pull/363
42 "-DBUILD_TESTING=FALSE"
43 "-DLIBBCC_INCLUDE_DIRS=${bcc}/include"
44 "-DINSTALL_TOOL_DOCS=OFF"
45 "-DSYSTEM_INCLUDE_PATHS=${glibc.dev}/include"
50 name = "runqlat-bt-no-includes.patch";
51 url = "https://github.com/bpftrace/bpftrace/pull/3262.patch";
52 hash = "sha256-9yqaZeG1Uf2cC9Aa40c2QUTQRl8n2NO1nq278hf9P4M=";
55 name = "kheaders-not-found-message-only-on-error.patch";
56 url = "https://github.com/bpftrace/bpftrace/pull/3265.patch";
57 hash = "sha256-8AICMzwq5Evy9+hmZhFjccw/HmgZ9t+YIoHApjLv6Uc=";
58 excludes = [ "CHANGELOG.md" ];
62 # Pull BPF scripts into $PATH (next to their bcc program equivalents), but do
63 # not move them to keep `${pkgs.bpftrace}/share/bpftrace/tools/...` working.
65 ln -sr $out/share/bpftrace/tools/*.bt $out/bin/
66 # do not use /usr/bin/env for shipped tools
67 # If someone can get patchShebangs to work here please fix.
68 sed -i -e "1s:#!/usr/bin/env bpftrace:#!$out/bin/bpftrace:" $out/share/bpftrace/tools/*.bt
71 outputs = [ "out" "man" ];
78 description = "High-level tracing language for Linux eBPF";
79 homepage = "https://github.com/iovisor/bpftrace";
80 changelog = "https://github.com/iovisor/bpftrace/releases/tag/v${version}";
81 mainProgram = "bpftrace";
82 license = licenses.asl20;
83 maintainers = with maintainers; [ rvl thoughtpolice martinetd mfrw ];
84 platforms = platforms.linux;