1{ lib, stdenv, fetchFromGitHub, rustPlatform, makeWrapper, perf, nix-update-script
2, Security
3}:
4
5rustPlatform.buildRustPackage rec {
6 pname = "cargo-flamegraph";
7 version = "0.6.4";
8
9 src = fetchFromGitHub {
10 owner = "flamegraph-rs";
11 repo = "flamegraph";
12 rev = "v${version}";
13 sha256 = "sha256-yeNA6HkhWEUqarBDRbyD3RBIlBZZVrbAMng7d5beBB4=";
14 };
15
16 cargoSha256 = "sha256-IHOVaRfjopaSRY8HF8ATdNNLfhTVrIKvYsAuocqRdWI=";
17
18 nativeBuildInputs = lib.optionals stdenv.isLinux [ makeWrapper ];
19 buildInputs = lib.optionals stdenv.isDarwin [
20 Security
21 ];
22
23 postFixup = lib.optionalString stdenv.isLinux ''
24 wrapProgram $out/bin/cargo-flamegraph \
25 --set-default PERF ${perf}/bin/perf
26 wrapProgram $out/bin/flamegraph \
27 --set-default PERF ${perf}/bin/perf
28 '';
29
30 passthru.updateScript = nix-update-script { };
31
32 meta = with lib; {
33 description = "Easy flamegraphs for Rust projects and everything else, without Perl or pipes <3";
34 homepage = "https://github.com/flamegraph-rs/flamegraph";
35 license = with licenses; [ asl20 /* or */ mit ];
36 maintainers = with maintainers; [ killercup matthiasbeyer ];
37 };
38}