13 snmpSupport ? stdenv.buildPlatform == stdenv.hostPlatform,
17 sqliteSupport ? false,
21 postgresqlSupport ? false,
25 # ensure exactly one database type is selected
26 assert mysqlSupport -> !postgresqlSupport && !sqliteSupport;
27 assert postgresqlSupport -> !mysqlSupport && !sqliteSupport;
28 assert sqliteSupport -> !mysqlSupport && !postgresqlSupport;
31 inherit (lib) optional optionalString;
33 import ./versions.nix (
34 { version, hash, ... }:
36 pname = "zabbix-proxy";
40 url = "https://cdn.zabbix.com/zabbix/sources/stable/${lib.versions.majorMinor version}/zabbix-${version}.tar.gz";
44 nativeBuildInputs = [ pkg-config ];
53 ++ optional odbcSupport unixODBC
54 ++ optional snmpSupport net-snmp
55 ++ optional sqliteSupport sqlite
56 ++ optional sshSupport libssh2
57 ++ optional mysqlSupport libmysqlclient
58 ++ optional postgresqlSupport postgresql;
67 "--with-openssl=${openssl.dev}"
70 ++ optional odbcSupport "--with-unixodbc"
71 ++ optional snmpSupport "--with-net-snmp"
72 ++ optional sqliteSupport "--with-sqlite3=${sqlite.dev}"
73 ++ optional sshSupport "--with-ssh2=${libssh2.dev}"
74 ++ optional mysqlSupport "--with-mysql"
75 ++ optional postgresqlSupport "--with-postgresql";
78 find database -name data.sql -exec sed -i 's|/usr/bin/||g' {} +
88 mkdir -p $out/share/zabbix/database/
90 + optionalString sqliteSupport ''
91 mkdir -p $out/share/zabbix/database/sqlite3
92 cp -prvd database/sqlite3/schema.sql $out/share/zabbix/database/sqlite3/
94 + optionalString mysqlSupport ''
95 mkdir -p $out/share/zabbix/database/mysql
96 cp -prvd database/mysql/schema.sql $out/share/zabbix/database/mysql/
98 + optionalString postgresqlSupport ''
99 mkdir -p $out/share/zabbix/database/postgresql
100 cp -prvd database/postgresql/schema.sql $out/share/zabbix/database/postgresql/
104 description = "Enterprise-class open source distributed monitoring solution (client-server proxy)";
105 homepage = "https://www.zabbix.com/";
107 if (lib.versions.major version >= "7") then lib.licenses.agpl3Only else lib.licenses.gpl2Plus;
108 maintainers = with lib.maintainers; [ mmahut ];
109 platforms = lib.platforms.linux;