From 057b94a3d22b208ec3b2628d6a091b79d4d6f6e8 Mon Sep 17 00:00:00 2001 From: oxalica Date: Tue, 24 Dec 2019 05:17:33 +0800 Subject: [PATCH] cargo-flamegraph: fix runtime dep: linux-perf --- pkgs/development/tools/cargo-flamegraph/default.nix | 12 +++++++++--- pkgs/top-level/all-packages.nix | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pkgs/development/tools/cargo-flamegraph/default.nix b/pkgs/development/tools/cargo-flamegraph/default.nix index 442035d0f5f8..e4dd9bb69591 100644 --- a/pkgs/development/tools/cargo-flamegraph/default.nix +++ b/pkgs/development/tools/cargo-flamegraph/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, rustPlatform +{ lib, stdenv, fetchFromGitHub, rustPlatform, makeWrapper, perf , Security }: @@ -15,11 +15,17 @@ rustPlatform.buildRustPackage rec { cargoSha256 = "0kmw2n4j5bisac0bv3npbwfz2z00ncd6w8ichwaz5hac5mi1a72f"; - buildInputs = stdenv.lib.optionals stdenv.isDarwin [ + nativeBuildInputs = lib.optionals stdenv.isLinux [ makeWrapper ]; + buildInputs = lib.optionals stdenv.isDarwin [ Security ]; - meta = with stdenv.lib; { + postFixup = lib.optionalString stdenv.isLinux '' + wrapProgram $out/bin/cargo-flamegraph \ + --suffix PATH ':' ${perf}/bin + ''; + + 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 ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a460c520cf9d..1d77b041e99c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8680,6 +8680,7 @@ in cargo-flamegraph = callPackage ../development/tools/cargo-flamegraph { inherit (darwin.apple_sdk.frameworks) Security; + inherit (linuxPackages) perf; }; carnix = (callPackage ../build-support/rust/carnix.nix { }).carnix { };