summary refs log tree commit diff
path: root/pkgs/development/tools/py-spy
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/py-spy')
-rw-r--r--pkgs/development/tools/py-spy/default.nix30
1 files changed, 30 insertions, 0 deletions
diff --git a/pkgs/development/tools/py-spy/default.nix b/pkgs/development/tools/py-spy/default.nix
new file mode 100644
index 00000000000..94c706c0210
--- /dev/null
+++ b/pkgs/development/tools/py-spy/default.nix
@@ -0,0 +1,30 @@
+{ lib, stdenv, pkgsBuildBuild, rustPlatform, fetchFromGitHub, pkg-config, libunwind, python3 }:
+
+rustPlatform.buildRustPackage rec {
+  pname = "py-spy";
+  version = "0.3.5";
+
+  src = fetchFromGitHub {
+    owner = "benfred";
+    repo = "py-spy";
+    rev = "v${version}";
+    sha256 = "sha256-O6DbY/0ZI+BeG22jd9snbE718Y2vv7fqmeDdGWTnqfY=";
+  };
+
+  NIX_CFLAGS_COMPILE = "-L${libunwind}/lib";
+
+  # error: linker `arm-linux-gnueabihf-gcc` not found
+  preConfigure = lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
+    export RUSTFLAGS="-Clinker=$CC"
+  '';
+
+  checkInputs = [ python3 ];
+
+  cargoSha256 = "sha256-hmqrVGNu3zb109TQfhLI3wvGVnlc4CfbkrIKMfRSn7M=";
+
+  meta = with lib; {
+    description = "Sampling profiler for Python programs";
+    license = licenses.mit;
+    maintainers = [ maintainers.lnl7 ];
+  };
+}