2021-01-05 17:05:55 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, rustPlatform, makeWrapper, perf, nix-update-script
|
2020-04-24 23:36:52 +00:00
|
|
|
, Security
|
|
|
|
}:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "cargo-flamegraph";
|
2021-01-05 17:05:55 +00:00
|
|
|
version = "0.4.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "flamegraph-rs";
|
|
|
|
repo = "flamegraph";
|
|
|
|
rev = "v${version}";
|
2021-01-05 17:05:55 +00:00
|
|
|
sha256 = "sha256-IpmvFUWNaFQ1ls7u625vvj1TnRYXR+X1mAGdBcwRFLk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-01-05 17:05:55 +00:00
|
|
|
cargoSha256 = "sha256-2YHkEQZqjKEvg4h9kIVhqmgq+SMF1c3r8UbSQivZh7w=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = lib.optionals stdenv.isLinux [ makeWrapper ];
|
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [
|
|
|
|
Security
|
|
|
|
];
|
|
|
|
|
|
|
|
postFixup = lib.optionalString stdenv.isLinux ''
|
|
|
|
wrapProgram $out/bin/cargo-flamegraph \
|
2021-01-05 17:05:55 +00:00
|
|
|
--set-default PERF ${perf}/bin/perf
|
2020-04-24 23:36:52 +00:00
|
|
|
wrapProgram $out/bin/flamegraph \
|
2021-01-05 17:05:55 +00:00
|
|
|
--set-default PERF ${perf}/bin/perf
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-05 17:05:55 +00:00
|
|
|
passthru.updateScript = nix-update-script {
|
|
|
|
attrPath = pname;
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Easy flamegraphs for Rust projects and everything else, without Perl or pipes <3";
|
|
|
|
homepage = "https://github.com/ferrous-systems/flamegraph";
|
|
|
|
license = with licenses; [ asl20 /* or */ mit ];
|
|
|
|
maintainers = with maintainers; [ killercup ];
|
|
|
|
};
|
|
|
|
}
|