mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
nixos/netdata: add configDir option
This option makes the complete netdata configuration directory available for modification. The default configuration is merged with changes defined in the configDir option. Co-authored-by: Michael Raitza <spacefrogg-github@meterriblecrew.net>
This commit is contained in:
parent
0ecf7d4148
commit
9e6145c73b
1 changed files with 30 additions and 1 deletions
|
@ -19,8 +19,17 @@ let
|
||||||
"${wrappedPlugins}/libexec/netdata/plugins.d"
|
"${wrappedPlugins}/libexec/netdata/plugins.d"
|
||||||
] ++ cfg.extraPluginPaths;
|
] ++ cfg.extraPluginPaths;
|
||||||
|
|
||||||
|
configDirectory = pkgs.runCommand "netdata-config-d" { } ''
|
||||||
|
mkdir $out
|
||||||
|
${concatStringsSep "\n" (mapAttrsToList (path: file: ''
|
||||||
|
mkdir -p "$out/$(dirname ${path})"
|
||||||
|
ln -s "${file}" "$out/${path}"
|
||||||
|
'') cfg.configDir)}
|
||||||
|
'';
|
||||||
|
|
||||||
localConfig = {
|
localConfig = {
|
||||||
global = {
|
global = {
|
||||||
|
"config directory" = configDirectory;
|
||||||
"plugins directory" = concatStringsSep " " plugins;
|
"plugins directory" = concatStringsSep " " plugins;
|
||||||
};
|
};
|
||||||
web = {
|
web = {
|
||||||
|
@ -130,6 +139,26 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
configDir = mkOption {
|
||||||
|
type = types.attrsOf types.path;
|
||||||
|
default = {};
|
||||||
|
description = ''
|
||||||
|
Complete netdata config directory except netdata.conf.
|
||||||
|
The default configuration is merged with changes
|
||||||
|
defined in this option.
|
||||||
|
Each top-level attribute denotes a path in the configuration
|
||||||
|
directory as in environment.etc.
|
||||||
|
Its value is the absolute path and must be readable by netdata.
|
||||||
|
Cannot be combined with configText.
|
||||||
|
'';
|
||||||
|
example = literalExpression ''
|
||||||
|
"health_alarm_notify.conf" = pkgs.writeText "health_alarm_notify.conf" '''
|
||||||
|
sendmail="/path/to/sendmail"
|
||||||
|
''';
|
||||||
|
"health.d" = "/run/secrets/netdata/health.d";
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
enableAnalyticsReporting = mkOption {
|
enableAnalyticsReporting = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
@ -154,7 +183,7 @@ in {
|
||||||
description = "Real time performance monitoring";
|
description = "Real time performance monitoring";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
path = (with pkgs; [ curl gawk iproute2 which ])
|
path = (with pkgs; [ curl gawk iproute2 which procps ])
|
||||||
++ lib.optional cfg.python.enable (pkgs.python3.withPackages cfg.python.extraPackages)
|
++ lib.optional cfg.python.enable (pkgs.python3.withPackages cfg.python.extraPackages)
|
||||||
++ lib.optional config.virtualisation.libvirtd.enable (config.virtualisation.libvirtd.package);
|
++ lib.optional config.virtualisation.libvirtd.enable (config.virtualisation.libvirtd.package);
|
||||||
environment = {
|
environment = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue