From 09d46de75258066915de1c377b0d5b6f6e773494 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Fri, 3 Feb 2023 00:53:05 +0100 Subject: [PATCH] py-spy: fix build on darwin --- pkgs/development/tools/py-spy/default.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/development/tools/py-spy/default.nix b/pkgs/development/tools/py-spy/default.nix index e9bcb2efae95..cc6212a5242e 100644 --- a/pkgs/development/tools/py-spy/default.nix +++ b/pkgs/development/tools/py-spy/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, pkgsBuildBuild, rustPlatform, fetchFromGitHub, pkg-config, libunwind, python3 }: +{ lib, stdenv, pkgsBuildBuild, rustPlatform, fetchFromGitHub, pkg-config, libunwind, python3, runCommand, darwin }: rustPlatform.buildRustPackage rec { pname = "py-spy"; @@ -11,6 +11,15 @@ rustPlatform.buildRustPackage rec { sha256 = "sha256-NciyzKiDKIMeuHhTjzmHIc3dYW4AniuCNjZugm4hMss="; }; + nativeBuildInputs = [ rustPlatform.bindgenHook ]; + + buildInputs = lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ + # Pull a header that contains a definition of proc_pid_rusage(). + (runCommand "${pname}_headers" { } '' + install -Dm444 ${lib.getDev darwin.apple_sdk.sdk}/include/libproc.h $out/include/libproc.h + '') + ]; + NIX_CFLAGS_COMPILE = "-L${libunwind}/lib"; # error: linker `arm-linux-gnueabihf-gcc` not found