2021-06-20 15:59:34 +00:00
|
|
|
{ lib, stdenv, callPackage, fetchFromGitHub, autoreconfHook, pkg-config, makeWrapper
|
2019-07-03 10:49:29 +00:00
|
|
|
, CoreFoundation, IOKit, libossp_uuid
|
2020-08-28 08:49:26 +00:00
|
|
|
, nixosTests
|
2022-02-22 11:35:57 +00:00
|
|
|
, curl, libcap, libuuid, lm_sensors, zlib, protobuf
|
2019-07-03 10:49:29 +00:00
|
|
|
, withCups ? false, cups
|
|
|
|
, withDBengine ? true, libuv, lz4, judy
|
|
|
|
, withIpmi ? (!stdenv.isDarwin), freeipmi
|
|
|
|
, withNetfilter ? (!stdenv.isDarwin), libmnl, libnetfilter_acct
|
2021-05-21 17:20:17 +00:00
|
|
|
, withCloud ? (!stdenv.isDarwin), json_c
|
2019-07-03 10:49:29 +00:00
|
|
|
, withSsl ? true, openssl
|
2019-07-04 10:08:11 +00:00
|
|
|
, withDebug ? false
|
2019-07-03 10:49:29 +00:00
|
|
|
}:
|
2016-04-14 21:43:01 +00:00
|
|
|
|
2021-01-15 09:19:50 +00:00
|
|
|
with lib;
|
2019-07-03 10:49:29 +00:00
|
|
|
|
2020-02-22 07:45:50 +00:00
|
|
|
let
|
|
|
|
go-d-plugin = callPackage ./go.d.plugin.nix {};
|
|
|
|
in stdenv.mkDerivation rec {
|
2022-05-24 11:23:19 +00:00
|
|
|
version = "1.34.1";
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "netdata";
|
2016-04-14 21:43:01 +00:00
|
|
|
|
2019-12-07 21:04:30 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "netdata";
|
|
|
|
repo = "netdata";
|
|
|
|
rev = "v${version}";
|
2022-05-24 11:23:19 +00:00
|
|
|
sha256 = "sha256-MGXHIbmoPRyjjYHV/RD9sd8Dn74YVlET2V3d/wJ3blo=";
|
2021-05-19 17:35:24 +00:00
|
|
|
fetchSubmodules = true;
|
2016-04-14 21:43:01 +00:00
|
|
|
};
|
|
|
|
|
2022-05-05 14:38:28 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ autoreconfHook pkg-config makeWrapper protobuf ];
|
2022-02-22 11:35:57 +00:00
|
|
|
buildInputs = [ curl.dev zlib.dev protobuf ]
|
2019-07-03 10:49:29 +00:00
|
|
|
++ 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 ]
|
2021-05-21 17:20:17 +00:00
|
|
|
++ optionals withCloud [ json_c ]
|
2019-07-03 10:49:29 +00:00
|
|
|
++ optionals withSsl [ openssl.dev ];
|
2016-04-14 21:43:01 +00:00
|
|
|
|
2018-10-12 08:53:36 +00:00
|
|
|
patches = [
|
2021-02-20 10:32:52 +00:00
|
|
|
# required to prevent plugins from relying on /etc
|
|
|
|
# and /var
|
2018-10-12 08:53:36 +00:00
|
|
|
./no-files-in-etc-and-var.patch
|
2021-07-01 05:24:30 +00:00
|
|
|
# The current IPC location is unsafe as it writes
|
|
|
|
# a fixed path in /tmp, which is world-writable.
|
|
|
|
# Therefore we put it into `/run/netdata`, which is owned
|
|
|
|
# by netdata only.
|
|
|
|
./ipc-socket-in-run.patch
|
2018-10-12 08:53:36 +00:00
|
|
|
];
|
2016-10-25 14:23:19 +00:00
|
|
|
|
2019-10-30 11:34:47 +00:00
|
|
|
NIX_CFLAGS_COMPILE = optionalString withDebug "-O1 -ggdb -DNETDATA_INTERNAL_CHECKS=1";
|
2019-07-04 10:08:11 +00:00
|
|
|
|
2020-02-22 07:45:50 +00:00
|
|
|
postInstall = ''
|
2020-04-14 09:20:00 +00: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 07:45:50 +00:00
|
|
|
'' + optionalString (!stdenv.isDarwin) ''
|
2018-10-12 08:57:45 +00:00
|
|
|
# rename this plugin so netdata will look for setuid wrapper
|
|
|
|
mv $out/libexec/netdata/plugins.d/apps.plugin \
|
2019-06-26 17:38:01 +00:00
|
|
|
$out/libexec/netdata/plugins.d/apps.plugin.org
|
2021-05-10 06:57:52 +00:00
|
|
|
mv $out/libexec/netdata/plugins.d/cgroup-network \
|
|
|
|
$out/libexec/netdata/plugins.d/cgroup-network.org
|
2020-03-23 09:23:50 +00:00
|
|
|
mv $out/libexec/netdata/plugins.d/perf.plugin \
|
|
|
|
$out/libexec/netdata/plugins.d/perf.plugin.org
|
2020-03-23 07:27:29 +00:00
|
|
|
mv $out/libexec/netdata/plugins.d/slabinfo.plugin \
|
|
|
|
$out/libexec/netdata/plugins.d/slabinfo.plugin.org
|
2019-07-04 09:09:54 +00:00
|
|
|
${optionalString withIpmi ''
|
|
|
|
mv $out/libexec/netdata/plugins.d/freeipmi.plugin \
|
|
|
|
$out/libexec/netdata/plugins.d/freeipmi.plugin.org
|
|
|
|
''}
|
2018-10-12 08:57:45 +00:00
|
|
|
'';
|
|
|
|
|
2020-03-23 07:27:29 +00:00
|
|
|
preConfigure = optionalString (!stdenv.isDarwin) ''
|
2019-03-07 21:01:48 +00: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 14:23:19 +00:00
|
|
|
configureFlags = [
|
|
|
|
"--localstatedir=/var"
|
2018-10-12 08:53:36 +00:00
|
|
|
"--sysconfdir=/etc"
|
2022-05-05 14:38:28 +00:00
|
|
|
"--disable-ebpf"
|
2021-05-21 17:20:17 +00:00
|
|
|
] ++ optionals withCloud [
|
2021-05-19 17:35:24 +00:00
|
|
|
"--enable-cloud"
|
|
|
|
"--with-aclk-ng"
|
2016-10-25 14:23:19 +00:00
|
|
|
];
|
|
|
|
|
2018-11-14 16:01:41 +00:00
|
|
|
postFixup = ''
|
2021-06-20 15:59:34 +00:00
|
|
|
wrapProgram $out/bin/netdata-claim.sh --prefix PATH : ${lib.makeBinPath [ openssl ]}
|
2016-10-14 10:05:42 +00:00
|
|
|
'';
|
2016-04-17 09:15:59 +00:00
|
|
|
|
2021-09-19 16:15:02 +00:00
|
|
|
passthru = {
|
|
|
|
inherit withIpmi;
|
|
|
|
tests.netdata = nixosTests.netdata;
|
|
|
|
};
|
2020-08-28 08:49:26 +00:00
|
|
|
|
2019-07-03 10:49:29 +00:00
|
|
|
meta = {
|
2016-04-14 21:43:01 +00:00
|
|
|
description = "Real-time performance monitoring tool";
|
2020-09-15 09:08:37 +00:00
|
|
|
homepage = "https://www.netdata.cloud/";
|
2021-02-20 10:32:52 +00:00
|
|
|
license = licenses.gpl3Plus;
|
2018-11-14 16:01:41 +00:00
|
|
|
platforms = platforms.unix;
|
2021-05-07 13:35:21 +00:00
|
|
|
maintainers = [ ];
|
2016-04-14 21:43:01 +00:00
|
|
|
};
|
|
|
|
}
|