1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 callPackage,
7 autoreconfHook,
8 pkg-config,
9 libtool,
10 bison,
11 flex,
12 perl,
13 nixosTests,
14 ...
15}@args:
16let
17 plugins = callPackage ./plugins.nix args;
18in
19stdenv.mkDerivation (finalAttrs: {
20 pname = "collectd";
21 version = "5.12.0";
22
23 src = fetchFromGitHub {
24 owner = "collectd";
25 repo = "collectd";
26 tag = "collectd-${finalAttrs.version}";
27 hash = "sha256-UTlCY1GPRpbdQFLFUDjNr1PgEdGv4WNtjr8TYbxHK5A=";
28 };
29
30 # All of these are going to be included in the next release
31 patches = [
32 # fix -t never printing syntax errors
33 # should be included in next release
34 (fetchpatch {
35 name = "fix-broken-dash-t-option.patch";
36 url = "https://github.com/collectd/collectd/commit/3f575419e7ccb37a3b10ecc82adb2e83ff2826e1.patch";
37 hash = "sha256-XkDxLITmG0FLpgf8Ut1bDqulM4DmPs8Xrec2QB1tkks=";
38 })
39 (fetchpatch {
40 name = "no_include_longintrepr.patch";
41 url = "https://github.com/collectd/collectd/commit/623e95394e0e62e7f9ced2104b786d21e9c0bf53.patch";
42 hash = "sha256-0eD7yNW3TWVyNMpLsADhYFDvy6COoCaI0kS1XJrwDgM=";
43 })
44 ];
45
46 nativeBuildInputs = [
47 pkg-config
48 autoreconfHook
49 bison
50 flex
51 perl # for pod2man
52 ];
53
54 buildInputs = [
55 libtool
56 ]
57 ++ plugins.buildInputs;
58
59 configureFlags = [
60 "--localstatedir=/var"
61 "--disable-werror"
62 ]
63 ++ plugins.configureFlags
64 ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ "--with-fp-layout=nothing" ];
65
66 # Used in `src/virt.c`
67 env.NIX_CFLAGS_COMPILE = "-DATTRIBUTE_UNUSED=__attribute__((unused))";
68
69 # do not create directories in /var during installPhase
70 postConfigure = ''
71 substituteInPlace Makefile --replace-fail '$(mkinstalldirs) $(DESTDIR)$(localstatedir)/' '#'
72 '';
73
74 postInstall = ''
75 if [ -d $out/share/collectd/java ]; then
76 mv $out/share/collectd/java $out/share/
77 fi
78 '';
79
80 enableParallelBuilding = true;
81
82 passthru.tests = {
83 inherit (nixosTests) collectd;
84 };
85
86 meta = {
87 description = "Daemon which collects system performance statistics periodically";
88 homepage = "https://collectd.org";
89 license = lib.licenses.gpl2Plus;
90 platforms = lib.platforms.unix;
91 maintainers = with lib.maintainers; [ bjornfor ];
92 };
93})