monitoring-plugins: 2.2.0 -> 2.3.0
This commit is contained in:
parent
5555f34784
commit
0f441f5cad
|
@ -1,86 +1,120 @@
|
||||||
{ lib, stdenv, fetchFromGitHub, fetchpatch, autoreconfHook, runCommand
|
{ lib
|
||||||
, coreutils, gnugrep, gnused, lm_sensors, net-snmp, openssh, openssl, perl
|
, stdenv
|
||||||
, dnsutils, libdbi, libmysqlclient, zlib, openldap, procps
|
, fetchFromGitHub
|
||||||
, runtimeShell }:
|
, writeShellScript
|
||||||
|
, autoreconfHook
|
||||||
with lib;
|
, pkg-config
|
||||||
|
, runCommand
|
||||||
|
, coreutils
|
||||||
|
, gnugrep
|
||||||
|
, gnused
|
||||||
|
, lm_sensors
|
||||||
|
, net-snmp
|
||||||
|
, openssh
|
||||||
|
, openssl
|
||||||
|
, perl
|
||||||
|
, dnsutils
|
||||||
|
, libdbi
|
||||||
|
, libmysqlclient
|
||||||
|
, uriparser
|
||||||
|
, zlib
|
||||||
|
, openldap
|
||||||
|
, procps
|
||||||
|
, runtimeShell
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
majorVersion = "2.2";
|
binPath = lib.makeBinPath [
|
||||||
minorVersion = ".0";
|
(placeholder "out")
|
||||||
|
"/run/wrappers"
|
||||||
binPath = makeBinPath [ coreutils gnugrep gnused lm_sensors net-snmp procps ];
|
coreutils
|
||||||
|
gnugrep
|
||||||
in stdenv.mkDerivation {
|
gnused
|
||||||
name = "monitoring-plugins-${majorVersion}${minorVersion}";
|
lm_sensors
|
||||||
|
net-snmp
|
||||||
src = fetchFromGitHub {
|
procps
|
||||||
owner = "monitoring-plugins";
|
|
||||||
repo = "monitoring-plugins";
|
|
||||||
rev = "v${majorVersion}";
|
|
||||||
sha256 = "1pw7i6d2cnb5nxi2lbkwps2qzz04j9zd86fzpv9ka896b4aqrwv1";
|
|
||||||
};
|
|
||||||
|
|
||||||
patches = [
|
|
||||||
# https://github.com/monitoring-plugins/monitoring-plugins/issues/1508
|
|
||||||
(fetchpatch {
|
|
||||||
url = "https://github.com/monitoring-plugins/monitoring-plugins/commit/ac0437ff896ba9ce2549b2d2ec3de146a886f08a.patch";
|
|
||||||
sha256 = "0jf6fqkyzag66rid92m7asnr2dp8rr8kn4zjvhqg0mqvf8imppky";
|
|
||||||
})
|
|
||||||
];
|
];
|
||||||
|
|
||||||
# !!! Awful hack. Grrr... this of course only works on NixOS.
|
mailq = runCommand "mailq-wrapper" { preferLocalBuild = true; } ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
ln -s /run/wrappers/bin/sendmail $out/bin/mailq
|
||||||
|
'';
|
||||||
|
|
||||||
|
# For unknown reasons the installer tries executing $out/share and fails so
|
||||||
|
# we create it and remove it again later.
|
||||||
|
share = writeShellScript "share" ''
|
||||||
|
exit 0
|
||||||
|
'';
|
||||||
|
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "monitoring-plugins";
|
||||||
|
version = "2.3.0";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "monitoring-plugins";
|
||||||
|
repo = "monitoring-plugins";
|
||||||
|
rev = "v" + lib.versions.majorMinor version;
|
||||||
|
sha256 = "sha256-yLhHOSrPFRjW701aOL8LPe4OnuJxL6f+dTxNqm0evIg=";
|
||||||
|
};
|
||||||
|
|
||||||
|
# TODO: Awful hack. Grrr... this of course only works on NixOS.
|
||||||
# Anyway the check that configure performs to figure out the ping
|
# Anyway the check that configure performs to figure out the ping
|
||||||
# syntax is totally impure, because it runs an actual ping to
|
# syntax is totally impure, because it runs an actual ping to
|
||||||
# localhost (which won't work for ping6 if IPv6 support isn't
|
# localhost (which won't work for ping6 if IPv6 support isn't
|
||||||
# configured on the build machine).
|
# configured on the build machine).
|
||||||
preConfigure= ''
|
#
|
||||||
|
# --with-ping-command needs to be done here instead of in
|
||||||
|
# configureFlags due to the spaces in the argument
|
||||||
|
postPatch = ''
|
||||||
substituteInPlace po/Makefile.in.in \
|
substituteInPlace po/Makefile.in.in \
|
||||||
--replace /bin/sh ${stdenv.shell}
|
--replace /bin/sh ${runtimeShell}
|
||||||
|
|
||||||
sed -i configure.ac \
|
sed -i configure.ac \
|
||||||
-e 's|^DEFAULT_PATH=.*|DEFAULT_PATH=\"\$out/bin:/run/wrappers/bin:${binPath}\"|'
|
-e 's|^DEFAULT_PATH=.*|DEFAULT_PATH=\"${binPath}\"|'
|
||||||
|
|
||||||
configureFlagsArray=(
|
configureFlagsArray+=(
|
||||||
--with-ping-command='/run/wrappers/bin/ping -4 -n -U -w %d -c %d %s'
|
--with-ping-command='/run/wrappers/bin/ping -4 -n -U -w %d -c %d %s'
|
||||||
--with-ping6-command='/run/wrappers/bin/ping -6 -n -U -w %d -c %d %s'
|
--with-ping6-command='/run/wrappers/bin/ping -6 -n -U -w %d -c %d %s'
|
||||||
--with-sudo-command='/run/wrappers/bin/sudo'
|
|
||||||
--with-mailq-command='${runCommand "mailq-wrapper" {preferLocalBuild=true;} ''
|
|
||||||
mkdir -p $out/bin
|
|
||||||
ln -s /run/wrappers/bin/sendmail $out/bin/mailq
|
|
||||||
''}/bin/mailq'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
install -Dm555 ${share} $out/share
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# !!! make openssh a runtime dependency only
|
configureFlags = [
|
||||||
buildInputs = [ dnsutils libdbi libmysqlclient net-snmp openldap openssh openssl perl procps zlib ];
|
"--libexecdir=${placeholder "out"}/bin"
|
||||||
|
"--with-mailq-command=${mailq}/bin/mailq"
|
||||||
|
"--with-sudo-command=/run/wrappers/bin/sudo"
|
||||||
|
];
|
||||||
|
|
||||||
nativeBuildInputs = [ autoreconfHook ];
|
buildInputs = [
|
||||||
|
dnsutils
|
||||||
|
libdbi
|
||||||
|
libmysqlclient
|
||||||
|
net-snmp
|
||||||
|
openldap
|
||||||
|
# TODO: make openssh a runtime dependency only
|
||||||
|
openssh
|
||||||
|
openssl
|
||||||
|
perl
|
||||||
|
procps
|
||||||
|
uriparser
|
||||||
|
zlib
|
||||||
|
];
|
||||||
|
|
||||||
|
nativeBuildInputs = [ autoreconfHook pkg-config ];
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
# For unknown reasons the installer tries executing $out/share and fails if
|
|
||||||
# it doesn't succeed.
|
|
||||||
# So we create it and remove it again later.
|
|
||||||
preBuild = ''
|
|
||||||
mkdir -p $out
|
|
||||||
cat <<_EOF > $out/share
|
|
||||||
#!${runtimeShell}
|
|
||||||
exit 0
|
|
||||||
_EOF
|
|
||||||
chmod 755 $out/share
|
|
||||||
'';
|
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
rm $out/share
|
rm $out/share
|
||||||
ln -s libexec $out/bin
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = with lib; {
|
||||||
description = "Official monitoring plugins for Nagios/Icinga/Sensu and others";
|
description = "Official monitoring plugins for Nagios/Icinga/Sensu and others";
|
||||||
homepage = "https://www.monitoring-plugins.org";
|
homepage = "https://www.monitoring-plugins.org";
|
||||||
license = licenses.gpl2;
|
license = licenses.gpl3Only;
|
||||||
platforms = platforms.linux;
|
|
||||||
maintainers = with maintainers; [ thoughtpolice relrod ];
|
maintainers = with maintainers; [ thoughtpolice relrod ];
|
||||||
|
platforms = platforms.linux;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue