zabbix: format

Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
This commit is contained in:
2024-08-04 12:57:21 +02:00
parent f64a039ae7
commit 1dc72b93ee
5 changed files with 201 additions and 95 deletions

View File

@@ -1,6 +1,15 @@
{ lib, stdenv, fetchurl, pkg-config, libiconv, openssl, pcre }: {
lib,
stdenv,
fetchurl,
pkg-config,
libiconv,
openssl,
pcre,
}:
import ./versions.nix ({ version, hash, ... }: import ./versions.nix (
{ version, hash, ... }:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "zabbix-agent"; pname = "zabbix-agent";
inherit version; inherit version;
@@ -36,8 +45,13 @@ import ./versions.nix ({ version, hash, ... }:
meta = { meta = {
description = "Enterprise-class open source distributed monitoring solution (client-side agent)"; description = "Enterprise-class open source distributed monitoring solution (client-side agent)";
homepage = "https://www.zabbix.com/"; homepage = "https://www.zabbix.com/";
license = if (lib.versions.major version >= "7") then lib.licenses.agpl3Only else lib.licenses.gpl2Plus; license =
maintainers = with lib.maintainers; [ mmahut psyanticy ]; if (lib.versions.major version >= "7") then lib.licenses.agpl3Only else lib.licenses.gpl2Plus;
maintainers = with lib.maintainers; [
mmahut
psyanticy
];
platforms = lib.platforms.linux; platforms = lib.platforms.linux;
}; };
}) }
)

View File

@@ -1,6 +1,22 @@
{ lib, buildGoModule, fetchurl, autoreconfHook, pkg-config, libiconv, openssl, pcre, zlib }: {
lib,
buildGoModule,
fetchurl,
autoreconfHook,
pkg-config,
libiconv,
openssl,
pcre,
zlib,
}:
import ./versions.nix ({ version, hash, vendorHash ? throw "unsupported version ${version} for zabbix-agent2", ... }: import ./versions.nix (
{
version,
hash,
vendorHash ? throw "unsupported version ${version} for zabbix-agent2",
...
}:
buildGoModule { buildGoModule {
pname = "zabbix-agent2"; pname = "zabbix-agent2";
inherit version; inherit version;
@@ -14,8 +30,16 @@ import ./versions.nix ({ version, hash, vendorHash ? throw "unsupported version
inherit vendorHash; inherit vendorHash;
nativeBuildInputs = [ autoreconfHook pkg-config ]; nativeBuildInputs = [
buildInputs = [ libiconv openssl pcre zlib ]; autoreconfHook
pkg-config
];
buildInputs = [
libiconv
openssl
pcre
zlib
];
inherit (buildGoModule.go) GOOS GOARCH; inherit (buildGoModule.go) GOOS GOARCH;
@@ -59,8 +83,10 @@ import ./versions.nix ({ version, hash, vendorHash ? throw "unsupported version
meta = { meta = {
description = "Enterprise-class open source distributed monitoring solution (client-side agent)"; description = "Enterprise-class open source distributed monitoring solution (client-side agent)";
homepage = "https://www.zabbix.com/"; homepage = "https://www.zabbix.com/";
license = if (lib.versions.major version >= "7") then lib.licenses.agpl3Only else lib.licenses.gpl2Plus; license =
if (lib.versions.major version >= "7") then lib.licenses.agpl3Only else lib.licenses.gpl2Plus;
maintainers = with lib.maintainers; [ aanderse ]; maintainers = with lib.maintainers; [ aanderse ];
platforms = lib.platforms.linux; platforms = lib.platforms.linux;
}; };
}) }
)

View File

@@ -1,10 +1,25 @@
{ lib, stdenv, fetchurl, pkg-config, libevent, libiconv, openssl, pcre, zlib {
, odbcSupport ? true, unixODBC lib,
, snmpSupport ? stdenv.buildPlatform == stdenv.hostPlatform, net-snmp stdenv,
, sshSupport ? true, libssh2 fetchurl,
, sqliteSupport ? false, sqlite pkg-config,
, mysqlSupport ? false, libmysqlclient libevent,
, postgresqlSupport ? false, postgresql libiconv,
openssl,
pcre,
zlib,
odbcSupport ? true,
unixODBC,
snmpSupport ? stdenv.buildPlatform == stdenv.hostPlatform,
net-snmp,
sshSupport ? true,
libssh2,
sqliteSupport ? false,
sqlite,
mysqlSupport ? false,
libmysqlclient,
postgresqlSupport ? false,
postgresql,
}: }:
# ensure exactly one database type is selected # ensure exactly one database type is selected
@@ -15,18 +30,20 @@ assert sqliteSupport -> !mysqlSupport && !postgresqlSupport;
let let
inherit (lib) optional optionalString; inherit (lib) optional optionalString;
in in
import ./versions.nix ({ version, hash, ... }: import ./versions.nix (
stdenv.mkDerivation { { version, hash, ... }:
pname = "zabbix-proxy"; stdenv.mkDerivation {
inherit version; pname = "zabbix-proxy";
inherit version;
src = fetchurl { src = fetchurl {
url = "https://cdn.zabbix.com/zabbix/sources/stable/${lib.versions.majorMinor version}/zabbix-${version}.tar.gz"; url = "https://cdn.zabbix.com/zabbix/sources/stable/${lib.versions.majorMinor version}/zabbix-${version}.tar.gz";
inherit hash; inherit hash;
}; };
nativeBuildInputs = [ pkg-config ]; nativeBuildInputs = [ pkg-config ];
buildInputs = [ buildInputs =
[
libevent libevent
libiconv libiconv
openssl openssl
@@ -40,7 +57,8 @@ in
++ optional mysqlSupport libmysqlclient ++ optional mysqlSupport libmysqlclient
++ optional postgresqlSupport postgresql; ++ optional postgresqlSupport postgresql;
configureFlags = [ configureFlags =
[
"--enable-ipv6" "--enable-ipv6"
"--enable-proxy" "--enable-proxy"
"--with-iconv" "--with-iconv"
@@ -56,33 +74,39 @@ in
++ optional mysqlSupport "--with-mysql" ++ optional mysqlSupport "--with-mysql"
++ optional postgresqlSupport "--with-postgresql"; ++ optional postgresqlSupport "--with-postgresql";
prePatch = '' prePatch = ''
find database -name data.sql -exec sed -i 's|/usr/bin/||g' {} + find database -name data.sql -exec sed -i 's|/usr/bin/||g' {} +
''; '';
makeFlags = [ makeFlags = [
"AR:=$(AR)" "AR:=$(AR)"
"RANLIB:=$(RANLIB)" "RANLIB:=$(RANLIB)"
]; ];
postInstall = '' postInstall =
''
mkdir -p $out/share/zabbix/database/ mkdir -p $out/share/zabbix/database/
'' + optionalString sqliteSupport '' ''
+ optionalString sqliteSupport ''
mkdir -p $out/share/zabbix/database/sqlite3 mkdir -p $out/share/zabbix/database/sqlite3
cp -prvd database/sqlite3/schema.sql $out/share/zabbix/database/sqlite3/ cp -prvd database/sqlite3/schema.sql $out/share/zabbix/database/sqlite3/
'' + optionalString mysqlSupport '' ''
+ optionalString mysqlSupport ''
mkdir -p $out/share/zabbix/database/mysql mkdir -p $out/share/zabbix/database/mysql
cp -prvd database/mysql/schema.sql $out/share/zabbix/database/mysql/ cp -prvd database/mysql/schema.sql $out/share/zabbix/database/mysql/
'' + optionalString postgresqlSupport '' ''
+ optionalString postgresqlSupport ''
mkdir -p $out/share/zabbix/database/postgresql mkdir -p $out/share/zabbix/database/postgresql
cp -prvd database/postgresql/schema.sql $out/share/zabbix/database/postgresql/ cp -prvd database/postgresql/schema.sql $out/share/zabbix/database/postgresql/
''; '';
meta = { meta = {
description = "Enterprise-class open source distributed monitoring solution (client-server proxy)"; description = "Enterprise-class open source distributed monitoring solution (client-server proxy)";
homepage = "https://www.zabbix.com/"; homepage = "https://www.zabbix.com/";
license = if (lib.versions.major version >= "7") then lib.licenses.agpl3Only else lib.licenses.gpl2Plus; license =
maintainers = with lib.maintainers; [ mmahut ]; if (lib.versions.major version >= "7") then lib.licenses.agpl3Only else lib.licenses.gpl2Plus;
platforms = lib.platforms.linux; maintainers = with lib.maintainers; [ mmahut ];
}; platforms = lib.platforms.linux;
}) };
}
)

View File

@@ -1,12 +1,32 @@
{ lib, stdenv, fetchurl, autoreconfHook, pkg-config, curl, libevent, libiconv, libxml2, openssl, pcre, zlib {
, jabberSupport ? true, iksemel lib,
, ldapSupport ? true, openldap stdenv,
, odbcSupport ? true, unixODBC fetchurl,
, snmpSupport ? true, net-snmp autoreconfHook,
, sshSupport ? true, libssh2 pkg-config,
, mysqlSupport ? false, libmysqlclient curl,
, postgresqlSupport ? false, postgresql libevent,
, ipmiSupport ? false, openipmi 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 # ensure exactly one primary database type is selected
@@ -16,18 +36,23 @@ assert postgresqlSupport -> !mysqlSupport;
let let
inherit (lib) optional optionalString; inherit (lib) optional optionalString;
in in
import ./versions.nix ({ version, hash, ... }: import ./versions.nix (
stdenv.mkDerivation { { version, hash, ... }:
pname = "zabbix-server"; stdenv.mkDerivation {
inherit version; pname = "zabbix-server";
inherit version;
src = fetchurl { src = fetchurl {
url = "https://cdn.zabbix.com/zabbix/sources/stable/${lib.versions.majorMinor version}/zabbix-${version}.tar.gz"; url = "https://cdn.zabbix.com/zabbix/sources/stable/${lib.versions.majorMinor version}/zabbix-${version}.tar.gz";
inherit hash; inherit hash;
}; };
nativeBuildInputs = [ autoreconfHook pkg-config ]; nativeBuildInputs = [
buildInputs = [ autoreconfHook
pkg-config
];
buildInputs =
[
curl curl
libevent libevent
libiconv libiconv
@@ -45,7 +70,8 @@ in
++ optional postgresqlSupport postgresql ++ optional postgresqlSupport postgresql
++ optional ipmiSupport openipmi; ++ optional ipmiSupport openipmi;
configureFlags = [ configureFlags =
[
"--enable-ipv6" "--enable-ipv6"
"--enable-server" "--enable-server"
"--with-iconv" "--with-iconv"
@@ -65,33 +91,41 @@ in
++ optional postgresqlSupport "--with-postgresql" ++ optional postgresqlSupport "--with-postgresql"
++ optional ipmiSupport "--with-openipmi=${openipmi.dev}"; ++ optional ipmiSupport "--with-openipmi=${openipmi.dev}";
prePatch = '' prePatch = ''
find database -name data.sql -exec sed -i 's|/usr/bin/||g' {} + find database -name data.sql -exec sed -i 's|/usr/bin/||g' {} +
''; '';
preAutoreconf = '' preAutoreconf = ''
for i in $(find . -type f -name "*.m4"); do for i in $(find . -type f -name "*.m4"); do
substituteInPlace $i \ substituteInPlace $i \
--replace 'test -x "$PKG_CONFIG"' 'type -P "$PKG_CONFIG" >/dev/null' --replace 'test -x "$PKG_CONFIG"' 'type -P "$PKG_CONFIG" >/dev/null'
done done
''; '';
postInstall = '' postInstall =
''
mkdir -p $out/share/zabbix/database/ mkdir -p $out/share/zabbix/database/
cp -r include $out/ cp -r include $out/
'' + optionalString mysqlSupport '' ''
+ optionalString mysqlSupport ''
mkdir -p $out/share/zabbix/database/mysql mkdir -p $out/share/zabbix/database/mysql
cp -prvd database/mysql/*.sql $out/share/zabbix/database/mysql/ cp -prvd database/mysql/*.sql $out/share/zabbix/database/mysql/
'' + optionalString postgresqlSupport '' ''
+ optionalString postgresqlSupport ''
mkdir -p $out/share/zabbix/database/postgresql mkdir -p $out/share/zabbix/database/postgresql
cp -prvd database/postgresql/*.sql $out/share/zabbix/database/postgresql/ cp -prvd database/postgresql/*.sql $out/share/zabbix/database/postgresql/
''; '';
meta = { meta = {
description = "Enterprise-class open source distributed monitoring solution"; description = "Enterprise-class open source distributed monitoring solution";
homepage = "https://www.zabbix.com/"; homepage = "https://www.zabbix.com/";
license = if (lib.versions.major version >= "7") then lib.licenses.agpl3Only else lib.licenses.gpl2Plus; license =
maintainers = with lib.maintainers; [ mmahut psyanticy ]; if (lib.versions.major version >= "7") then lib.licenses.agpl3Only else lib.licenses.gpl2Plus;
platforms = lib.platforms.linux; maintainers = with lib.maintainers; [
}; mmahut
}) psyanticy
];
platforms = lib.platforms.linux;
};
}
)

View File

@@ -1,6 +1,12 @@
{ lib, stdenv, fetchurl, writeText }: {
lib,
stdenv,
fetchurl,
writeText,
}:
import ./versions.nix ({ version, hash, ... }: import ./versions.nix (
{ version, hash, ... }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "zabbix-web"; pname = "zabbix-web";
inherit version; inherit version;
@@ -11,9 +17,9 @@ import ./versions.nix ({ version, hash, ... }:
}; };
phpConfig = writeText "zabbix.conf.php" '' phpConfig = writeText "zabbix.conf.php" ''
<?php <?php
return require(getenv('ZABBIX_CONFIG')); return require(getenv('ZABBIX_CONFIG'));
?> ?>
''; '';
installPhase = '' installPhase = ''
@@ -25,8 +31,10 @@ import ./versions.nix ({ version, hash, ... }:
meta = { meta = {
description = "Enterprise-class open source distributed monitoring solution (web frontend)"; description = "Enterprise-class open source distributed monitoring solution (web frontend)";
homepage = "https://www.zabbix.com/"; homepage = "https://www.zabbix.com/";
license = if (lib.versions.major version >= "7") then lib.licenses.agpl3Only else lib.licenses.gpl2Plus; license =
if (lib.versions.major version >= "7") then lib.licenses.agpl3Only else lib.licenses.gpl2Plus;
maintainers = with lib.maintainers; [ mmahut ]; maintainers = with lib.maintainers; [ mmahut ];
platforms = lib.platforms.linux; platforms = lib.platforms.linux;
}; };
}) }
)