3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/servers/monitoring/zabbix/proxy.nix
Jonathan Ringer 9bb3fccb5b treewide: pkgs.pkgconfig -> pkgs.pkg-config, move pkgconfig to alias.nix
continuation of #109595

pkgconfig was aliased in 2018, however, it remained in
all-packages.nix due to its wide usage. This cleans
up the remaining references to pkgs.pkgsconfig and
moves the entry to aliases.nix.

python3Packages.pkgconfig remained unchanged because
it's the canonical name of the upstream package
on pypi.
2021-01-19 01:16:25 -08:00

83 lines
2.8 KiB
Nix

{ lib, stdenv, fetchurl, pkg-config, libevent, libiconv, openssl, pcre, zlib
, odbcSupport ? true, unixODBC
, snmpSupport ? true, net-snmp
, sshSupport ? true, libssh2
, sqliteSupport ? false, sqlite
, mysqlSupport ? false, libmysqlclient
, postgresqlSupport ? false, postgresql
}:
# ensure exactly one database type is selected
assert mysqlSupport -> !postgresqlSupport && !sqliteSupport;
assert postgresqlSupport -> !mysqlSupport && !sqliteSupport;
assert sqliteSupport -> !mysqlSupport && !postgresqlSupport;
let
inherit (lib) optional optionalString;
in
import ./versions.nix ({ version, sha256 }:
stdenv.mkDerivation {
pname = "zabbix-proxy";
inherit version;
src = fetchurl {
url = "https://cdn.zabbix.com/zabbix/sources/stable/${lib.versions.majorMinor version}/zabbix-${version}.tar.gz";
inherit sha256;
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [
libevent
libiconv
openssl
pcre
zlib
]
++ optional odbcSupport unixODBC
++ optional snmpSupport net-snmp
++ optional sqliteSupport sqlite
++ optional sshSupport libssh2
++ optional mysqlSupport libmysqlclient
++ 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
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/
'' + optionalString postgresqlSupport ''
mkdir -p $out/share/zabbix/database/postgresql
cp -prvd database/postgresql/schema.sql $out/share/zabbix/database/postgresql/
'';
meta = with lib; {
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;
};
})