2021-02-05 17:12:51 +00:00
|
|
|
{ lib, fetchgit, pkg-config, gettext, runCommand, makeWrapper
|
2022-01-19 23:45:15 +00:00
|
|
|
, cpio, elfutils, kernel, gnumake, python3
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
## fetchgit info
|
|
|
|
url = "git://sourceware.org/git/systemtap.git";
|
|
|
|
rev = "release-${version}";
|
2023-03-15 16:39:30 +00:00
|
|
|
sha256 = "sha256-UiUMoqdfkk6mzaPGctpQW3dvOWKhNBNuScJ5BpCykVg=";
|
|
|
|
version = "4.8";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
inherit (kernel) stdenv;
|
|
|
|
|
|
|
|
## stap binaries
|
|
|
|
stapBuild = stdenv.mkDerivation {
|
|
|
|
pname = "systemtap";
|
|
|
|
inherit version;
|
|
|
|
src = fetchgit { inherit url rev sha256; };
|
2022-03-30 09:31:56 +00:00
|
|
|
nativeBuildInputs = [ pkg-config cpio python3 python3.pkgs.setuptools ];
|
|
|
|
buildInputs = [ elfutils gettext ];
|
2020-04-24 23:36:52 +00:00
|
|
|
enableParallelBuilding = true;
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString [ "-Wno-error=deprecated-declarations" ]; # Needed with GCC 12
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
pypkgs = with python3.pkgs; makePythonPath [ pyparsing ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
in runCommand "systemtap-${kernel.version}-${version}" {
|
2023-03-24 00:07:29 +00:00
|
|
|
inherit stapBuild;
|
2021-03-09 03:18:52 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
|
|
|
homepage = "https://sourceware.org/systemtap/";
|
|
|
|
description = "Provides a scripting language for instrumentation on a live kernel plus user-space";
|
|
|
|
license = lib.licenses.gpl2;
|
2023-02-02 18:25:31 +00:00
|
|
|
platforms = lib.systems.inspect.patterns.isGnu;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
} ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
for bin in $stapBuild/bin/*; do
|
|
|
|
ln -s $bin $out/bin
|
|
|
|
done
|
|
|
|
rm $out/bin/stap $out/bin/dtrace
|
|
|
|
makeWrapper $stapBuild/bin/stap $out/bin/stap \
|
2023-03-24 00:07:29 +00:00
|
|
|
--add-flags "-r ${kernel.dev}" \
|
2020-04-24 23:36:52 +00:00
|
|
|
--prefix PATH : ${lib.makeBinPath [ stdenv.cc.cc stdenv.cc.bintools elfutils gnumake ]}
|
|
|
|
makeWrapper $stapBuild/bin/dtrace $out/bin/dtrace \
|
|
|
|
--prefix PYTHONPATH : ${pypkgs}
|
|
|
|
''
|