Skip to content

Commit

Permalink
nixos/smartd: allow extra cli options for daemon
Browse files Browse the repository at this point in the history
This enables further customization of smartd.
  • Loading branch information
kevin-hanselman authored and bjornfor committed Dec 19, 2017
1 parent 58fd771 commit 65fb15a
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions nixos/modules/services/monitoring/smartd.nix
Expand Up @@ -64,7 +64,7 @@ let
"DEVICESCAN ${notifyOpts}${cfg.defaults.autodetected}"}
'';

smartdOpts = { name, ... }: {
smartdDeviceOpts = { name, ... }: {

options = {

Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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.";
};

Expand All @@ -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}";
};

};
Expand Down

0 comments on commit 65fb15a

Please sign in to comment.