2022-07-23 10:17:46 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
rustPlatform,
|
|
|
|
fetchFromGitHub,
|
|
|
|
ruby,
|
|
|
|
which,
|
2022-07-05 04:50:42 +00:00
|
|
|
nix-update-script,
|
2022-07-23 10:17:46 +00:00
|
|
|
}:
|
2023-02-24 04:20:00 +00:00
|
|
|
|
2022-02-21 09:56:18 +00:00
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "rbspy";
|
2024-11-26 21:15:56 +00:00
|
|
|
version = "0.27.0";
|
2022-02-21 09:56:18 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2024-01-11 19:59:21 +00:00
|
|
|
owner = "rbspy";
|
|
|
|
repo = "rbspy";
|
|
|
|
rev = "refs/tags/v${version}";
|
2024-11-26 21:15:56 +00:00
|
|
|
hash = "sha256-K5zDM7HhSNklCMoj3yh5lf0HTITOl2UYXW0QCxDF2GU=";
|
2022-02-21 09:56:18 +00:00
|
|
|
};
|
|
|
|
|
2024-11-26 21:15:56 +00:00
|
|
|
cargoHash = "sha256-2yYv7Pp6UqHTPrmG4BM0py3GoPYYJW7e9LQSrgxx/3A=";
|
2023-05-27 11:46:31 +00:00
|
|
|
|
|
|
|
# error: linker `aarch64-linux-gnu-gcc` not found
|
|
|
|
postPatch = ''
|
|
|
|
rm .cargo/config
|
|
|
|
'';
|
|
|
|
|
2022-03-02 04:50:25 +00:00
|
|
|
doCheck = true;
|
2022-02-21 09:56:18 +00:00
|
|
|
|
2022-12-30 11:52:31 +00:00
|
|
|
# The current implementation of rbspy fails to detect the version of ruby
|
|
|
|
# from nixpkgs during tests.
|
2022-05-09 10:39:18 +00:00
|
|
|
preCheck = ''
|
|
|
|
substituteInPlace src/core/process.rs \
|
|
|
|
--replace /usr/bin/which '${which}/bin/which'
|
|
|
|
substituteInPlace src/sampler/mod.rs \
|
2023-02-24 04:20:00 +00:00
|
|
|
--replace /usr/bin/which '${which}/bin/which'
|
2022-05-09 10:39:18 +00:00
|
|
|
'';
|
|
|
|
|
2023-02-24 04:20:00 +00:00
|
|
|
checkFlags = [
|
|
|
|
"--skip=test_get_trace"
|
|
|
|
"--skip=test_get_trace_when_process_has_exited"
|
|
|
|
"--skip=test_sample_single_process"
|
|
|
|
"--skip=test_sample_single_process_with_time_limit"
|
|
|
|
"--skip=test_sample_subprocesses"
|
|
|
|
];
|
|
|
|
|
2024-01-11 19:59:21 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
ruby
|
|
|
|
which
|
|
|
|
] ++ lib.optional stdenv.hostPlatform.isDarwin rustPlatform.bindgenHook;
|
2023-02-24 04:20:00 +00:00
|
|
|
|
2022-07-05 04:50:42 +00:00
|
|
|
passthru.updateScript = nix-update-script { };
|
|
|
|
|
2022-02-21 09:56:18 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://rbspy.github.io/";
|
2024-01-11 19:59:21 +00:00
|
|
|
description = "Sampling CPU Profiler for Ruby";
|
2024-03-19 02:14:51 +00:00
|
|
|
mainProgram = "rbspy";
|
2024-01-11 19:59:21 +00:00
|
|
|
changelog = "https://github.com/rbspy/rbspy/releases/tag/v${version}";
|
2022-02-21 09:56:18 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ viraptor ];
|
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
|
|
};
|
|
|
|
}
|