<commit_before>{ lib, stdenv, fetchurl, autoreconfHook, pkg-config, curl, libevent, libiconv, libxml2, openssl, pcre, zlib
, jabberSupport ? true, iksemel
, ldapSupport ? true, openldap
, odbcSupport ? true, unixODBC
, snmpSupport ? true, net-snmp
, sshSupport ? true, libssh2
, mysqlSupport ? false, libmysqlclient
, postgresqlSupport ? false, postgresql
}:

# ensure exactly one primary database type is selected
assert mysqlSupport -> !postgresqlSupport;
assert postgresqlSupport -> !mysqlSupport;

let
  inherit (lib) optional optionalString;
in
  import ./versions.nix ({ version, sha256 }:
    stdenv.mkDerivation {
      pname = "zabbix-server";
      inherit version;

      src = fetchurl {
        url = "https://cdn.zabbix.com/zabbix/sources/stable/${lib.versions.majorMinor version}/zabbix-${version}.tar.gz";
        inherit sha256;
      };

      nativeBuildInputs = [ autoreconfHook pkg-config ];
      buildInputs = [
        curl
        libevent
        libiconv
        libxml2
        openssl
        pcre
        zlib
      ]
      ++ optional odbcSupport unixODBC
      ++ optional jabberSupport iksemel
      ++ optional ldapSupport openldap
      ++ optional snmpSupport net-snmp
      ++ optional sshSupport libssh2
      ++ optional mysqlSupport libmysqlclient
      ++ optional postgresqlSupport postgresql;

      configureFlags = [
        "--enable-server"
        "--with-iconv"
        "--with-libcurl"
        "--with-libevent"
        "--with-libpcre"
        "--with-libxml2"
        "--with-openssl=${openssl.dev}"
        "--with-zlib=${zlib}"
      ]
      ++ optional odbcSupport "--with-unixodbc"
      ++ optional jabberSupport "--with-jabber"
      ++ optional ldapSupport "--with-ldap=${openldap.dev}"
      ++ optional snmpSupport "--with-net-snmp"
      ++ optional sshSupport "--with-ssh2=${libssh2.dev}"
      ++ optional mysqlSupport "--with-mysql"
      ++ optional postgresqlSupport "--with-postgresql";<commit_msg>zabbix: add IPMI support<commit_after>{ lib, stdenv, fetchurl, autoreconfHook, pkg-config, curl, libevent, libiconv, libxml2, openssl, pcre, zlib
, jabberSupport ? true, iksemel
, ldapSupport ? true, openldap
, odbcSupport ? true, unixODBC
, snmpSupport ? true, net-snmp
, sshSupport ? true, libssh2
, mysqlSupport ? false, libmysqlclient
, postgresqlSupport ? false, postgresql
, ipmiSupport ? false, openipmi
}:

# ensure exactly one primary database type is selected
assert mysqlSupport -> !postgresqlSupport;
assert postgresqlSupport -> !mysqlSupport;

let
  inherit (lib) optional optionalString;
in
  import ./versions.nix ({ version, sha256 }:
    stdenv.mkDerivation {
      pname = "zabbix-server";
      inherit version;

      src = fetchurl {
        url = "https://cdn.zabbix.com/zabbix/sources/stable/${lib.versions.majorMinor version}/zabbix-${version}.tar.gz";
        inherit sha256;
      };

      nativeBuildInputs = [ autoreconfHook pkg-config ];
      buildInputs = [
        curl
        libevent
        libiconv
        libxml2
        openssl
        pcre
        zlib
      ]
      ++ optional odbcSupport unixODBC
      ++ optional jabberSupport iksemel
      ++ optional ldapSupport openldap
      ++ optional snmpSupport net-snmp
      ++ optional sshSupport libssh2
      ++ optional mysqlSupport libmysqlclient
      ++ optional postgresqlSupport postgresql
      ++ optional ipmiSupport openipmi;

      configureFlags = [
        "--enable-server"
        "--with-iconv"
        "--with-libcurl"
        "--with-libevent"
        "--with-libpcre"
        "--with-libxml2"
        "--with-openssl=${openssl.dev}"
        "--with-zlib=${zlib}"
      ]
      ++ optional odbcSupport "--with-unixodbc"
      ++ optional jabberSupport "--with-jabber"
      ++ optional ldapSupport "--with-ldap=${openldap.dev}"
      ++ optional snmpSupport "--with-net-snmp"
      ++ optional sshSupport "--with-ssh2=${libssh2.dev}"
      ++ optional mysqlSupport "--with-mysql"
      ++ optional postgresqlSupport "--with-postgresql"
      ++ optional ipmiSupport "--with-openipmi=${openipmi.dev}";
{'fraction_non_alphanumeric': 0.11966650318783717, 'fraction_numerical': 0.0063756743501716525, 'mean_word_length': 2.6582959641255606, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '514947', 'n_tokens_mistral': 1274, 'n_tokens_neox': 1227, 'n_words': 275}