nixos/smartd: allow extra cli options for daemon

This enables further customization of smartd.
This commit is contained in:
Kevin Hanselman 2017-12-04 22:43:30 -05:00 committed by Bjørn Forsman
parent 58fd7719ea
commit 65fb15aaf8

View File

@ -64,7 +64,7 @@ let
"DEVICESCAN ${notifyOpts}${cfg.defaults.autodetected}"}
'';
smartdOpts = { name, ... }: {
smartdDeviceOpts = { name, ... }: {
options = {
@ -108,6 +108,18 @@ in
'';
};
extraOptions = mkOption {
default = [];
type = types.listOf types.str;
example = ["-A /var/log/smartd/" "--interval=3600"];
description = ''
Extra command-line options passed to the <literal>smartd</literal>
daemon on startup.
(See <literal>man 8 smartd</literal>.)
'';
};
notifications = {
mail = {
@ -197,7 +209,7 @@ in
devices = mkOption {
default = [];
example = [ { device = "/dev/sda"; } { device = "/dev/sdb"; options = "-d sat"; } ];
type = with types; listOf (submodule smartdOpts);
type = with types; listOf (submodule smartdDeviceOpts);
description = "List of devices to monitor.";
};
@ -222,7 +234,7 @@ in
path = [ pkgs.nettools ]; # for hostname and dnsdomanname calls in smartd
serviceConfig.ExecStart = "${pkgs.smartmontools}/sbin/smartd --no-fork --configfile=${smartdConf}";
serviceConfig.ExecStart = "${pkgs.smartmontools}/sbin/smartd ${lib.concatStringsSep " " cfg.extraOptions} --no-fork --configfile=${smartdConf}";
};
};