1{
2 lib,
3 stdenvNoCC,
4 fetchzip,
5 rpmextract,
6 testers,
7}:
8
9stdenvNoCC.mkDerivation (finalAttrs: {
10 pname = "storcli";
11 version = "7.3103.00";
12 phase = "32";
13
14 src = fetchzip {
15 url = "https://docs.broadcom.com/docs-and-downloads/host-bus-adapters/host-bus-adapters-common-files/sas_sata_nvme_12g_p${finalAttrs.phase}/STORCLI_SAS3.5_P${finalAttrs.phase}.zip";
16 hash = "sha256-bOlIChZi2eWpc5QA+wXBQA4s+o/MVLVWsligjDpUXEU=";
17 };
18
19 nativeBuildInputs = [ rpmextract ];
20
21 unpackPhase =
22 let
23 inherit (stdenvNoCC.hostPlatform) system;
24 platforms = {
25 x86_64-linux = "Linux";
26 aarch64-linux = "ARM/Linux";
27 };
28 platform = platforms.${system} or (throw "unsupported system: ${system}");
29 in
30 ''
31 rpmextract $src/univ_viva_cli_rel/Unified_storcli_all_os/${platform}/storcli-00${finalAttrs.version}00.0000-1.*.rpm
32 '';
33
34 dontPatch = true;
35 dontConfigure = true;
36 dontBuild = true;
37
38 installPhase = ''
39 install -D ./opt/MegaRAID/storcli/storcli64 $out/bin/storcli64
40 ln -s storcli64 $out/bin/storcli
41 '';
42
43 # Not needed because the binary is statically linked
44 dontFixup = true;
45
46 passthru.tests = testers.testVersion {
47 package = finalAttrs.finalPackage;
48 command = "${finalAttrs.meta.mainProgram} -v";
49 version = "00${finalAttrs.version}00.0000";
50 };
51
52 meta = with lib; {
53 # Unfortunately there is no better page for this.
54 # Filter for downloads, set 100 items per page. Sort by newest does not work.
55 # Then search manually for the latest version.
56 homepage = "https://www.broadcom.com/support/download-search?pg=&pf=Host+Bus+Adapters&pn=&pa=&po=&dk=storcli&pl=&l=false";
57 description = "Storage Command Line Tool";
58 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
59 license = licenses.unfree;
60 maintainers = with maintainers; [ panicgh ];
61 mainProgram = "storcli";
62 platforms = [
63 "x86_64-linux"
64 "aarch64-linux"
65 ];
66 };
67})