Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at python-updates 131 lines 3.4 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 autoreconfHook, 6 pkg-config, 7 curl, 8 libevent, 9 libiconv, 10 libxml2, 11 openssl, 12 pcre, 13 pcre2, 14 zlib, 15 jabberSupport ? true, 16 iksemel, 17 ldapSupport ? true, 18 openldap, 19 odbcSupport ? true, 20 unixODBC, 21 snmpSupport ? true, 22 net-snmp, 23 sshSupport ? true, 24 libssh2, 25 mysqlSupport ? false, 26 libmysqlclient, 27 postgresqlSupport ? false, 28 libpq, 29 ipmiSupport ? false, 30 openipmi, 31}: 32 33# ensure exactly one primary database type is selected 34assert mysqlSupport -> !postgresqlSupport; 35assert postgresqlSupport -> !mysqlSupport; 36 37let 38 inherit (lib) optional optionalString; 39in 40import ./versions.nix ( 41 { version, hash, ... }: 42 stdenv.mkDerivation { 43 pname = "zabbix-server"; 44 inherit version; 45 46 src = fetchurl { 47 url = "https://cdn.zabbix.com/zabbix/sources/stable/${lib.versions.majorMinor version}/zabbix-${version}.tar.gz"; 48 inherit hash; 49 }; 50 51 nativeBuildInputs = [ 52 autoreconfHook 53 pkg-config 54 ] 55 ++ optional postgresqlSupport libpq.pg_config; 56 buildInputs = [ 57 curl 58 libevent 59 libiconv 60 libxml2 61 openssl 62 (if (lib.versions.major version >= "7" && lib.versions.minor version >= "4") then pcre2 else pcre) 63 zlib 64 ] 65 ++ optional odbcSupport unixODBC 66 ++ optional jabberSupport iksemel 67 ++ optional ldapSupport openldap 68 ++ optional snmpSupport net-snmp 69 ++ optional sshSupport libssh2 70 ++ optional mysqlSupport libmysqlclient 71 ++ optional postgresqlSupport libpq 72 ++ optional ipmiSupport openipmi; 73 74 configureFlags = [ 75 "--enable-ipv6" 76 "--enable-server" 77 "--with-iconv" 78 "--with-libcurl" 79 "--with-libevent" 80 "--with-libpcre" 81 "--with-libxml2" 82 "--with-openssl=${openssl.dev}" 83 "--with-zlib=${zlib}" 84 ] 85 ++ optional odbcSupport "--with-unixodbc" 86 ++ optional jabberSupport "--with-jabber" 87 ++ optional ldapSupport "--with-ldap=${openldap.dev}" 88 ++ optional snmpSupport "--with-net-snmp" 89 ++ optional sshSupport "--with-ssh2=${libssh2.dev}" 90 ++ optional mysqlSupport "--with-mysql" 91 ++ optional postgresqlSupport "--with-postgresql" 92 ++ optional ipmiSupport "--with-openipmi=${openipmi.dev}"; 93 94 prePatch = '' 95 find database -name data.sql -exec sed -i 's|/usr/bin/||g' {} + 96 ''; 97 98 preAutoreconf = '' 99 for i in $(find . -type f -name "*.m4"); do 100 substituteInPlace $i \ 101 --replace 'test -x "$PKG_CONFIG"' 'type -P "$PKG_CONFIG" >/dev/null' 102 done 103 ''; 104 105 postInstall = '' 106 mkdir -p $out/share/zabbix/database/ 107 cp -r include $out/ 108 '' 109 + optionalString mysqlSupport '' 110 mkdir -p $out/share/zabbix/database/mysql 111 cp -prvd database/mysql/*.sql $out/share/zabbix/database/mysql/ 112 '' 113 + optionalString postgresqlSupport '' 114 mkdir -p $out/share/zabbix/database/postgresql 115 cp -prvd database/postgresql/*.sql $out/share/zabbix/database/postgresql/ 116 ''; 117 118 meta = { 119 description = "Enterprise-class open source distributed monitoring solution"; 120 homepage = "https://www.zabbix.com/"; 121 license = 122 if (lib.versions.major version >= "7") then lib.licenses.agpl3Only else lib.licenses.gpl2Plus; 123 maintainers = with lib.maintainers; [ 124 bstanderline 125 mmahut 126 psyanticy 127 ]; 128 platforms = lib.platforms.linux; 129 }; 130 } 131)