2021-01-17 10:17:16 +01:00
|
|
|
{ lib, stdenv, callPackage, fetchFromGitHub, autoreconfHook, pkg-config
|
2019-07-03 12:49:29 +02:00
|
|
|
, CoreFoundation, IOKit, libossp_uuid
|
2021-02-20 11:32:52 +01:00
|
|
|
, curl, libcap, libuuid, lm_sensors, zlib
|
2020-08-28 10:49:26 +02:00
|
|
|
, nixosTests
|
2019-07-03 12:49:29 +02:00
|
|
|
, withCups ? false, cups
|
|
|
|
, withDBengine ? true, libuv, lz4, judy
|
|
|
|
, withIpmi ? (!stdenv.isDarwin), freeipmi
|
|
|
|
, withNetfilter ? (!stdenv.isDarwin), libmnl, libnetfilter_acct
|
|
|
|
, withSsl ? true, openssl
|
2019-07-04 12:08:11 +02:00
|
|
|
, withDebug ? false
|
2021-05-05 19:45:22 +02:00
|
|
|
, fetchpatch
|
2019-07-03 12:49:29 +02:00
|
|
|
}:
|
2016-04-14 23:43:01 +02:00
|
|
|
|
2021-01-15 10:19:50 +01:00
|
|
|
with lib;
|
2019-07-03 12:49:29 +02:00
|
|
|
|
2020-02-22 08:45:50 +01:00
|
|
|
let
|
|
|
|
go-d-plugin = callPackage ./go.d.plugin.nix {};
|
|
|
|
in stdenv.mkDerivation rec {
|
2021-05-04 19:15:53 +02:00
|
|
|
version = "1.30.1";
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "netdata";
|
2016-04-14 23:43:01 +02:00
|
|
|
|
2019-12-07 22:04:30 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "netdata";
|
|
|
|
repo = "netdata";
|
|
|
|
rev = "v${version}";
|
2021-05-04 19:15:53 +02:00
|
|
|
sha256 = "0cp6gbn38f1cr0jkr64vvwz005cvnwj3hgfxs147wap9w228k46r";
|
2016-04-14 23:43:01 +02:00
|
|
|
};
|
|
|
|
|
2021-01-17 10:17:16 +01:00
|
|
|
nativeBuildInputs = [ autoreconfHook pkg-config ];
|
2019-07-03 12:49:29 +02: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 ];
|
2016-04-14 23:43:01 +02:00
|
|
|
|
2018-10-12 10:53:36 +02:00
|
|
|
patches = [
|
2021-02-20 11:32:52 +01:00
|
|
|
# required to prevent plugins from relying on /etc
|
|
|
|
# and /var
|
2018-10-12 10:53:36 +02:00
|
|
|
./no-files-in-etc-and-var.patch
|
2021-05-05 19:45:22 +02:00
|
|
|
# cgroups: fix network interfaces detection when using virsh
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://patch-diff.githubusercontent.com/raw/netdata/netdata/pull/11096.patch";
|
|
|
|
sha256 = "0f2rd7kgbwbyq9wyn085d213ifvivnpl3qlx1gjrg42rkbi4n8jj";
|
|
|
|
})
|
2018-10-12 10:53:36 +02:00
|
|
|
];
|
2016-10-25 16:23:19 +02:00
|
|
|
|
2019-10-30 12:34:47 +01:00
|
|
|
NIX_CFLAGS_COMPILE = optionalString withDebug "-O1 -ggdb -DNETDATA_INTERNAL_CHECKS=1";
|
2019-07-04 12:08:11 +02:00
|
|
|
|
2020-02-22 08:45:50 +01:00
|
|
|
postInstall = ''
|
2020-04-14 11:20:00 +02:00
|
|
|
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
|
2020-02-22 08:45:50 +01:00
|
|
|
'' + optionalString (!stdenv.isDarwin) ''
|
2018-10-12 10:57:45 +02:00
|
|
|
# rename this plugin so netdata will look for setuid wrapper
|
|
|
|
mv $out/libexec/netdata/plugins.d/apps.plugin \
|
2019-06-26 19:38:01 +02:00
|
|
|
$out/libexec/netdata/plugins.d/apps.plugin.org
|
2020-03-23 10:23:50 +01:00
|
|
|
mv $out/libexec/netdata/plugins.d/perf.plugin \
|
|
|
|
$out/libexec/netdata/plugins.d/perf.plugin.org
|
2020-03-23 08:27:29 +01:00
|
|
|
mv $out/libexec/netdata/plugins.d/slabinfo.plugin \
|
|
|
|
$out/libexec/netdata/plugins.d/slabinfo.plugin.org
|
2019-07-04 11:09:54 +02:00
|
|
|
${optionalString withIpmi ''
|
|
|
|
mv $out/libexec/netdata/plugins.d/freeipmi.plugin \
|
|
|
|
$out/libexec/netdata/plugins.d/freeipmi.plugin.org
|
|
|
|
''}
|
2018-10-12 10:57:45 +02:00
|
|
|
'';
|
|
|
|
|
2020-03-23 08:27:29 +01:00
|
|
|
preConfigure = optionalString (!stdenv.isDarwin) ''
|
2019-03-07 22:01:48 +01:00
|
|
|
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}"'
|
|
|
|
'';
|
|
|
|
|
2016-10-25 16:23:19 +02:00
|
|
|
configureFlags = [
|
|
|
|
"--localstatedir=/var"
|
2018-10-12 10:53:36 +02:00
|
|
|
"--sysconfdir=/etc"
|
2016-10-25 16:23:19 +02:00
|
|
|
];
|
|
|
|
|
2018-11-14 17:01:41 +01:00
|
|
|
postFixup = ''
|
|
|
|
rm -r $out/sbin
|
2016-10-14 12:05:42 +02:00
|
|
|
'';
|
2016-04-17 11:15:59 +02:00
|
|
|
|
2020-08-28 10:49:26 +02:00
|
|
|
passthru.tests.netdata = nixosTests.netdata;
|
|
|
|
|
2019-07-03 12:49:29 +02:00
|
|
|
meta = {
|
2016-04-14 23:43:01 +02:00
|
|
|
description = "Real-time performance monitoring tool";
|
2020-09-15 11:08:37 +02:00
|
|
|
homepage = "https://www.netdata.cloud/";
|
2021-02-20 11:32:52 +01:00
|
|
|
license = licenses.gpl3Plus;
|
2018-11-14 17:01:41 +01:00
|
|
|
platforms = platforms.unix;
|
2016-04-14 23:43:01 +02:00
|
|
|
maintainers = [ maintainers.lethalman ];
|
|
|
|
};
|
|
|
|
}
|