2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, callPackage, fetchFromGitHub, autoreconfHook, pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
, CoreFoundation, IOKit, libossp_uuid
|
2021-02-22 21:28:39 +00:00
|
|
|
, curl, libcap, libuuid, lm_sensors, zlib
|
2020-09-25 04:45:31 +00:00
|
|
|
, nixosTests
|
2020-04-24 23:36:52 +00:00
|
|
|
, withCups ? false, cups
|
|
|
|
, withDBengine ? true, libuv, lz4, judy
|
|
|
|
, withIpmi ? (!stdenv.isDarwin), freeipmi
|
|
|
|
, withNetfilter ? (!stdenv.isDarwin), libmnl, libnetfilter_acct
|
|
|
|
, withSsl ? true, openssl
|
|
|
|
, withDebug ? false
|
|
|
|
}:
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
with lib;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
go-d-plugin = callPackage ./go.d.plugin.nix {};
|
|
|
|
in stdenv.mkDerivation rec {
|
2021-03-09 03:18:52 +00:00
|
|
|
version = "1.29.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "netdata";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "netdata";
|
|
|
|
repo = "netdata";
|
|
|
|
rev = "v${version}";
|
2021-03-09 03:18:52 +00:00
|
|
|
sha256 = "sha256-GWIQZEC5agJ+Zw7l58IIAJhXP6dxirCmWVBJulzBO5Q=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook pkg-config ];
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [ curl.dev zlib.dev ]
|
|
|
|
++ optionals stdenv.isDarwin [ CoreFoundation IOKit libossp_uuid ]
|
|
|
|
++ optionals (!stdenv.isDarwin) [ libcap.dev libuuid.dev ]
|
|
|
|
++ optionals withCups [ cups ]
|
|
|
|
++ optionals withDBengine [ libuv lz4.dev judy ]
|
|
|
|
++ optionals withIpmi [ freeipmi ]
|
|
|
|
++ optionals withNetfilter [ libmnl libnetfilter_acct ]
|
|
|
|
++ optionals withSsl [ openssl.dev ];
|
|
|
|
|
|
|
|
patches = [
|
2021-02-22 21:28:39 +00:00
|
|
|
# required to prevent plugins from relying on /etc
|
|
|
|
# and /var
|
2020-04-24 23:36:52 +00:00
|
|
|
./no-files-in-etc-and-var.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
NIX_CFLAGS_COMPILE = optionalString withDebug "-O1 -ggdb -DNETDATA_INTERNAL_CHECKS=1";
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
ln -s ${go-d-plugin}/lib/netdata/conf.d/* $out/lib/netdata/conf.d
|
|
|
|
ln -s ${go-d-plugin}/bin/godplugin $out/libexec/netdata/plugins.d/go.d.plugin
|
|
|
|
'' + optionalString (!stdenv.isDarwin) ''
|
|
|
|
# rename this plugin so netdata will look for setuid wrapper
|
|
|
|
mv $out/libexec/netdata/plugins.d/apps.plugin \
|
|
|
|
$out/libexec/netdata/plugins.d/apps.plugin.org
|
|
|
|
mv $out/libexec/netdata/plugins.d/perf.plugin \
|
|
|
|
$out/libexec/netdata/plugins.d/perf.plugin.org
|
|
|
|
mv $out/libexec/netdata/plugins.d/slabinfo.plugin \
|
|
|
|
$out/libexec/netdata/plugins.d/slabinfo.plugin.org
|
|
|
|
${optionalString withIpmi ''
|
|
|
|
mv $out/libexec/netdata/plugins.d/freeipmi.plugin \
|
|
|
|
$out/libexec/netdata/plugins.d/freeipmi.plugin.org
|
|
|
|
''}
|
|
|
|
'';
|
|
|
|
|
|
|
|
preConfigure = optionalString (!stdenv.isDarwin) ''
|
|
|
|
substituteInPlace collectors/python.d.plugin/python_modules/third_party/lm_sensors.py \
|
|
|
|
--replace 'ctypes.util.find_library("sensors")' '"${lm_sensors.out}/lib/libsensors${stdenv.hostPlatform.extensions.sharedLibrary}"'
|
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--localstatedir=/var"
|
|
|
|
"--sysconfdir=/etc"
|
|
|
|
];
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
rm -r $out/sbin
|
|
|
|
'';
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
passthru.tests.netdata = nixosTests.netdata;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
|
|
|
description = "Real-time performance monitoring tool";
|
2020-09-25 04:45:31 +00:00
|
|
|
homepage = "https://www.netdata.cloud/";
|
2021-02-22 21:28:39 +00:00
|
|
|
license = licenses.gpl3Plus;
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = [ maintainers.lethalman ];
|
|
|
|
};
|
|
|
|
}
|