nixpkgs/pkgs/tools/misc/megacli/default.nix
2019-03-18 22:13:34 +01:00

41 lines
1.2 KiB
Nix

{ stdenv, rpmextract, ncurses5, patchelf, makeWrapper, requireFile, unzip }:
stdenv.mkDerivation rec {
name = "megacli-${version}";
version = "8.07.14";
src =
requireFile {
name = "${builtins.replaceStrings ["."] ["-"] version}_MegaCLI.zip";
url = https://docs.broadcom.com/docs/12351587;
sha256 = "1sdn58fbmd3fj4nzbajq3gcyw71ilgdh45r5p4sa6xmb7np55cfr";
};
buildInputs = [rpmextract ncurses5 unzip];
libPath =
stdenv.lib.makeLibraryPath
[ stdenv.cc.cc stdenv.cc.libc ncurses5 ];
buildCommand = ''
unzip ${src}
rpmextract Linux/MegaCli-${version}-1.noarch.rpm
mkdir -p $out/{bin,share/MegaRAID/MegaCli}
cp -r opt $out
cp ${version}_MegaCLI.txt $out/share/MegaRAID/MegaCli
${patchelf}/bin/patchelf \
--interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath ${libPath}:${stdenv.cc.cc.lib}/lib64:${stdenv.cc.cc.lib}/lib \
$out/opt/MegaRAID/MegaCli/MegaCli64
ln -s $out/opt/MegaRAID/MegaCli/MegaCli64 $out/bin/MegaCli64
eval fixupPhase
'';
meta = {
description = "CLI program for LSI MegaRAID cards, which also works with some Dell PERC RAID cards";
license = stdenv.lib.licenses.unfree;
platforms = [ "x86_64-linux" ];
};
}