1 { lib, buildGoModule, fetchurl, autoreconfHook, pkg-config, libiconv, openssl, pcre, zlib }:
3 import ./versions.nix ({ version, hash, vendorHash ? throw "unsupported version ${version} for zabbix-agent2", ... }:
5 pname = "zabbix-agent2";
9 url = "https://cdn.zabbix.com/zabbix/sources/stable/${lib.versions.majorMinor version}/zabbix-${version}.tar.gz";
17 nativeBuildInputs = [ autoreconfHook pkg-config ];
18 buildInputs = [ libiconv openssl pcre zlib ];
20 inherit (buildGoModule.go) GOOS GOARCH;
22 # need to provide GO* env variables & patch for reproducibility
24 substituteInPlace src/go/Makefile.am \
25 --replace '`go env GOOS`' "$GOOS" \
26 --replace '`go env GOARCH`' "$GOARCH" \
27 --replace '`date +%H:%M:%S`' "00:00:00" \
28 --replace '`date +"%b %_d %Y"`' "Jan 1 1970"
31 # manually configure the c dependencies
34 --prefix=${placeholder "out"} \
39 --with-openssl=${openssl.dev}
42 # zabbix build process is complex to get right in nix...
43 # use automake to build the go project ensuring proper access to the go vendor directory
52 install -Dm0644 src/go/conf/zabbix_agent2.conf $out/etc/zabbix_agent2.conf
53 install -Dm0755 src/go/bin/zabbix_agent2 $out/bin/zabbix_agent2
55 # create a symlink which is compatible with the zabbixAgent module
56 ln -s $out/bin/zabbix_agent2 $out/sbin/zabbix_agentd
60 description = "Enterprise-class open source distributed monitoring solution (client-side agent)";
61 homepage = "https://www.zabbix.com/";
62 license = licenses.gpl2Plus;
63 maintainers = [ maintainers.aanderse ];
64 platforms = platforms.linux;