base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12 (#356361)
[NixPkgs.git] / pkgs / tools / system / btop / default.nix
blob2a50e5933d3ac6ce8224060ce8cd8b71722d0c1f
2   lib,
3   config,
4   stdenv,
5   fetchFromGitHub,
6   cmake,
7   removeReferencesTo,
8   autoAddDriverRunpath,
9   apple-sdk_15,
10   darwinMinVersionHook,
11   versionCheckHook,
12   rocmPackages,
13   cudaSupport ? config.cudaSupport,
14   rocmSupport ? config.rocmSupport,
17 stdenv.mkDerivation rec {
18   pname = "btop";
19   version = "1.4.0";
21   src = fetchFromGitHub {
22     owner = "aristocratos";
23     repo = pname;
24     rev = "v${version}";
25     hash = "sha256-A5hOBxj8tKlkHd8zDHfDoU6fIu8gDpt3/usbiDk0/G0=";
26   };
28   nativeBuildInputs =
29     [
30       cmake
31     ]
32     ++ lib.optionals cudaSupport [
33       autoAddDriverRunpath
34     ];
36   buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
37     apple-sdk_15
38     (darwinMinVersionHook "10.15")
39   ];
41   installFlags = [ "PREFIX=$(out)" ];
43   postInstall = ''
44     ${removeReferencesTo}/bin/remove-references-to -t ${stdenv.cc.cc} $(readlink -f $out/bin/btop)
45   '';
47   postPhases = lib.optionals rocmSupport [ "postPatchelf" ];
48   postPatchelf = lib.optionalString rocmSupport ''
49     patchelf --add-rpath ${lib.getLib rocmPackages.rocm-smi}/lib $out/bin/btop
50   '';
52   nativeInstallCheckInputs = [ versionCheckHook ];
53   versionCheckProgramArg = "--version";
54   doInstallCheck = true;
56   meta = with lib; {
57     description = "Monitor of resources";
58     homepage = "https://github.com/aristocratos/btop";
59     changelog = "https://github.com/aristocratos/btop/blob/v${version}/CHANGELOG.md";
60     license = licenses.asl20;
61     platforms = platforms.linux ++ platforms.darwin;
62     maintainers = with maintainers; [
63       khaneliman
64       rmcgibbo
65     ];
66     mainProgram = "btop";
67   };