3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/tools/system/netdata/default.nix

87 lines
2.8 KiB
Nix
Raw Normal View History

{ lib, stdenv, callPackage, fetchFromGitHub, autoreconfHook, pkg-config
2019-07-03 11:49:29 +01:00
, CoreFoundation, IOKit, libossp_uuid
, curl, libcap, libuuid, lm_sensors, zlib
2020-08-28 09:49:26 +01:00
, nixosTests
2019-07-03 11:49:29 +01: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 11:08:11 +01:00
, withDebug ? false
2019-07-03 11:49:29 +01:00
}:
2016-04-14 22:43:01 +01:00
2021-01-15 09:19:50 +00:00
with lib;
2019-07-03 11:49:29 +01:00
2020-02-22 07:45:50 +00:00
let
go-d-plugin = callPackage ./go.d.plugin.nix {};
in stdenv.mkDerivation rec {
2021-02-25 13:22:59 +00:00
version = "1.29.3";
pname = "netdata";
2016-04-14 22:43:01 +01:00
2019-12-07 21:04:30 +00:00
src = fetchFromGitHub {
owner = "netdata";
repo = "netdata";
rev = "v${version}";
2021-02-25 13:22:59 +00:00
sha256 = "sha256-GWIQZEC5agJ+Zw7l58IIAJhXP6dxirCmWVBJulzBO5Q=";
2016-04-14 22:43:01 +01:00
};
nativeBuildInputs = [ autoreconfHook pkg-config ];
2019-07-03 11:49:29 +01: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 22:43:01 +01:00
patches = [
# required to prevent plugins from relying on /etc
# and /var
./no-files-in-etc-and-var.patch
];
2019-10-30 11:34:47 +00:00
NIX_CFLAGS_COMPILE = optionalString withDebug "-O1 -ggdb -DNETDATA_INTERNAL_CHECKS=1";
2019-07-04 11:08:11 +01:00
2020-02-22 07:45:50 +00:00
postInstall = ''
2020-04-14 10:20:00 +01: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) ''
# rename this plugin so netdata will look for setuid wrapper
mv $out/libexec/netdata/plugins.d/apps.plugin \
2019-06-26 18:38:01 +01:00
$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) ''
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}"'
'';
configureFlags = [
"--localstatedir=/var"
"--sysconfdir=/etc"
];
2018-11-14 16:01:41 +00:00
postFixup = ''
rm -r $out/sbin
2016-10-14 11:05:42 +01:00
'';
2020-08-28 09:49:26 +01:00
passthru.tests.netdata = nixosTests.netdata;
2019-07-03 11:49:29 +01:00
meta = {
2016-04-14 22:43:01 +01:00
description = "Real-time performance monitoring tool";
homepage = "https://www.netdata.cloud/";
license = licenses.gpl3Plus;
2018-11-14 16:01:41 +00:00
platforms = platforms.unix;
2016-04-14 22:43:01 +01:00
maintainers = [ maintainers.lethalman ];
};
}