diff options
author | Steven Sherry <steven.sherry@affinityforapps.com> | 2021-12-24 01:04:49 -0600 |
---|---|---|
committer | Steven Sherry <steven.sherry@affinityforapps.com> | 2021-12-24 01:04:49 -0600 |
commit | 536ef350651b3967652d786ece0830ab3d5a5093 (patch) | |
tree | 3119bfe145bfe01f1166125086f1226870021ca1 | |
parent | eac07edbd20ed4908b98790ba299250b5527ecdf (diff) |
btop: Add darwin support
-rw-r--r-- | pkgs/tools/system/btop/default.nix | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/pkgs/tools/system/btop/default.nix b/pkgs/tools/system/btop/default.nix index 9c926381dc479..f51b0362ac9c1 100644 --- a/pkgs/tools/system/btop/default.nix +++ b/pkgs/tools/system/btop/default.nix @@ -1,6 +1,9 @@ { lib , stdenv , fetchFromGitHub +, runCommand +, darwin +, gcc11 }: stdenv.mkDerivation rec { @@ -14,6 +17,28 @@ stdenv.mkDerivation rec { sha256 = "sha256-uKR1ogQwEoyxyWBiLnW8BsOsYgTpeIpKrKspq0JwYjY="; }; + nativeBuildInputs = lib.optionals stdenv.isDarwin [ gcc11 ]; + + hardeningDisable = lib.optionals (stdenv.isAarch64 && stdenv.isDarwin) [ "stackprotector" ]; + + ADDFLAGS = with darwin.apple_sdk; + lib.optional stdenv.isDarwin + "-F${frameworks.IOKit}/Library/Frameworks/"; + + buildInputs = with darwin.apple_sdk; + lib.optionals stdenv.isDarwin [ + frameworks.CoreFoundation + frameworks.IOKit + ] ++ lib.optional (stdenv.isDarwin && !stdenv.isAarch64) ( + # Found this explanation for needing to create a header directory for libproc.h alone. + # https://github.com/NixOS/nixpkgs/blob/049e5e93af9bbbe06b4c40fd001a4e138ce1d677/pkgs/development/libraries/webkitgtk/default.nix#L154 + # TL;DR, the other headers in the include path for the macOS SDK is not compatible with the C++ stdlib and causes issues, so we copy + # this to avoid those issues + runCommand "${pname}_headers" { } '' + install -Dm444 "${lib.getDev sdk}"/include/libproc.h "$out"/include/libproc.h + '' + ); + installFlags = [ "PREFIX=$(out)" ]; meta = with lib; { @@ -21,7 +46,7 @@ stdenv.mkDerivation rec { homepage = "https://github.com/aristocratos/btop"; changelog = "https://github.com/aristocratos/btop/blob/v${version}/CHANGELOG.md"; license = licenses.asl20; - platforms = platforms.linux; + platforms = platforms.linux ++ platforms.darwin; maintainers = with maintainers; [ rmcgibbo ]; }; } |