about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorKevin Hanselman <kevin.hanselman@gmail.com>2017-12-04 22:43:30 -0500
committerBjørn Forsman <bjorn.forsman@gmail.com>2017-12-19 18:43:49 +0100
commit65fb15aaf8b4de22b846bb6de5c5d34c110ece84 (patch)
tree0326c942953cd9c9902fc151990fd4c47e788e32 /nixos
parent58fd7719eab78f6b3887ae71a6024b7009a5601b (diff)
nixos/smartd: allow extra cli options for daemon
This enables further customization of smartd.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/monitoring/smartd.nix18
1 files changed, 15 insertions, 3 deletions
diff --git a/nixos/modules/services/monitoring/smartd.nix b/nixos/modules/services/monitoring/smartd.nix
index 1d6940c516a99..b8d9e58a5a823 100644
--- a/nixos/modules/services/monitoring/smartd.nix
+++ b/nixos/modules/services/monitoring/smartd.nix
@@ -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}";
     };
 
   };