1 { lib, stdenv, fetchurl, autoreconfHook, pkg-config, curl, libevent, libiconv, libxml2, openssl, pcre, zlib
2 , jabberSupport ? true, iksemel
3 , ldapSupport ? true, openldap
4 , odbcSupport ? true, unixODBC
5 , snmpSupport ? true, net-snmp
6 , sshSupport ? true, libssh2
7 , mysqlSupport ? false, libmysqlclient
8 , postgresqlSupport ? false, postgresql
9 , ipmiSupport ? false, openipmi
12 # ensure exactly one primary database type is selected
13 assert mysqlSupport -> !postgresqlSupport;
14 assert postgresqlSupport -> !mysqlSupport;
17 inherit (lib) optional optionalString;
19 import ./versions.nix ({ version, hash, ... }:
21 pname = "zabbix-server";
25 url = "https://cdn.zabbix.com/zabbix/sources/stable/${lib.versions.majorMinor version}/zabbix-${version}.tar.gz";
29 nativeBuildInputs = [ autoreconfHook pkg-config ];
39 ++ optional odbcSupport unixODBC
40 ++ optional jabberSupport iksemel
41 ++ optional ldapSupport openldap
42 ++ optional snmpSupport net-snmp
43 ++ optional sshSupport libssh2
44 ++ optional mysqlSupport libmysqlclient
45 ++ optional postgresqlSupport postgresql
46 ++ optional ipmiSupport openipmi;
56 "--with-openssl=${openssl.dev}"
59 ++ optional odbcSupport "--with-unixodbc"
60 ++ optional jabberSupport "--with-jabber"
61 ++ optional ldapSupport "--with-ldap=${openldap.dev}"
62 ++ optional snmpSupport "--with-net-snmp"
63 ++ optional sshSupport "--with-ssh2=${libssh2.dev}"
64 ++ optional mysqlSupport "--with-mysql"
65 ++ optional postgresqlSupport "--with-postgresql"
66 ++ optional ipmiSupport "--with-openipmi=${openipmi.dev}";
69 find database -name data.sql -exec sed -i 's|/usr/bin/||g' {} +
73 for i in $(find . -type f -name "*.m4"); do
74 substituteInPlace $i \
75 --replace 'test -x "$PKG_CONFIG"' 'type -P "$PKG_CONFIG" >/dev/null'
80 mkdir -p $out/share/zabbix/database/
82 '' + optionalString mysqlSupport ''
83 mkdir -p $out/share/zabbix/database/mysql
84 cp -prvd database/mysql/*.sql $out/share/zabbix/database/mysql/
85 '' + optionalString postgresqlSupport ''
86 mkdir -p $out/share/zabbix/database/postgresql
87 cp -prvd database/postgresql/*.sql $out/share/zabbix/database/postgresql/
91 description = "Enterprise-class open source distributed monitoring solution";
92 homepage = "https://www.zabbix.com/";
93 license = licenses.gpl2Plus;
94 maintainers = with maintainers; [ mmahut psyanticy ];
95 platforms = platforms.linux;