summary refs log tree commit diff
path: root/pkgs/tools/system/collectd/default.nix
blob: 3e7e4e5969ab3f2cb539b64a22f18a1736409997 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
{ stdenv, fetchurl, fetchpatch, darwin
, autoreconfHook
, pkgconfig
, curl
, iptables
, jdk
, libapparmor
, libatasmart
, libcap_ng
, libcredis
, libdbi
, libgcrypt
, libmemcached, cyrus_sasl
, libmicrohttpd
, libmodbus
, libnotify, gdk-pixbuf
, liboping
, libpcap
, libsigrok
, libvirt
, libxml2
, libtool
, lm_sensors
, lvm2
, libmysqlclient
, numactl
, postgresql
, protobufc
, python
, rabbitmq-c
, riemann_c_client
, rrdtool
, udev
, varnish
, yajl
, net_snmp
, hiredis
, libmnl
, mosquitto
, rdkafka
, mongoc
}:
stdenv.mkDerivation rec {
  version = "5.8.1";
  pname = "collectd";

  src = fetchurl {
    url = "https://collectd.org/files/${pname}-${version}.tar.bz2";
    sha256 = "1njk8hh56gb755xafsh7ahmqr9k2d4lam4ddj7s7fqz0gjigv5p7";
  };

  patches = [
    (fetchpatch {
      url = "https://github.com/rpv-tomsk/collectd/commit/d5a3c020d33cc33ee8049f54c7b4dffcd123bf83.patch";
      sha256 = "1n65zw4d2k2bxapayaaw51ym7hy72a0cwi2abd8jgxcw3d0m5g15";
    })
  ];

  nativeBuildInputs = [ pkgconfig autoreconfHook ];
  buildInputs = [
    curl libdbi libgcrypt libmemcached
    cyrus_sasl libnotify gdk-pixbuf liboping libpcap libvirt
    libxml2 postgresql protobufc rrdtool
    varnish yajl jdk libtool python hiredis libmicrohttpd
    riemann_c_client mosquitto rdkafka mongoc
  ] ++ stdenv.lib.optionals (libmysqlclient != null) [ libmysqlclient
  ] ++ stdenv.lib.optionals stdenv.isLinux [
    iptables libatasmart libcredis libmodbus libsigrok
    lm_sensors lvm2 rabbitmq-c udev net_snmp libmnl
    # those might be no longer required when https://github.com/NixOS/nixpkgs/pull/51767
    # is merged
    libapparmor numactl libcap_ng
  ] ++ stdenv.lib.optionals stdenv.isDarwin [
    darwin.apple_sdk.frameworks.IOKit
    darwin.apple_sdk.frameworks.ApplicationServices
  ];

  configureFlags = [
    "--localstatedir=/var"
    "--disable-werror"
  ];

  # do not create directories in /var during installPhase
  postConfigure = ''
     substituteInPlace Makefile --replace '$(mkinstalldirs) $(DESTDIR)$(localstatedir)/' '#'
  '';

  postInstall = ''
    if [ -d $out/share/collectd/java ]; then
      mv $out/share/collectd/java $out/share/
    fi
  '';

  enableParallelBuilding = true;

  meta = with stdenv.lib; {
    description = "Daemon which collects system performance statistics periodically";
    homepage = https://collectd.org;
    license = licenses.gpl2;
    platforms = platforms.unix;
    maintainers = with maintainers; [ bjornfor fpletz ];
  };
}