depot/third_party/nixpkgs/pkgs/servers/monitoring/nagios/default.nix
Default email 587713944a Project import generated by Copybara.
GitOrigin-RevId: 6143fc5eeb9c4f00163267708e26191d1e918932
2024-04-21 17:54:59 +02:00

77 lines
1.8 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, perl
, php
, gd
, libpng
, openssl
, zlib
, unzip
, nixosTests
, nix-update-script
}:
stdenv.mkDerivation rec {
pname = "nagios";
version = "4.5.1";
src = fetchFromGitHub {
owner = "NagiosEnterprises";
repo = "nagioscore";
rev = "refs/tags/nagios-${version}";
hash = "sha256-+U2k3w3Yr0qZjHwjRpKZVucB3a35PSZr1Sqa8k0ssq8=";
};
patches = [ ./nagios.patch ];
nativeBuildInputs = [ unzip ];
buildInputs = [
php
perl
gd
libpng
openssl
zlib
];
configureFlags = [
"--localstatedir=/var/lib/nagios"
"--with-ssl=${openssl.dev}"
"--with-ssl-inc=${openssl.dev}/include"
"--with-ssl-lib=${lib.getLib openssl}/lib"
];
buildFlags = [ "all" ];
# Do not create /var directories
preInstall = ''
substituteInPlace Makefile --replace '$(MAKE) install-basic' ""
'';
installTargets = "install install-config";
postInstall = ''
# don't make default files use hardcoded paths to commands
sed -i 's@command_line *[^ ]*/\([^/]*\) @command_line \1 @' $out/etc/objects/commands.cfg
sed -i 's@/usr/bin/@@g' $out/etc/objects/commands.cfg
sed -i 's@/bin/@@g' $out/etc/objects/commands.cfg
'';
passthru = {
tests = {
inherit (nixosTests) nagios;
};
updateScript = nix-update-script {
extraArgs = [ "--version-regex" "nagios-(.*)" ];
};
};
meta = {
description = "A host, service and network monitoring program";
homepage = "https://www.nagios.org/";
changelog = "https://github.com/NagiosEnterprises/nagioscore/blob/nagios-${version}/Changelog";
license = lib.licenses.gpl2;
platforms = lib.platforms.linux;
mainProgram = "nagios";
maintainers = with lib.maintainers; [ immae thoughtpolice relrod anthonyroussel ];
};
}