mirror of
https://github.com/Stunkymonkey/nixos.git
synced 2025-05-24 09:54:40 +02:00
service/drive: init from legacy and enable mail on error
This commit is contained in:
parent
ea873305c8
commit
7bea060e81
7 changed files with 49 additions and 6 deletions
29
modules/hardware/drive-monitor/default.nix
Normal file
29
modules/hardware/drive-monitor/default.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.my.hardware.drive-monitor;
|
||||
in
|
||||
{
|
||||
options.my.hardware.drive-monitor = with lib; {
|
||||
enable = mkEnableOption "drive-monitor configuration";
|
||||
|
||||
OnFailureMail = mkOption {
|
||||
type = types.nullOr (types.str);
|
||||
description = lib.mdDoc "Mail adress where to send the error report";
|
||||
default = null;
|
||||
example = "alarm@mail.com";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services = {
|
||||
postfix.enable = lib.mkIf (cfg.OnFailureMail != null) true;
|
||||
smartd = {
|
||||
enable = true;
|
||||
notifications.mail = lib.mkIf (cfg.OnFailureMail != null) {
|
||||
enable = true;
|
||||
recipient = cfg.OnFailureMail;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue