1 { lib, stdenv, rpmextract, ncurses5, patchelf, fetchurl, unzip }:
3 stdenv.mkDerivation rec {
8 url = "https://docs.broadcom.com/docs-and-downloads/raid-controllers/raid-controllers-common-files/${builtins.replaceStrings ["."] ["-"] version}_MegaCLI.zip";
9 sha256 = "1sdn58fbmd3fj4nzbajq3gcyw71ilgdh45r5p4sa6xmb7np55cfr";
12 nativeBuildInputs = [ unzip ];
13 buildInputs = [rpmextract ncurses5];
16 [ stdenv.cc.cc stdenv.cc.libc ncurses5 ];
20 rpmextract Linux/MegaCli-${version}-1.noarch.rpm
22 mkdir -p $out/{bin,share/MegaRAID/MegaCli}
24 cp ${version}_MegaCLI.txt $out/share/MegaRAID/MegaCli
26 ${patchelf}/bin/patchelf \
27 --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
28 --set-rpath ${libPath}:${stdenv.cc.cc.lib}/lib64:${stdenv.cc.cc.lib}/lib \
29 $out/opt/MegaRAID/MegaCli/MegaCli64
31 ln -s $out/opt/MegaRAID/MegaCli/MegaCli64 $out/bin/MegaCli64
36 description = "CLI program for LSI MegaRAID cards, which also works with some Dell PERC RAID cards";
37 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
38 license = lib.licenses.unfree;
39 platforms = [ "x86_64-linux" ];
40 mainProgram = "MegaCli64";