nixpkgs/pkgs/tools/system/btop/default.nix

53 lines
1.7 KiB
Nix
Raw Normal View History

2021-09-22 23:24:12 +02:00
{ lib
, stdenv
2021-10-19 22:09:17 +02:00
, fetchFromGitHub
2021-12-24 08:04:49 +01:00
, runCommand
, darwin
, gcc11
2021-09-22 23:24:12 +02:00
}:
stdenv.mkDerivation rec {
pname = "btop";
2021-12-21 20:48:08 +01:00
version = "1.1.3";
2021-09-22 23:24:12 +02:00
src = fetchFromGitHub {
owner = "aristocratos";
repo = pname;
rev = "v${version}";
2021-12-21 20:48:08 +01:00
sha256 = "sha256-uKR1ogQwEoyxyWBiLnW8BsOsYgTpeIpKrKspq0JwYjY=";
2021-09-22 23:24:12 +02:00
};
2021-12-24 08:04:49 +01:00
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.isx86_64) (
2021-12-24 08:04:49 +01: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 23:24:12 +02:00
installFlags = [ "PREFIX=$(out)" ];
meta = with lib; {
description = "A monitor of resources";
homepage = "https://github.com/aristocratos/btop";
2021-10-19 22:09:17 +02:00
changelog = "https://github.com/aristocratos/btop/blob/v${version}/CHANGELOG.md";
2021-09-22 23:24:12 +02:00
license = licenses.asl20;
2021-12-24 08:04:49 +01:00
platforms = platforms.linux ++ platforms.darwin;
2021-09-22 23:24:12 +02:00
maintainers = with maintainers; [ rmcgibbo ];
};
}