2021-01-19 07:50:56 +01:00
|
|
|
{ lib, stdenv, fetchurl, autoreconfHook, pkg-config, curl, libevent, libiconv, libxml2, openssl, pcre, zlib
|
2019-07-12 00:37:02 +02:00
|
|
|
, jabberSupport ? true, iksemel
|
|
|
|
, ldapSupport ? true, openldap
|
|
|
|
, odbcSupport ? true, unixODBC
|
2019-12-21 23:44:50 +01:00
|
|
|
, snmpSupport ? true, net-snmp
|
2019-07-12 00:37:02 +02:00
|
|
|
, sshSupport ? true, libssh2
|
2019-09-22 09:38:09 +02:00
|
|
|
, mysqlSupport ? false, libmysqlclient
|
2019-07-12 00:37:02 +02:00
|
|
|
, postgresqlSupport ? false, postgresql
|
2021-09-25 00:08:22 +02:00
|
|
|
, ipmiSupport ? false, openipmi
|
2019-07-12 00:37:02 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
# ensure exactly one primary database type is selected
|
|
|
|
assert mysqlSupport -> !postgresqlSupport;
|
|
|
|
assert postgresqlSupport -> !mysqlSupport;
|
|
|
|
|
|
|
|
let
|
2021-01-15 08:07:56 +01:00
|
|
|
inherit (lib) optional optionalString;
|
2019-07-12 00:37:02 +02:00
|
|
|
in
|
|
|
|
import ./versions.nix ({ version, sha256 }:
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
pname = "zabbix-server";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchurl {
|
2021-01-15 08:07:56 +01:00
|
|
|
url = "https://cdn.zabbix.com/zabbix/sources/stable/${lib.versions.majorMinor version}/zabbix-${version}.tar.gz";
|
2019-07-12 00:37:02 +02:00
|
|
|
inherit sha256;
|
|
|
|
};
|
|
|
|
|
2021-01-19 07:50:56 +01:00
|
|
|
nativeBuildInputs = [ autoreconfHook pkg-config ];
|
2019-07-12 00:37:02 +02:00
|
|
|
buildInputs = [
|
|
|
|
curl
|
|
|
|
libevent
|
|
|
|
libiconv
|
|
|
|
libxml2
|
|
|
|
openssl
|
|
|
|
pcre
|
|
|
|
zlib
|
|
|
|
]
|
|
|
|
++ optional odbcSupport unixODBC
|
|
|
|
++ optional jabberSupport iksemel
|
|
|
|
++ optional ldapSupport openldap
|
2019-12-21 23:44:50 +01:00
|
|
|
++ optional snmpSupport net-snmp
|
2019-07-12 00:37:02 +02:00
|
|
|
++ optional sshSupport libssh2
|
2019-09-22 09:38:09 +02:00
|
|
|
++ optional mysqlSupport libmysqlclient
|
2021-09-25 00:08:22 +02:00
|
|
|
++ optional postgresqlSupport postgresql
|
|
|
|
++ optional ipmiSupport openipmi;
|
2019-07-12 00:37:02 +02:00
|
|
|
|
|
|
|
configureFlags = [
|
2021-12-15 16:53:48 +01:00
|
|
|
"--enable-ipv6"
|
2019-07-12 00:37:02 +02:00
|
|
|
"--enable-server"
|
|
|
|
"--with-iconv"
|
|
|
|
"--with-libcurl"
|
|
|
|
"--with-libevent"
|
|
|
|
"--with-libpcre"
|
|
|
|
"--with-libxml2"
|
|
|
|
"--with-openssl=${openssl.dev}"
|
|
|
|
"--with-zlib=${zlib}"
|
|
|
|
]
|
|
|
|
++ optional odbcSupport "--with-unixodbc"
|
|
|
|
++ optional jabberSupport "--with-jabber"
|
|
|
|
++ optional ldapSupport "--with-ldap=${openldap.dev}"
|
|
|
|
++ optional snmpSupport "--with-net-snmp"
|
|
|
|
++ optional sshSupport "--with-ssh2=${libssh2.dev}"
|
|
|
|
++ optional mysqlSupport "--with-mysql"
|
2021-09-25 00:08:22 +02:00
|
|
|
++ optional postgresqlSupport "--with-postgresql"
|
|
|
|
++ optional ipmiSupport "--with-openipmi=${openipmi.dev}";
|
2019-07-12 00:37:02 +02:00
|
|
|
|
|
|
|
prePatch = ''
|
|
|
|
find database -name data.sql -exec sed -i 's|/usr/bin/||g' {} +
|
|
|
|
'';
|
|
|
|
|
2020-08-17 15:40:06 +02:00
|
|
|
preAutoreconf = ''
|
|
|
|
for i in $(find . -type f -name "*.m4"); do
|
|
|
|
substituteInPlace $i \
|
|
|
|
--replace 'test -x "$PKG_CONFIG"' 'type -P "$PKG_CONFIG" >/dev/null'
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2019-07-12 00:37:02 +02:00
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/share/zabbix/database/
|
|
|
|
cp -r include $out/
|
|
|
|
'' + optionalString mysqlSupport ''
|
|
|
|
mkdir -p $out/share/zabbix/database/mysql
|
|
|
|
cp -prvd database/mysql/*.sql $out/share/zabbix/database/mysql/
|
|
|
|
'' + optionalString postgresqlSupport ''
|
|
|
|
mkdir -p $out/share/zabbix/database/postgresql
|
|
|
|
cp -prvd database/postgresql/*.sql $out/share/zabbix/database/postgresql/
|
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2019-07-12 00:37:02 +02:00
|
|
|
description = "An enterprise-class open source distributed monitoring solution";
|
|
|
|
homepage = "https://www.zabbix.com/";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = with maintainers; [ mmahut psyanticy ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
})
|