nixpkgs/pkgs/development/tools/rbspy/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

64 lines
1.7 KiB
Nix
Raw Normal View History

2022-07-23 10:17:46 +00:00
{ lib
, stdenv
, rustPlatform
, fetchFromGitHub
, ruby
, which
2023-02-24 04:20:00 +00:00
, runCommand
, darwin
2022-07-23 10:17:46 +00:00
}:
rustPlatform.buildRustPackage rec {
pname = "rbspy";
version = "0.16.0";
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = "v${version}";
hash = "sha256-yM3bE79flvFSZvpkHXhhEh1MJrSSJzqZcX9aVRmz1ew=";
};
cargoHash = "sha256-qvx5zPEIwvh2AIFCGNbVMNIRFtVjSLR9+exbSeQ9oXI=";
doCheck = true;
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 \
--replace /usr/bin/which '${which}/bin/which'
2022-05-09 10:39:18 +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"
];
2022-05-09 10:39:18 +00:00
nativeBuildInputs = [ ruby which ];
2023-02-24 04:20:00 +00:00
buildInputs = lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
# Pull a header that contains a definition of proc_pid_rusage().
(runCommand "${pname}_headers" { } ''
install -Dm444 ${lib.getDev darwin.apple_sdk.sdk}/include/libproc.h $out/include/libproc.h
'')
];
LIBCLANG_PATH = lib.optionalString stdenv.isDarwin "${stdenv.cc.cc.lib}/lib";
meta = with lib; {
broken = (stdenv.isLinux && stdenv.isAarch64);
homepage = "https://rbspy.github.io/";
description = ''
A Sampling CPU Profiler for Ruby.
'';
license = licenses.mit;
maintainers = with maintainers; [ viraptor ];
platforms = platforms.linux ++ platforms.darwin;
};
}