mirror of
https://github.com/Stunkymonkey/nixos.git
synced 2025-05-24 01:44: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
|
@ -1,5 +0,0 @@
|
||||||
{ config, lib, pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
services.smartd.enable = true;
|
|
||||||
}
|
|
|
@ -16,4 +16,11 @@
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
|
|
||||||
|
my.hardware = {
|
||||||
|
drive-monitor = {
|
||||||
|
enable = true;
|
||||||
|
OnFailureMail = "server@buehler.rocks";
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,4 +31,11 @@
|
||||||
|
|
||||||
# Fix wifi disconnect
|
# Fix wifi disconnect
|
||||||
networking.networkmanager.wifi.powersave = false;
|
networking.networkmanager.wifi.powersave = false;
|
||||||
|
|
||||||
|
my.hardware = {
|
||||||
|
drive-monitor = {
|
||||||
|
enable = true;
|
||||||
|
OnFailureMail = "server@buehler.rocks";
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,10 @@ in
|
||||||
my.hardware = {
|
my.hardware = {
|
||||||
bluetooth.enable = true;
|
bluetooth.enable = true;
|
||||||
debug.enable = true;
|
debug.enable = true;
|
||||||
|
drive-monitor = {
|
||||||
|
enable = true;
|
||||||
|
OnFailureMail = "server@buehler.rocks";
|
||||||
|
};
|
||||||
firmware = {
|
firmware = {
|
||||||
enable = true;
|
enable = true;
|
||||||
cpuFlavor = cpuFlavor;
|
cpuFlavor = cpuFlavor;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
./bluetooth
|
./bluetooth
|
||||||
./debug
|
./debug
|
||||||
|
./drive-monitor
|
||||||
./firmware
|
./firmware
|
||||||
./graphics
|
./graphics
|
||||||
./keychron
|
./keychron
|
||||||
|
|
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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -81,7 +81,7 @@ in
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
# mails can only be delivered if postfix is available
|
# mails can only be delivered if postfix is available
|
||||||
services.postfix.enable = cfg.OnFailureMail != null;
|
services.postfix.enable = lib.mkIf (cfg.OnFailureMail != null) true;
|
||||||
|
|
||||||
services.borgbackup.jobs.hetzner = {
|
services.borgbackup.jobs.hetzner = {
|
||||||
# always backup everything and only define excludes
|
# always backup everything and only define excludes
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue