nixos/collectd: add option buildMinimalPackage
This commit is contained in:
parent
efab039575
commit
06abd24886
|
@ -30,6 +30,15 @@ let
|
||||||
${cfg.extraConfig}
|
${cfg.extraConfig}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
package =
|
||||||
|
if cfg.buildMinimalPackage
|
||||||
|
then minimalPackage
|
||||||
|
else cfg.package;
|
||||||
|
|
||||||
|
minimalPackage = cfg.package.override {
|
||||||
|
enabledPlugins = [ "syslog" ] ++ builtins.attrNames cfg.plugins;
|
||||||
|
};
|
||||||
|
|
||||||
in {
|
in {
|
||||||
options.services.collectd = with types; {
|
options.services.collectd = with types; {
|
||||||
enable = mkEnableOption "collectd agent";
|
enable = mkEnableOption "collectd agent";
|
||||||
|
@ -40,7 +49,15 @@ in {
|
||||||
description = ''
|
description = ''
|
||||||
Which collectd package to use.
|
Which collectd package to use.
|
||||||
'';
|
'';
|
||||||
type = package;
|
type = types.package;
|
||||||
|
};
|
||||||
|
|
||||||
|
buildMinimalPackage = mkOption {
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Build a minimal collectd package with only the configured `services.collectd.plugins`
|
||||||
|
'';
|
||||||
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
user = mkOption {
|
user = mkOption {
|
||||||
|
@ -105,7 +122,7 @@ in {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${cfg.package}/sbin/collectd -C ${conf} -f";
|
ExecStart = "${package}/sbin/collectd -C ${conf} -f";
|
||||||
User = cfg.user;
|
User = cfg.user;
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = 3;
|
RestartSec = 3;
|
||||||
|
|
|
@ -41,6 +41,8 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
# All plugins and their dependencies.
|
||||||
|
# Please help complete this!
|
||||||
plugins = {
|
plugins = {
|
||||||
aggregation = {};
|
aggregation = {};
|
||||||
amqp = {
|
amqp = {
|
||||||
|
|
Loading…
Reference in a new issue