diff --git a/home-pc.nix b/home-pc.nix index 2c66273..71d4727 100644 --- a/home-pc.nix +++ b/home-pc.nix @@ -11,6 +11,8 @@ ./desktop ./virtualisation/libvirt.nix ./virtualisation/docker.nix + ./modules/emailNotify.nix + ./services/mail.nix ./services/samba/home-pc.nix ./services/syncthing/home-pc.nix ./services/restic/home-pc.nix @@ -43,6 +45,11 @@ "87.98.162.88" = [ "portcheck.transmissionbt.com" ]; }; + systemd.emailNotify.enable = true; + systemd.emailNotify.mailTo = "admin@felschr.com"; + systemd.emailNotify.mailFrom = + "${config.networking.hostName} "; + services.printing.drivers = with pkgs; [ epson-escpr ]; # only change this when specified in release notes diff --git a/modules/emailNotify.nix b/modules/emailNotify.nix new file mode 100644 index 0000000..a46e8c2 --- /dev/null +++ b/modules/emailNotify.nix @@ -0,0 +1,67 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.systemd.emailNotify; + sendmail = pkgs.writeScript "sendmail" '' + #!${pkgs.runtimeShell} + + ${pkgs.system-sendmail}/bin/sendmail -t <"; + # only change this when specified in release notes system.stateVersion = "21.11"; } diff --git a/services/mail.nix b/services/mail.nix new file mode 100644 index 0000000..053dc9b --- /dev/null +++ b/services/mail.nix @@ -0,0 +1,22 @@ +{ config, pkgs, ... }: + +{ + programs.msmtp = { + enable = true; + defaults = { + tls = true; + tls_starttls = true; + auth = true; + }; + accounts.default = rec { + tls = true; + tls_starttls = true; + host = "smtp.web.de"; + port = 587; + user = "felschr@web.de"; + passwordeval = "cat /etc/nixos/secrets/smtp"; + # from = "%U@server.felschr.com"; + from = user; + }; + }; +}