nixos/smartd: allow extra cli options for daemon

This enables further customization of smartd.

authored by Kevin Hanselman and committed by Bjørn Forsman 65fb15aa 58fd7719

+15 -3
+15 -3
nixos/modules/services/monitoring/smartd.nix
··· 64 64 "DEVICESCAN ${notifyOpts}${cfg.defaults.autodetected}"} 65 65 ''; 66 66 67 - smartdOpts = { name, ... }: { 67 + smartdDeviceOpts = { name, ... }: { 68 68 69 69 options = { 70 70 ··· 105 105 106 106 Set to false to monitor the devices listed in 107 107 <option>services.smartd.devices</option> only. 108 + ''; 109 + }; 110 + 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>.) 108 120 ''; 109 121 }; 110 122 ··· 197 209 devices = mkOption { 198 210 default = []; 199 211 example = [ { device = "/dev/sda"; } { device = "/dev/sdb"; options = "-d sat"; } ]; 200 - type = with types; listOf (submodule smartdOpts); 212 + type = with types; listOf (submodule smartdDeviceOpts); 201 213 description = "List of devices to monitor."; 202 214 }; 203 215 ··· 222 234 223 235 path = [ pkgs.nettools ]; # for hostname and dnsdomanname calls in smartd 224 236 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}"; 226 238 }; 227 239 228 240 };