zoxide: 0.9.6 -> 0.9.7 (#380745)
[NixPkgs.git] / pkgs / by-name / bp / bpftrace / package.nix
blob4e648e80b5cbdea6e7a41717f7a5171994c4eacb
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   llvmPackages,
6   elfutils,
7   bcc,
8   libbpf,
9   libbfd,
10   libopcodes,
11   glibc,
12   cereal,
13   asciidoctor,
14   cmake,
15   pkg-config,
16   flex,
17   bison,
18   util-linux,
19   fetchpatch,
20   nixosTests,
23 stdenv.mkDerivation rec {
24   pname = "bpftrace";
25   version = "0.22.1";
27   src = fetchFromGitHub {
28     owner = "bpftrace";
29     repo = "bpftrace";
30     rev = "v${version}";
31     hash = "sha256-3qtErf3+T73DE40d6F8vFK1TdHcM/56AYFGGzxpRIug=";
32   };
34   buildInputs = with llvmPackages; [
35     llvm
36     libclang
37     elfutils
38     bcc
39     libbpf
40     libbfd
41     libopcodes
42     cereal
43     asciidoctor
44   ];
46   nativeBuildInputs = [
47     cmake
48     pkg-config
49     flex
50     bison
51     llvmPackages.llvm.dev
52     util-linux
53   ];
55   cmakeFlags = [
56     "-DLIBBCC_INCLUDE_DIRS=${bcc}/include"
57     "-DINSTALL_TOOL_DOCS=OFF"
58     "-DSYSTEM_INCLUDE_PATHS=${glibc.dev}/include"
59   ];
61   # Pull BPF scripts into $PATH (next to their bcc program equivalents), but do
62   # not move them to keep `${pkgs.bpftrace}/share/bpftrace/tools/...` working.
63   postInstall = ''
64     ln -sr $out/share/bpftrace/tools/*.bt $out/bin/
65     # do not use /usr/bin/env for shipped tools
66     # If someone can get patchShebangs to work here please fix.
67     sed -i -e "1s:#!/usr/bin/env bpftrace:#!$out/bin/bpftrace:" $out/share/bpftrace/tools/*.bt
68   '';
70   outputs = [
71     "out"
72     "man"
73   ];
75   passthru.tests = {
76     bpf = nixosTests.bpf;
77   };
79   meta = with lib; {
80     description = "High-level tracing language for Linux eBPF";
81     homepage = "https://github.com/bpftrace/bpftrace";
82     changelog = "https://github.com/bpftrace/bpftrace/releases/tag/v${version}";
83     mainProgram = "bpftrace";
84     license = licenses.asl20;
85     maintainers = with maintainers; [
86       rvl
87       thoughtpolice
88       martinetd
89       mfrw
90       illustris
91     ];
92     platforms = platforms.linux;
93   };