nixos/networking-interfaces-scripted: use read -r
[NixPkgs.git] / pkgs / development / tools / rbspy / default.nix
blob837468803842fc0f1506c20d10824e28e71b568a
1 { lib
2 , stdenv
3 , rustPlatform
4 , fetchFromGitHub
5 , ruby
6 , which
7 , nix-update-script
8 }:
10 rustPlatform.buildRustPackage rec {
11   pname = "rbspy";
12   version = "0.27.0";
14   src = fetchFromGitHub {
15     owner = "rbspy";
16     repo = "rbspy";
17     rev = "refs/tags/v${version}";
18     hash = "sha256-K5zDM7HhSNklCMoj3yh5lf0HTITOl2UYXW0QCxDF2GU=";
19   };
21   cargoHash = "sha256-2yYv7Pp6UqHTPrmG4BM0py3GoPYYJW7e9LQSrgxx/3A=";
23   # error: linker `aarch64-linux-gnu-gcc` not found
24   postPatch = ''
25     rm .cargo/config
26   '';
28   doCheck = true;
30   # The current implementation of rbspy fails to detect the version of ruby
31   # from nixpkgs during tests.
32   preCheck = ''
33     substituteInPlace src/core/process.rs \
34       --replace /usr/bin/which '${which}/bin/which'
35     substituteInPlace src/sampler/mod.rs \
36       --replace /usr/bin/which '${which}/bin/which'
37   '';
39   checkFlags = [
40     "--skip=test_get_trace"
41     "--skip=test_get_trace_when_process_has_exited"
42     "--skip=test_sample_single_process"
43     "--skip=test_sample_single_process_with_time_limit"
44     "--skip=test_sample_subprocesses"
45   ];
47   nativeBuildInputs = [
48     ruby
49     which
50   ] ++ lib.optional stdenv.hostPlatform.isDarwin rustPlatform.bindgenHook;
52   passthru.updateScript = nix-update-script { };
54   meta = with lib; {
55     homepage = "https://rbspy.github.io/";
56     description = "Sampling CPU Profiler for Ruby";
57     mainProgram = "rbspy";
58     changelog = "https://github.com/rbspy/rbspy/releases/tag/v${version}";
59     license = licenses.mit;
60     maintainers = with maintainers; [ viraptor ];
61     platforms = platforms.linux ++ platforms.darwin;
62   };