Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchurl, pkg-config, libevent, libiconv, openssl, pcre, zlib 2, odbcSupport ? true, unixODBC 3, snmpSupport ? stdenv.buildPlatform == stdenv.hostPlatform, net-snmp 4, sshSupport ? true, libssh2 5, sqliteSupport ? false, sqlite 6, mysqlSupport ? false, libmysqlclient 7, postgresqlSupport ? false, postgresql 8}: 9 10# ensure exactly one database type is selected 11assert mysqlSupport -> !postgresqlSupport && !sqliteSupport; 12assert postgresqlSupport -> !mysqlSupport && !sqliteSupport; 13assert sqliteSupport -> !mysqlSupport && !postgresqlSupport; 14 15let 16 inherit (lib) optional optionalString; 17in 18 import ./versions.nix ({ version, sha256, ... }: 19 stdenv.mkDerivation { 20 pname = "zabbix-proxy"; 21 inherit version; 22 23 src = fetchurl { 24 url = "https://cdn.zabbix.com/zabbix/sources/stable/${lib.versions.majorMinor version}/zabbix-${version}.tar.gz"; 25 inherit sha256; 26 }; 27 28 nativeBuildInputs = [ pkg-config ]; 29 buildInputs = [ 30 libevent 31 libiconv 32 openssl 33 pcre 34 zlib 35 ] 36 ++ optional odbcSupport unixODBC 37 ++ optional snmpSupport net-snmp 38 ++ optional sqliteSupport sqlite 39 ++ optional sshSupport libssh2 40 ++ optional mysqlSupport libmysqlclient 41 ++ optional postgresqlSupport postgresql; 42 43 configureFlags = [ 44 "--enable-ipv6" 45 "--enable-proxy" 46 "--with-iconv" 47 "--with-libevent" 48 "--with-libpcre" 49 "--with-openssl=${openssl.dev}" 50 "--with-zlib=${zlib}" 51 ] 52 ++ optional odbcSupport "--with-unixodbc" 53 ++ optional snmpSupport "--with-net-snmp" 54 ++ optional sqliteSupport "--with-sqlite3=${sqlite.dev}" 55 ++ optional sshSupport "--with-ssh2=${libssh2.dev}" 56 ++ optional mysqlSupport "--with-mysql" 57 ++ optional postgresqlSupport "--with-postgresql"; 58 59 prePatch = '' 60 find database -name data.sql -exec sed -i 's|/usr/bin/||g' {} + 61 ''; 62 63 makeFlags = [ 64 "AR:=$(AR)" 65 "RANLIB:=$(RANLIB)" 66 ]; 67 68 postInstall = '' 69 mkdir -p $out/share/zabbix/database/ 70 '' + optionalString sqliteSupport '' 71 mkdir -p $out/share/zabbix/database/sqlite3 72 cp -prvd database/sqlite3/schema.sql $out/share/zabbix/database/sqlite3/ 73 '' + optionalString mysqlSupport '' 74 mkdir -p $out/share/zabbix/database/mysql 75 cp -prvd database/mysql/schema.sql $out/share/zabbix/database/mysql/ 76 '' + optionalString postgresqlSupport '' 77 mkdir -p $out/share/zabbix/database/postgresql 78 cp -prvd database/postgresql/schema.sql $out/share/zabbix/database/postgresql/ 79 ''; 80 81 meta = with lib; { 82 description = "An enterprise-class open source distributed monitoring solution (client-server proxy)"; 83 homepage = "https://www.zabbix.com/"; 84 license = licenses.gpl2; 85 maintainers = [ maintainers.mmahut ]; 86 platforms = platforms.linux; 87 }; 88 })