about summary refs log tree commit diff
path: root/pkgs/shells
diff options
context:
space:
mode:
authorShane Sveller <shanesveller@gmail.com>2022-08-12 17:08:14 -0500
committerShane Sveller <shanesveller@gmail.com>2022-09-05 09:59:58 -0500
commitc0d73cf864d9b1616ff7f28ddd06cbae6f4da668 (patch)
treef2e3895f0dc358b4653412e7d896f2449613c8ef /pkgs/shells
parent0d117eb087ba91a866922736887b65fdf3a6d2f8 (diff)
nushell: Include Apple SDK for libproc.h / bindgen
https://github.com/nushell/nushell/commit/9b6b8172761cbeb9000dfef3c2db51fc22a56d8e
https://github.com/andrewdavidmackenzie/libproc-rs/releases/tag/v0.12.0
https://github.com/NixOS/nixpkgs/blob/fec8b61321a6597d0a9f93468970e6d2cdb896f9/pkgs/development/libraries/webkitgtk/default.nix#L161-L166
https://github.com/NixOS/nixpkgs/blob/fec8b61321a6597d0a9f93468970e6d2cdb896f9/pkgs/tools/system/btop/default.nix#L32-L37
Diffstat (limited to 'pkgs/shells')
-rw-r--r--pkgs/shells/nushell/default.nix20
1 files changed, 19 insertions, 1 deletions
diff --git a/pkgs/shells/nushell/default.nix b/pkgs/shells/nushell/default.nix
index 7ef45040d12d7..f6de5f0528306 100644
--- a/pkgs/shells/nushell/default.nix
+++ b/pkgs/shells/nushell/default.nix
@@ -1,6 +1,7 @@
 { stdenv
 , lib
 , fetchFromGitHub
+, runCommand
 , rustPlatform
 , openssl
 , zlib
@@ -10,7 +11,10 @@
 , xorg
 , libiconv
 , AppKit
+, Foundation
 , Security
+# darwin.apple_sdk.sdk
+, sdk
 , nghttp2
 , libgit2
 , withExtraFeatures ? true
@@ -40,7 +44,21 @@ rustPlatform.buildRustPackage rec {
 
   buildInputs = [ openssl zstd ]
     ++ lib.optionals stdenv.isDarwin [ zlib libiconv Security ]
-    ++ lib.optionals (withExtraFeatures && stdenv.isLinux) [ xorg.libX11 ]
+    ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
+    Foundation
+    (
+      # Pull a header that contains a definition of proc_pid_rusage().
+      # (We pick just that one because using the other headers from `sdk` is not
+      # compatible with our C++ standard library. This header is already in
+      # the standard library on aarch64)
+      # See also:
+      # https://github.com/shanesveller/nixpkgs/tree/90ed23b1b23c8ee67928937bdec7ddcd1a0050f5/pkgs/development/libraries/webkitgtk/default.nix
+      # https://github.com/shanesveller/nixpkgs/blob/90ed23b1b23c8ee67928937bdec7ddcd1a0050f5/pkgs/tools/system/btop/default.nix#L32-L38
+      runCommand "${pname}_headers" { } ''
+        install -Dm444 "${lib.getDev sdk}"/include/libproc.h "$out"/include/libproc.h
+      ''
+    )
+  ] ++ lib.optionals (withExtraFeatures && stdenv.isLinux) [ xorg.libX11 ]
     ++ lib.optionals (withExtraFeatures && stdenv.isDarwin) [ AppKit nghttp2 libgit2 ];
 
   buildFeatures = lib.optional withExtraFeatures "extra";