2021-09-22 22:24:12 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2021-10-19 21:09:17 +01:00
|
|
|
, fetchFromGitHub
|
2021-12-24 07:04:49 +00:00
|
|
|
, runCommand
|
|
|
|
, darwin
|
2021-12-31 17:09:07 +00:00
|
|
|
, removeReferencesTo
|
2021-09-22 22:24:12 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "btop";
|
2022-03-06 02:15:18 +00:00
|
|
|
version = "1.2.5";
|
|
|
|
hash = "sha256-W7DTaJVA9xqdgBjrrR+OK1buBMrjpw2T0I//ZZKQFOw=";
|
2021-09-22 22:24:12 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "aristocratos";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2022-01-17 15:26:26 +00:00
|
|
|
sha256 = hash;
|
2021-09-22 22:24:12 +01:00
|
|
|
};
|
|
|
|
|
2021-12-24 07:04:49 +00:00
|
|
|
hardeningDisable = lib.optionals (stdenv.isAarch64 && stdenv.isDarwin) [ "stackprotector" ];
|
|
|
|
|
2021-12-29 23:13:02 +00:00
|
|
|
ADDFLAGS = with darwin.apple_sdk.frameworks;
|
2021-12-24 07:04:49 +00:00
|
|
|
lib.optional stdenv.isDarwin
|
2021-12-29 23:13:02 +00:00
|
|
|
"-F${IOKit}/Library/Frameworks/";
|
2021-12-24 07:04:49 +00:00
|
|
|
|
|
|
|
buildInputs = with darwin.apple_sdk;
|
|
|
|
lib.optionals stdenv.isDarwin [
|
|
|
|
frameworks.CoreFoundation
|
|
|
|
frameworks.IOKit
|
2021-12-24 14:24:15 +00:00
|
|
|
] ++ lib.optional (stdenv.isDarwin && stdenv.isx86_64) (
|
2021-12-24 07:04:49 +00:00
|
|
|
# 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
|
|
|
|
''
|
|
|
|
);
|
|
|
|
|
2021-09-22 22:24:12 +01:00
|
|
|
installFlags = [ "PREFIX=$(out)" ];
|
|
|
|
|
2021-12-31 17:09:07 +00:00
|
|
|
postInstall = ''
|
|
|
|
${removeReferencesTo}/bin/remove-references-to -t ${stdenv.cc.cc} $(readlink -f $out/bin/btop)
|
|
|
|
'';
|
|
|
|
|
2021-09-22 22:24:12 +01:00
|
|
|
meta = with lib; {
|
|
|
|
description = "A monitor of resources";
|
|
|
|
homepage = "https://github.com/aristocratos/btop";
|
2021-10-19 21:09:17 +01:00
|
|
|
changelog = "https://github.com/aristocratos/btop/blob/v${version}/CHANGELOG.md";
|
2021-09-22 22:24:12 +01:00
|
|
|
license = licenses.asl20;
|
2021-12-24 07:04:49 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2021-09-22 22:24:12 +01:00
|
|
|
maintainers = with maintainers; [ rmcgibbo ];
|
|
|
|
};
|
|
|
|
}
|