12 stdenv.mkDerivation rec {
13 pname = "check-wmi-plus";
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 {
20 repo = "checkwmiplus";
21 rev = "refs/tags/v${version}";
22 sha256 = "1as0iyhy4flpm37mb7lvah7rnd6ax88appjm1icwhy7iq03wi8pl";
25 patches = [ ./wmiplus_fix_manpage.patch ];
27 propagatedBuildInputs = with perlPackages; [
48 ParamsValidationCompiler
51 SubExporterProgressive
63 doCheck = false; # no checks
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"
74 substituteInPlace $f --replace /usr/bin/perl ${perlPackages.perl}/bin/perl
81 install -Dm755 -t $out/bin *.pl
82 install -Dm644 -t $out/share/doc/${pname} *.txt
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
91 wrapProgram $out/bin/check_wmi_plus.pl \
92 --set PERL5LIB "${perlPackages.makePerlPath propagatedBuildInputs}"
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
100 description = "Sensu/nagios plugin using WMI to query Windows hosts";
101 homepage = "https://edcint.co.nz/checkwmiplus/";
102 license = licenses.gpl2Plus;
103 mainProgram = "check_wmi_plus";
104 maintainers = with maintainers; [ peterhoeg ];