From 348b7b8be9eff6e16642e659f24c743520b68bac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 12 Oct 2018 09:57:45 +0100 Subject: [PATCH] nixos/netdata: own plugins must the looked up first Otherwise netdata will not find python modules. To make sure netdata still pick up our setuid version of apps.plugin we rename the original executable. --- nixos/modules/services/monitoring/netdata.nix | 4 ++-- pkgs/tools/system/netdata/default.nix | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/monitoring/netdata.nix b/nixos/modules/services/monitoring/netdata.nix index edcaa10d969..7f21beeb133 100644 --- a/nixos/modules/services/monitoring/netdata.nix +++ b/nixos/modules/services/monitoring/netdata.nix @@ -12,7 +12,7 @@ let localConfig = { global = { - "plugins directory" = "${wrappedPlugins}/libexec/netdata/plugins.d ${pkgs.netdata}/libexec/netdata/plugins.d"; + "plugins directory" = "${pkgs.netdata}/libexec/netdata/plugins.d ${wrappedPlugins}/libexec/netdata/plugins.d"; }; web = { "web files owner" = "root"; @@ -96,7 +96,7 @@ in { }; security.wrappers."apps.plugin" = { - source = "${pkgs.netdata}/libexec/netdata/plugins.d/apps.plugin"; + source = "${pkgs.netdata}/libexec/netdata/plugins.d/apps.plugin.org"; capabilities = "cap_dac_read_search,cap_sys_ptrace+ep"; owner = cfg.user; group = cfg.group; diff --git a/pkgs/tools/system/netdata/default.nix b/pkgs/tools/system/netdata/default.nix index 03249cce82b..97a250f79d8 100644 --- a/pkgs/tools/system/netdata/default.nix +++ b/pkgs/tools/system/netdata/default.nix @@ -17,6 +17,12 @@ stdenv.mkDerivation rec{ ./no-files-in-etc-and-var.patch ]; + postInstall = stdenv.lib.optionalString (!stdenv.isDarwin) '' + # rename this plugin so netdata will look for setuid wrapper + mv $out/libexec/netdata/plugins.d/apps.plugin \ + $out/libexec/netdata/plugins.d/apps.plugin.org + ''; + configureFlags = [ "--localstatedir=/var" "--sysconfdir=/etc"