2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv, fetchFromGitHub
|
2021-01-19 07:50:56 +01:00
|
|
|
, cmake, pkg-config, flex, bison
|
2021-12-03 16:12:47 +01:00
|
|
|
, llvmPackages, elfutils
|
2022-07-13 12:50:34 +02:00
|
|
|
, libbfd, libbpf, libopcodes, bcc
|
2021-12-04 00:56:03 +01:00
|
|
|
, cereal, asciidoctor
|
2021-12-04 02:20:26 +01:00
|
|
|
, nixosTests
|
2022-05-26 04:05:03 +02:00
|
|
|
, util-linux
|
2018-10-15 05:17:12 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "bpftrace";
|
2022-05-30 13:41:33 +02:00
|
|
|
version = "0.15.0";
|
2018-10-15 05:17:12 +02:00
|
|
|
|
2022-05-26 04:05:03 +02:00
|
|
|
# Cherry-picked from merged PR, remove this hook on next update
|
|
|
|
# https://github.com/iovisor/bpftrace/pull/2242
|
|
|
|
# Cannot `fetchpatch` such pure renaming diff since
|
|
|
|
# https://github.com/iovisor/bpftrace/commit/2df807dbae4037aa8bf0afc03f52fb3f6321c62a.patch
|
|
|
|
# does not contain any diff in unified format but just this instead:
|
|
|
|
# ...
|
|
|
|
# man/man8/{bashreadline.8 => bashreadline.bt.8} | 0
|
|
|
|
# ...
|
|
|
|
# 35 files changed, 0 insertions(+), 0 deletions(-)
|
|
|
|
# rename man/man8/{bashreadline.8 => bashreadline.bt.8} (100%)
|
|
|
|
# ...
|
|
|
|
# on witch `fetchpatch` fails with
|
|
|
|
# error: Normalized patch '/build/patch' is empty (while the fetched file was not)!
|
|
|
|
# Did you maybe fetch a HTML representation of a patch instead of a raw patch?
|
|
|
|
postUnpack = ''
|
|
|
|
rename .8 .bt.8 "$sourceRoot"/man/man8/*.8
|
|
|
|
'';
|
|
|
|
|
2018-10-15 05:17:12 +02:00
|
|
|
src = fetchFromGitHub {
|
bpftrace: unstable-2018-10-27 -> 0.9
Update bpftrace to the latest pre-release, with a real version number.
The most notable change now is that bpftrace can use a stable version of
the 'bcc' toolchain in order to build, meaning no more hacks are needed
to clone the source code and fix up the build system, etc. This
simplifies things greatly and removes the old bcc-source patch.
Similarly, we can remove our custom gtests patch (which disabled the
build) by just passing -DBUILD_TESTING=FALSE when running cmake. This
was also added upstream recently.
However, something does still need to be fixed, at a cost: bpftrace
requires the kernel -dev package because it wants both objects and
include directories (some files are only shipped in one or the other).
Therefore, we remove the dependency on linuxHeaders and instead use
kernel.dev as the sole input to the build.
This is both a positive and a negative: the positive is that tools work
without annoying fatal errors, and that the bpf toolchain is
synchronized to the linuxPackages.kernel derivation it was built
against. The downside is that the .dev expression is much heavier as a
dependency, so bpftrace is now closer to 700mb in closure size. (This
especially hurts across kernel upgrades requiring a whole new rebuild,
especially if you have existing nixos generations that won't GC, etc.)
We probably want to slim this down substantially in the future (and
there may be a few ways to do that), but as this will probably also
touch bcc, and as a first cut of the pre-releases, this is probably fine
while we work out other kinks.
Signed-off-by: Austin Seipp <aseipp@pobox.com>
2019-05-03 08:16:37 +02:00
|
|
|
owner = "iovisor";
|
|
|
|
repo = "bpftrace";
|
2021-04-02 17:13:54 +02:00
|
|
|
rev = "v${version}";
|
2022-05-30 13:41:33 +02:00
|
|
|
sha256 = "sha256-9adZAKSn00W2yNwVDbVB1/O5Y+10c4EkVJGCHyd4Tgg=";
|
2018-10-15 05:17:12 +02:00
|
|
|
};
|
|
|
|
|
bpftrace: unstable-2018-10-27 -> 0.9
Update bpftrace to the latest pre-release, with a real version number.
The most notable change now is that bpftrace can use a stable version of
the 'bcc' toolchain in order to build, meaning no more hacks are needed
to clone the source code and fix up the build system, etc. This
simplifies things greatly and removes the old bcc-source patch.
Similarly, we can remove our custom gtests patch (which disabled the
build) by just passing -DBUILD_TESTING=FALSE when running cmake. This
was also added upstream recently.
However, something does still need to be fixed, at a cost: bpftrace
requires the kernel -dev package because it wants both objects and
include directories (some files are only shipped in one or the other).
Therefore, we remove the dependency on linuxHeaders and instead use
kernel.dev as the sole input to the build.
This is both a positive and a negative: the positive is that tools work
without annoying fatal errors, and that the bpf toolchain is
synchronized to the linuxPackages.kernel derivation it was built
against. The downside is that the .dev expression is much heavier as a
dependency, so bpftrace is now closer to 700mb in closure size. (This
especially hurts across kernel upgrades requiring a whole new rebuild,
especially if you have existing nixos generations that won't GC, etc.)
We probably want to slim this down substantially in the future (and
there may be a few ways to do that), but as this will probably also
touch bcc, and as a first cut of the pre-releases, this is probably fine
while we work out other kinks.
Signed-off-by: Austin Seipp <aseipp@pobox.com>
2019-05-03 08:16:37 +02:00
|
|
|
buildInputs = with llvmPackages;
|
2021-05-09 01:50:12 +02:00
|
|
|
[ llvm libclang
|
2022-07-13 12:50:34 +02:00
|
|
|
elfutils bcc
|
2020-09-01 00:40:18 +02:00
|
|
|
libbpf libbfd libopcodes
|
2021-12-04 00:56:03 +01:00
|
|
|
cereal asciidoctor
|
bpftrace: unstable-2018-10-27 -> 0.9
Update bpftrace to the latest pre-release, with a real version number.
The most notable change now is that bpftrace can use a stable version of
the 'bcc' toolchain in order to build, meaning no more hacks are needed
to clone the source code and fix up the build system, etc. This
simplifies things greatly and removes the old bcc-source patch.
Similarly, we can remove our custom gtests patch (which disabled the
build) by just passing -DBUILD_TESTING=FALSE when running cmake. This
was also added upstream recently.
However, something does still need to be fixed, at a cost: bpftrace
requires the kernel -dev package because it wants both objects and
include directories (some files are only shipped in one or the other).
Therefore, we remove the dependency on linuxHeaders and instead use
kernel.dev as the sole input to the build.
This is both a positive and a negative: the positive is that tools work
without annoying fatal errors, and that the bpf toolchain is
synchronized to the linuxPackages.kernel derivation it was built
against. The downside is that the .dev expression is much heavier as a
dependency, so bpftrace is now closer to 700mb in closure size. (This
especially hurts across kernel upgrades requiring a whole new rebuild,
especially if you have existing nixos generations that won't GC, etc.)
We probably want to slim this down substantially in the future (and
there may be a few ways to do that), but as this will probably also
touch bcc, and as a first cut of the pre-releases, this is probably fine
while we work out other kinks.
Signed-off-by: Austin Seipp <aseipp@pobox.com>
2019-05-03 08:16:37 +02:00
|
|
|
];
|
2018-10-15 05:17:12 +02:00
|
|
|
|
2022-05-26 04:05:03 +02:00
|
|
|
nativeBuildInputs = [ cmake pkg-config flex bison llvmPackages.llvm.dev util-linux ];
|
2018-10-15 05:17:12 +02:00
|
|
|
|
bpftrace: unstable-2018-10-27 -> 0.9
Update bpftrace to the latest pre-release, with a real version number.
The most notable change now is that bpftrace can use a stable version of
the 'bcc' toolchain in order to build, meaning no more hacks are needed
to clone the source code and fix up the build system, etc. This
simplifies things greatly and removes the old bcc-source patch.
Similarly, we can remove our custom gtests patch (which disabled the
build) by just passing -DBUILD_TESTING=FALSE when running cmake. This
was also added upstream recently.
However, something does still need to be fixed, at a cost: bpftrace
requires the kernel -dev package because it wants both objects and
include directories (some files are only shipped in one or the other).
Therefore, we remove the dependency on linuxHeaders and instead use
kernel.dev as the sole input to the build.
This is both a positive and a negative: the positive is that tools work
without annoying fatal errors, and that the bpf toolchain is
synchronized to the linuxPackages.kernel derivation it was built
against. The downside is that the .dev expression is much heavier as a
dependency, so bpftrace is now closer to 700mb in closure size. (This
especially hurts across kernel upgrades requiring a whole new rebuild,
especially if you have existing nixos generations that won't GC, etc.)
We probably want to slim this down substantially in the future (and
there may be a few ways to do that), but as this will probably also
touch bcc, and as a first cut of the pre-releases, this is probably fine
while we work out other kinks.
Signed-off-by: Austin Seipp <aseipp@pobox.com>
2019-05-03 08:16:37 +02:00
|
|
|
# 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"
|
2020-09-01 00:40:18 +02:00
|
|
|
"-DLIBBCC_INCLUDE_DIRS=${bcc}/include"
|
bpftrace: unstable-2018-10-27 -> 0.9
Update bpftrace to the latest pre-release, with a real version number.
The most notable change now is that bpftrace can use a stable version of
the 'bcc' toolchain in order to build, meaning no more hacks are needed
to clone the source code and fix up the build system, etc. This
simplifies things greatly and removes the old bcc-source patch.
Similarly, we can remove our custom gtests patch (which disabled the
build) by just passing -DBUILD_TESTING=FALSE when running cmake. This
was also added upstream recently.
However, something does still need to be fixed, at a cost: bpftrace
requires the kernel -dev package because it wants both objects and
include directories (some files are only shipped in one or the other).
Therefore, we remove the dependency on linuxHeaders and instead use
kernel.dev as the sole input to the build.
This is both a positive and a negative: the positive is that tools work
without annoying fatal errors, and that the bpf toolchain is
synchronized to the linuxPackages.kernel derivation it was built
against. The downside is that the .dev expression is much heavier as a
dependency, so bpftrace is now closer to 700mb in closure size. (This
especially hurts across kernel upgrades requiring a whole new rebuild,
especially if you have existing nixos generations that won't GC, etc.)
We probably want to slim this down substantially in the future (and
there may be a few ways to do that), but as this will probably also
touch bcc, and as a first cut of the pre-releases, this is probably fine
while we work out other kinks.
Signed-off-by: Austin Seipp <aseipp@pobox.com>
2019-05-03 08:16:37 +02:00
|
|
|
];
|
|
|
|
|
2019-05-03 19:25:28 +02:00
|
|
|
# nuke the example/reference output .txt files, for the included tools,
|
|
|
|
# stuffed inside $out. we don't need them at all.
|
2022-06-04 00:08:36 +02:00
|
|
|
# (see "Allow skipping examples" for a potential option
|
|
|
|
# https://github.com/iovisor/bpftrace/pull/2256)
|
|
|
|
#
|
|
|
|
# Pull BPF scripts into $PATH (next to their bcc program equivalents), but do
|
|
|
|
# not move them to keep `${pkgs.bpftrace}/share/bpftrace/tools/...` working.
|
|
|
|
# (remove `chmod` once a new release "Add executable permission to tools"
|
|
|
|
# https://github.com/iovisor/bpftrace/commit/77e524e6d276216ed6a6e1984cf204418db07c78)
|
2019-05-03 19:25:28 +02:00
|
|
|
postInstall = ''
|
|
|
|
rm -rf $out/share/bpftrace/tools/doc
|
2022-06-04 00:08:36 +02:00
|
|
|
|
|
|
|
ln -s $out/share/bpftrace/tools/*.bt $out/bin/
|
|
|
|
chmod +x $out/bin/*.bt
|
2019-05-03 19:25:28 +02:00
|
|
|
'';
|
|
|
|
|
bpftrace: unstable-2018-10-27 -> 0.9
Update bpftrace to the latest pre-release, with a real version number.
The most notable change now is that bpftrace can use a stable version of
the 'bcc' toolchain in order to build, meaning no more hacks are needed
to clone the source code and fix up the build system, etc. This
simplifies things greatly and removes the old bcc-source patch.
Similarly, we can remove our custom gtests patch (which disabled the
build) by just passing -DBUILD_TESTING=FALSE when running cmake. This
was also added upstream recently.
However, something does still need to be fixed, at a cost: bpftrace
requires the kernel -dev package because it wants both objects and
include directories (some files are only shipped in one or the other).
Therefore, we remove the dependency on linuxHeaders and instead use
kernel.dev as the sole input to the build.
This is both a positive and a negative: the positive is that tools work
without annoying fatal errors, and that the bpf toolchain is
synchronized to the linuxPackages.kernel derivation it was built
against. The downside is that the .dev expression is much heavier as a
dependency, so bpftrace is now closer to 700mb in closure size. (This
especially hurts across kernel upgrades requiring a whole new rebuild,
especially if you have existing nixos generations that won't GC, etc.)
We probably want to slim this down substantially in the future (and
there may be a few ways to do that), but as this will probably also
touch bcc, and as a first cut of the pre-releases, this is probably fine
while we work out other kinks.
Signed-off-by: Austin Seipp <aseipp@pobox.com>
2019-05-03 08:16:37 +02:00
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
|
2021-12-04 02:20:26 +01:00
|
|
|
passthru.tests = {
|
|
|
|
bpf = nixosTests.bpf;
|
|
|
|
};
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2018-10-15 05:17:12 +02:00
|
|
|
description = "High-level tracing language for Linux eBPF";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/iovisor/bpftrace";
|
bpftrace: unstable-2018-10-27 -> 0.9
Update bpftrace to the latest pre-release, with a real version number.
The most notable change now is that bpftrace can use a stable version of
the 'bcc' toolchain in order to build, meaning no more hacks are needed
to clone the source code and fix up the build system, etc. This
simplifies things greatly and removes the old bcc-source patch.
Similarly, we can remove our custom gtests patch (which disabled the
build) by just passing -DBUILD_TESTING=FALSE when running cmake. This
was also added upstream recently.
However, something does still need to be fixed, at a cost: bpftrace
requires the kernel -dev package because it wants both objects and
include directories (some files are only shipped in one or the other).
Therefore, we remove the dependency on linuxHeaders and instead use
kernel.dev as the sole input to the build.
This is both a positive and a negative: the positive is that tools work
without annoying fatal errors, and that the bpf toolchain is
synchronized to the linuxPackages.kernel derivation it was built
against. The downside is that the .dev expression is much heavier as a
dependency, so bpftrace is now closer to 700mb in closure size. (This
especially hurts across kernel upgrades requiring a whole new rebuild,
especially if you have existing nixos generations that won't GC, etc.)
We probably want to slim this down substantially in the future (and
there may be a few ways to do that), but as this will probably also
touch bcc, and as a first cut of the pre-releases, this is probably fine
while we work out other kinks.
Signed-off-by: Austin Seipp <aseipp@pobox.com>
2019-05-03 08:16:37 +02:00
|
|
|
license = licenses.asl20;
|
2021-12-04 00:56:03 +01:00
|
|
|
maintainers = with maintainers; [ rvl thoughtpolice martinetd ];
|
2018-10-15 05:17:12 +02:00
|
|
|
};
|
|
|
|
}
|