Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, stdenv 3, rustPlatform 4, fetchFromGitHub 5, ruby 6, which 7, nix-update-script 8}: 9 10rustPlatform.buildRustPackage rec { 11 pname = "rbspy"; 12 version = "0.17.0"; 13 14 src = fetchFromGitHub { 15 owner = pname; 16 repo = pname; 17 rev = "v${version}"; 18 hash = "sha256-NshDX7sbXnmK6k/EDD5thUcNKvSV4bNdJ5N2hNLlsnA="; 19 }; 20 21 cargoHash = "sha256-JzspNL4T28awa/1Uajw0gLM3bYyUBYTjnfCXn9qG7SY="; 22 23 # error: linker `aarch64-linux-gnu-gcc` not found 24 postPatch = '' 25 rm .cargo/config 26 ''; 27 28 doCheck = true; 29 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 ''; 38 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 ]; 46 47 nativeBuildInputs = [ ruby which ] 48 ++ lib.optional stdenv.isDarwin rustPlatform.bindgenHook; 49 50 passthru.updateScript = nix-update-script { }; 51 52 meta = with lib; { 53 homepage = "https://rbspy.github.io/"; 54 description = '' 55 A Sampling CPU Profiler for Ruby. 56 ''; 57 license = licenses.mit; 58 maintainers = with maintainers; [ viraptor ]; 59 platforms = platforms.linux ++ platforms.darwin; 60 }; 61}