git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/smartd: allow extra cli options for daemon

This enables further customization of smartd.

commit65fb15aaf8b4de22b846bb6de5c5d34c110ece84 authorKevin Hanselman <kevin.hanselman@gmail.com> dateMon 4 Dec 2017, 22:43 (9 years ago) parent58fd771
1 file changed+15−3
nixos/modules/services/monitoring/smartd.nix+15−3
nixos/modules/services/monitoring/smartd.nix+15−3
@@ -64,7 +64,7 @@ let
6464 "DEVICESCAN ${notifyOpts}${cfg.defaults.autodetected}"}
6565 '';
6666
67− smartdOpts = { name, ... }: {
67+ smartdDeviceOpts = { name, ... }: {
6868
6969 options = {
7070
@@ -108,6 +108,18 @@ in
108108 '';
109109 };
110110
111+ extraOptions = mkOption {
112+ default = [];
113+ type = types.listOf types.str;
114+ example = ["-A /var/log/smartd/" "--interval=3600"];
115+ description = ''
116+ Extra command-line options passed to the <literal>smartd</literal>
117+ daemon on startup.
118+
119+ (See <literal>man 8 smartd</literal>.)
120+ '';
121+ };
122+
111123 notifications = {
112124
113125 mail = {
@@ -197,7 +209,7 @@ in
197209 devices = mkOption {
198210 default = [];
199211 example = [ { device = "/dev/sda"; } { device = "/dev/sdb"; options = "-d sat"; } ];
200− type = with types; listOf (submodule smartdOpts);
212+ type = with types; listOf (submodule smartdDeviceOpts);
201213 description = "List of devices to monitor.";
202214 };
203215
@@ -222,7 +234,7 @@ in
222234
223235 path = [ pkgs.nettools ]; # for hostname and dnsdomanname calls in smartd
224236
225− serviceConfig.ExecStart = "${pkgs.smartmontools}/sbin/smartd --no-fork --configfile=${smartdConf}";
237+ serviceConfig.ExecStart = "${pkgs.smartmontools}/sbin/smartd ${lib.concatStringsSep " " cfg.extraOptions} --no-fork --configfile=${smartdConf}";
226238 };
227239
228240 };