2022-08-12 12:06:08 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
|
|
|
, ruby
|
|
|
|
, which
|
2023-07-15 17:15:38 +00:00
|
|
|
, nix-update-script
|
2022-08-12 12:06:08 +00:00
|
|
|
}:
|
2023-03-04 12:14:45 +00:00
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "rbspy";
|
2023-04-12 12:48:02 +00:00
|
|
|
version = "0.17.0";
|
2022-04-15 01:41:22 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2023-04-12 12:48:02 +00:00
|
|
|
hash = "sha256-NshDX7sbXnmK6k/EDD5thUcNKvSV4bNdJ5N2hNLlsnA=";
|
2022-04-15 01:41:22 +00:00
|
|
|
};
|
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
cargoHash = "sha256-JzspNL4T28awa/1Uajw0gLM3bYyUBYTjnfCXn9qG7SY=";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
# error: linker `aarch64-linux-gnu-gcc` not found
|
|
|
|
postPatch = ''
|
|
|
|
rm .cargo/config
|
|
|
|
'';
|
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
# The current implementation of rbspy fails to detect the version of ruby
|
|
|
|
# from nixpkgs during tests.
|
2022-06-16 17:23:12 +00:00
|
|
|
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'
|
|
|
|
'';
|
|
|
|
|
2023-03-04 12:14:45 +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"
|
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
nativeBuildInputs = [ ruby which ]
|
|
|
|
++ lib.optional stdenv.isDarwin rustPlatform.bindgenHook;
|
2023-03-04 12:14:45 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
passthru.updateScript = nix-update-script { };
|
2023-03-04 12:14:45 +00:00
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://rbspy.github.io/";
|
|
|
|
description = ''
|
|
|
|
A Sampling CPU Profiler for Ruby.
|
|
|
|
'';
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ viraptor ];
|
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
|
|
};
|
|
|
|
}
|