1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 libunwind,
6 python3,
7 rustPlatform,
8}:
9
10rustPlatform.buildRustPackage rec {
11 pname = "py-spy";
12 version = "0.4.0";
13
14 src = fetchFromGitHub {
15 owner = "benfred";
16 repo = "py-spy";
17 rev = "v${version}";
18 hash = "sha256-T96F8xgB9HRwuvDLXi6+lfi8za/iNn1NAbG4AIpE0V0=";
19 };
20
21 cargoHash = "sha256-velwX7lcNQvwg3VAUTbgsOPLlA5fAcPiPvczrBBsMvs=";
22
23 buildFeatures = [ "unwind" ];
24
25 nativeBuildInputs = [
26 rustPlatform.bindgenHook
27 ];
28
29 nativeCheckInputs = [
30 python3
31 ];
32
33 env.NIX_CFLAGS_COMPILE = "-L${libunwind}/lib";
34
35 checkFlags = [
36 # assertion `left == right` failed
37 "--skip=test_negative_linenumber_increment"
38 ];
39
40 meta = {
41 description = "Sampling profiler for Python programs";
42 mainProgram = "py-spy";
43 homepage = "https://github.com/benfred/py-spy";
44 changelog = "https://github.com/benfred/py-spy/releases/tag/v${version}";
45 license = lib.licenses.mit;
46 maintainers = with lib.maintainers; [ lnl7 ];
47 platforms = lib.platforms.linux;
48 # https://github.com/benfred/py-spy/pull/330
49 broken = stdenv.hostPlatform.isAarch64;
50 };
51}