2022-08-12 12:06:08 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, ruby
|
|
|
|
, which
|
|
|
|
}:
|
2022-04-15 01:41:22 +00:00
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "rbspy";
|
2022-06-16 17:23:12 +00:00
|
|
|
version = "0.12.1";
|
2022-04-15 01:41:22 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2022-06-16 17:23:12 +00:00
|
|
|
sha256 = "FnUUX7qQWVZMHtWvneTLzBL1YYwF8v4e1913Op4Lvbw=";
|
2022-04-15 01:41:22 +00:00
|
|
|
};
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
cargoSha256 = "98vmUoWSehX/9rMlHNSvKHJvJxW99pOhS08FI3OeLGo=";
|
2022-04-15 01:41:22 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
patches = [
|
|
|
|
# Backport rust 1.62 support. Should be removed in the next rbspy release.
|
|
|
|
(fetchpatch {
|
|
|
|
name = "rust-1.62.patch";
|
|
|
|
url = "https://github.com/rbspy/rbspy/commit/f5a8eecfbf2ad0b3ff9105115988478fb760d54d.patch";
|
|
|
|
sha256 = "sha256-+04rvEXU7/lx5IQkk3Bhe+KLN8PwxZ0j4nH5ySnS154=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
# Tests in initialize.rs rely on specific PIDs being queried and attaching
|
|
|
|
# tracing to forked processes, which don't work well with the isolated build.
|
|
|
|
preCheck = ''
|
|
|
|
substituteInPlace src/core/process.rs \
|
|
|
|
--replace /usr/bin/which '${which}/bin/which'
|
|
|
|
substituteInPlace src/sampler/mod.rs \
|
|
|
|
--replace /usr/bin/which '${which}/bin/which'
|
|
|
|
substituteInPlace src/core/initialize.rs \
|
|
|
|
--replace 'fn test_initialize_with_disallowed_process(' '#[ignore] fn test_initialize_with_disallowed_process(' \
|
|
|
|
--replace 'fn test_get_exec_trace(' '#[ignore] fn test_get_exec_trace(' \
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ ruby which ];
|
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
meta = with lib; {
|
2022-06-16 17:23:12 +00:00
|
|
|
broken = (stdenv.isLinux && stdenv.isAarch64);
|
2022-04-15 01:41:22 +00:00
|
|
|
homepage = "https://rbspy.github.io/";
|
|
|
|
description = ''
|
|
|
|
A Sampling CPU Profiler for Ruby.
|
|
|
|
'';
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ viraptor ];
|
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
|
|
};
|
|
|
|
}
|