1{ lib
2, stdenvNoCC
3, fetchzip
4, rpmextract
5}:
6
7stdenvNoCC.mkDerivation rec {
8 pname = "storcli";
9 version = "7.2309.00";
10
11 src = fetchzip {
12 url = "https://docs.broadcom.com/docs-and-downloads/raid-controllers/raid-controllers-common-files/Unified_storcli_all_os_${version}00.0000.zip";
13 sha256 = "sha256-n2MzT2LHLHWMWhshWXJ/Q28w9EnLrW6t7hLNveltxLo=";
14 };
15
16 nativeBuildInputs = [ rpmextract ];
17
18 unpackPhase = let
19 inherit (stdenvNoCC.hostPlatform) system;
20 platforms = {
21 x86_64-linux = "Linux";
22 aarch64-linux = "ARM/Linux";
23 };
24 platform = platforms.${system} or (throw "unsupported system: ${system}");
25 in ''
26 rpmextract $src/${platform}/storcli-00${version}00.0000-1.*.rpm
27 '';
28
29 dontPatch = true;
30 dontConfigure = true;
31 dontBuild = true;
32
33 installPhase = ''
34 install -D ./opt/MegaRAID/storcli/storcli64 $out/bin/storcli64
35 ln -s storcli64 $out/bin/storcli
36 '';
37
38 # Not needed because the binary is statically linked
39 dontFixup = true;
40
41 meta = with lib; {
42 # Unfortunately there is no better page for this.
43 # Filter for downloads, set 100 items per page. Sort by newest does not work.
44 # Then search manually for the latest version.
45 homepage = "https://www.broadcom.com/site-search?q=storcli";
46 description = "Storage Command Line Tool";
47 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
48 license = licenses.unfree;
49 maintainers = with maintainers; [ panicgh ];
50 platforms = [ "x86_64-linux" "aarch64-linux" ];
51 };
52}