nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 19.03 72 lines 2.1 kB view raw
1{ stdenv, fetchFromGitHub, autoreconfHook 2, coreutils, gnugrep, gnused, lm_sensors, net_snmp, openssh, openssl, perl 3, runtimeShell }: 4 5with stdenv.lib; 6 7let 8 majorVersion = "2.2"; 9 minorVersion = ".0"; 10 11 binPath = makeBinPath [ coreutils gnugrep gnused lm_sensors net_snmp ]; 12 13in stdenv.mkDerivation rec { 14 name = "monitoring-plugins-${majorVersion}${minorVersion}"; 15 16 src = fetchFromGitHub { 17 owner = "monitoring-plugins"; 18 repo = "monitoring-plugins"; 19 rev = "v${majorVersion}"; 20 sha256 = "1pw7i6d2cnb5nxi2lbkwps2qzz04j9zd86fzpv9ka896b4aqrwv1"; 21 }; 22 23 # !!! Awful hack. Grrr... this of course only works on NixOS. 24 # Anyway the check that configure performs to figure out the ping 25 # syntax is totally impure, because it runs an actual ping to 26 # localhost (which won't work for ping6 if IPv6 support isn't 27 # configured on the build machine). 28 preConfigure= '' 29 substituteInPlace po/Makefile.in.in \ 30 --replace /bin/sh ${stdenv.shell} 31 32 sed -i configure.ac \ 33 -e 's|^DEFAULT_PATH=.*|DEFAULT_PATH=\"\$out/bin:/run/wrappers/bin:${binPath}\"|' 34 35 configureFlagsArray=( 36 --with-ping-command='/run/wrappers/bin/ping -4 -n -U -w %d -c %d %s' 37 --with-ping6-command='/run/wrappers/bin/ping -6 -n -U -w %d -c %d %s' 38 ) 39 ''; 40 41 # !!! make openssh a runtime dependency only 42 buildInputs = [ net_snmp openssh openssl perl ]; 43 44 nativeBuildInputs = [ autoreconfHook ]; 45 46 enableParallelBuilding = true; 47 48 # For unknown reasons the installer tries executing $out/share and fails if 49 # it doesn't succeed. 50 # So we create it and remove it again later. 51 preBuild = '' 52 mkdir -p $out 53 cat <<_EOF > $out/share 54#!${runtimeShell} 55exit 0 56_EOF 57 chmod 755 $out/share 58 ''; 59 60 postInstall = '' 61 rm $out/share 62 ln -s libexec $out/bin 63 ''; 64 65 meta = { 66 description = "Official monitoring plugins for Nagios/Icinga/Sensu and others."; 67 homepage = https://www.monitoring-plugins.org; 68 license = licenses.gpl2; 69 platforms = platforms.linux; 70 maintainers = with maintainers; [ thoughtpolice relrod ]; 71 }; 72}