nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 106 lines 2.9 kB view raw
1{ 2 fetchFromGitHub, 3 lib, 4 makeWrapper, 5 monitoring-plugins, 6 perlPackages, 7 stdenv, 8 txt2man, 9 wmic-bin ? null, 10}: 11 12stdenv.mkDerivation rec { 13 pname = "check-wmi-plus"; 14 version = "1.65"; 15 16 # Upstream has been moved from Github to tarballs on the author's website. 17 # See https://edcint.co.nz/checkwmiplus/releases/ 18 src = fetchFromGitHub { 19 owner = "speartail"; 20 repo = "checkwmiplus"; 21 tag = "v${version}"; 22 sha256 = "1as0iyhy4flpm37mb7lvah7rnd6ax88appjm1icwhy7iq03wi8pl"; 23 }; 24 25 patches = [ ./wmiplus_fix_manpage.patch ]; 26 27 propagatedBuildInputs = with perlPackages; [ 28 BHooksEndOfScope 29 ClassDataInheritable 30 ClassInspector 31 ClassSingleton 32 ConfigIniFiles 33 DateTime 34 DateTimeLocale 35 DateTimeTimeZone 36 DevelStackTrace 37 EvalClosure 38 ExceptionClass 39 FileShareDir 40 ModuleImplementation 41 ModuleRuntime 42 MROCompat 43 namespaceautoclean 44 namespaceclean 45 NumberFormat 46 PackageStash 47 ParamsValidate 48 ParamsValidationCompiler 49 RoleTiny 50 Specio 51 SubExporterProgressive 52 SubIdentify 53 TryTiny 54 ]; 55 56 nativeBuildInputs = [ 57 makeWrapper 58 txt2man 59 ]; 60 61 dontConfigure = true; 62 dontBuild = true; 63 doCheck = false; # no checks 64 65 postPatch = '' 66 substituteInPlace check_wmi_plus.pl \ 67 --replace-fail /usr/bin/wmic ${wmic-bin}/bin/wmic \ 68 --replace-fail /etc/check_wmi_plus $out/etc/check_wmi_plus \ 69 --replace-fail /opt/nagios/bin/plugins $out/etc/check_wmi_plus \ 70 --replace-fail /usr/lib/nagios/plugins ${monitoring-plugins}/libexec \ 71 --replace-fail '$base_dir/check_wmi_plus_help.pl' "$out/bin/check_wmi_plus_help.pl" 72 73 for f in *.pl ; do 74 substituteInPlace $f --replace /usr/bin/perl ${perlPackages.perl}/bin/perl 75 done 76 ''; 77 78 installPhase = '' 79 runHook preInstall 80 81 install -Dm755 -t $out/bin *.pl 82 install -Dm644 -t $out/share/doc/${pname} *.txt 83 cp -r etc $out/ 84 85 runHook postInstall 86 ''; 87 88 # 1. we need to wait until the main binary has been fixed up with proper perl paths before we can run it to generate the man page 89 # 2. txt2man returns exit code 3 even if it works, so we add the || true bit 90 postFixup = '' 91 wrapProgram $out/bin/check_wmi_plus.pl \ 92 --set PERL5LIB "${perlPackages.makePerlPath propagatedBuildInputs}" 93 94 mkdir -p $out/share/man/man1 95 $out/bin/check_wmi_plus.pl --help | txt2man -d 1970-01-01 -s 1 -t check_wmi_plus -r "Check WMI Plus ${version}" > $out/share/man/man1/check_wmi_plus.1 || true 96 gzip $out/share/man/man1/check_wmi_plus.1 97 ''; 98 99 meta = { 100 description = "Sensu/nagios plugin using WMI to query Windows hosts"; 101 homepage = "https://edcint.co.nz/checkwmiplus/"; 102 license = lib.licenses.gpl2Plus; 103 mainProgram = "check_wmi_plus"; 104 maintainers = with lib.maintainers; [ peterhoeg ]; 105 }; 106}