nixos/smartd: allow extra cli options for daemon

This enables further customization of smartd.

Changed files
+15 -3
nixos
modules
services
monitoring
+15 -3
nixos/modules/services/monitoring/smartd.nix
···
"DEVICESCAN ${notifyOpts}${cfg.defaults.autodetected}"}
'';
-
smartdOpts = { name, ... }: {
+
smartdDeviceOpts = { name, ... }: {
options = {
···
Set to false to monitor the devices listed in
<option>services.smartd.devices</option> only.
+
'';
+
};
+
+
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>.)
'';
};
···
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.";
};
···
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}";
};
};