2021-01-19 06:50:56 +00:00
|
|
|
{ lib, stdenv, fetchurl, pkg-config, libevent, libiconv, openssl, pcre, zlib
|
2019-07-11 23:37:02 +01:00
|
|
|
, odbcSupport ? true, unixODBC
|
2019-12-21 22:44:50 +00:00
|
|
|
, snmpSupport ? true, net-snmp
|
2019-07-11 23:37:02 +01:00
|
|
|
, sshSupport ? true, libssh2
|
|
|
|
, sqliteSupport ? false, sqlite
|
2019-09-22 08:38:09 +01:00
|
|
|
, mysqlSupport ? false, libmysqlclient
|
2019-07-11 23:37:02 +01:00
|
|
|
, postgresqlSupport ? false, postgresql
|
|
|
|
}:
|
|
|
|
|
|
|
|
# ensure exactly one database type is selected
|
|
|
|
assert mysqlSupport -> !postgresqlSupport && !sqliteSupport;
|
|
|
|
assert postgresqlSupport -> !mysqlSupport && !sqliteSupport;
|
|
|
|
assert sqliteSupport -> !mysqlSupport && !postgresqlSupport;
|
|
|
|
|
|
|
|
let
|
2021-01-15 07:07:56 +00:00
|
|
|
inherit (lib) optional optionalString;
|
2019-07-11 23:37:02 +01:00
|
|
|
in
|
|
|
|
import ./versions.nix ({ version, sha256 }:
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
pname = "zabbix-proxy";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchurl {
|
2021-01-15 07:07:56 +00:00
|
|
|
url = "https://cdn.zabbix.com/zabbix/sources/stable/${lib.versions.majorMinor version}/zabbix-${version}.tar.gz";
|
2019-07-11 23:37:02 +01:00
|
|
|
inherit sha256;
|
|
|
|
};
|
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2019-07-11 23:37:02 +01:00
|
|
|
buildInputs = [
|
|
|
|
libevent
|
|
|
|
libiconv
|
|
|
|
openssl
|
|
|
|
pcre
|
|
|
|
zlib
|
|
|
|
]
|
|
|
|
++ optional odbcSupport unixODBC
|
2019-12-21 22:44:50 +00:00
|
|
|
++ optional snmpSupport net-snmp
|
2019-07-11 23:37:02 +01:00
|
|
|
++ optional sqliteSupport sqlite
|
|
|
|
++ optional sshSupport libssh2
|
2019-09-22 08:38:09 +01:00
|
|
|
++ optional mysqlSupport libmysqlclient
|
2019-07-11 23:37:02 +01:00
|
|
|
++ optional postgresqlSupport postgresql;
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--enable-proxy"
|
|
|
|
"--with-iconv"
|
|
|
|
"--with-libevent"
|
|
|
|
"--with-libpcre"
|
|
|
|
"--with-openssl=${openssl.dev}"
|
|
|
|
"--with-zlib=${zlib}"
|
|
|
|
]
|
|
|
|
++ optional odbcSupport "--with-unixodbc"
|
|
|
|
++ optional snmpSupport "--with-net-snmp"
|
|
|
|
++ optional sqliteSupport "--with-sqlite3=${sqlite.dev}"
|
|
|
|
++ optional sshSupport "--with-ssh2=${libssh2.dev}"
|
|
|
|
++ optional mysqlSupport "--with-mysql"
|
|
|
|
++ optional postgresqlSupport "--with-postgresql";
|
|
|
|
|
|
|
|
prePatch = ''
|
|
|
|
find database -name data.sql -exec sed -i 's|/usr/bin/||g' {} +
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/share/zabbix/database/
|
|
|
|
'' + optionalString sqliteSupport ''
|
|
|
|
mkdir -p $out/share/zabbix/database/sqlite3
|
2019-08-13 23:35:02 +01:00
|
|
|
cp -prvd database/sqlite3/schema.sql $out/share/zabbix/database/sqlite3/
|
|
|
|
'' + optionalString mysqlSupport ''
|
|
|
|
mkdir -p $out/share/zabbix/database/mysql
|
|
|
|
cp -prvd database/mysql/schema.sql $out/share/zabbix/database/mysql/
|
2019-07-11 23:37:02 +01:00
|
|
|
'' + optionalString postgresqlSupport ''
|
|
|
|
mkdir -p $out/share/zabbix/database/postgresql
|
|
|
|
cp -prvd database/postgresql/schema.sql $out/share/zabbix/database/postgresql/
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-07-11 23:37:02 +01:00
|
|
|
description = "An enterprise-class open source distributed monitoring solution (client-server proxy)";
|
|
|
|
homepage = "https://www.zabbix.com/";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = [ maintainers.mmahut ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
})
|