nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 config,
4 stdenv,
5 fetchFromGitHub,
6 cmake,
7 removeReferencesTo,
8 autoAddDriverRunpath,
9 apple-sdk_15,
10 versionCheckHook,
11 nix-update-script,
12 rocmPackages,
13 cudaSupport ? config.cudaSupport,
14 rocmSupport ? config.rocmSupport,
15}:
16
17stdenv.mkDerivation (finalAttrs: {
18 pname = "btop";
19 version = "1.4.6";
20
21 src = fetchFromGitHub {
22 owner = "aristocratos";
23 repo = "btop";
24 tag = "v${finalAttrs.version}";
25 hash = "sha256-h472rcXzpBkPYAEy9JaVlanaavaz0WcdkhmwsVdDRdo=";
26 };
27
28 nativeBuildInputs = [
29 cmake
30 ]
31 ++ lib.optionals cudaSupport [
32 autoAddDriverRunpath
33 ];
34
35 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
36 apple-sdk_15
37 ];
38
39 installFlags = [ "PREFIX=$(out)" ];
40
41 # fix build on darwin (see https://github.com/NixOS/nixpkgs/pull/422218#issuecomment-3039181870 and https://github.com/aristocratos/btop/pull/1173)
42 cmakeFlags = [
43 (lib.cmakeBool "BTOP_LTO" (!stdenv.hostPlatform.isDarwin))
44 ];
45
46 postInstall = ''
47 ${removeReferencesTo}/bin/remove-references-to -t ${stdenv.cc.cc} $(readlink -f $out/bin/btop)
48 '';
49
50 postPhases = lib.optionals rocmSupport [ "postPatchelf" ];
51 postPatchelf = lib.optionalString rocmSupport ''
52 patchelf --add-rpath ${lib.getLib rocmPackages.rocm-smi}/lib $out/bin/btop
53 '';
54
55 nativeInstallCheckInputs = [ versionCheckHook ];
56 doInstallCheck = true;
57
58 passthru.updateScript = nix-update-script { };
59
60 meta = {
61 description = "Monitor of resources";
62 homepage = "https://github.com/aristocratos/btop";
63 changelog = "https://github.com/aristocratos/btop/blob/v${finalAttrs.version}/CHANGELOG.md";
64 license = lib.licenses.asl20;
65 platforms = lib.platforms.linux ++ lib.platforms.darwin;
66 maintainers = with lib.maintainers; [
67 khaneliman
68 rmcgibbo
69 ryan4yin
70 sigmasquadron
71 ];
72 mainProgram = "btop";
73 };
74})