From ff8e64d601ffd2886973e2cedfe476cb4287eaa5 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 22 Jun 2021 17:59:47 +0200 Subject: [PATCH] home: mail: add himalaya This mail client is very KISS. I like it. --- home/mail/accounts.nix | 4 ++++ home/mail/default.nix | 5 +++++ home/mail/himalaya.nix | 23 +++++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 home/mail/himalaya.nix diff --git a/home/mail/accounts.nix b/home/mail/accounts.nix index 7f1ad02..2eecb6d 100644 --- a/home/mail/accounts.nix +++ b/home/mail/accounts.nix @@ -15,6 +15,10 @@ let inherit primary; + himalaya = { + enable = cfg.himalaya.enable; + }; + msmtp = { enable = cfg.msmtp.enable; }; diff --git a/home/mail/default.nix b/home/mail/default.nix index cc81d0c..3ec0c9a 100644 --- a/home/mail/default.nix +++ b/home/mail/default.nix @@ -7,12 +7,17 @@ in { imports = [ ./accounts.nix + ./himalaya.nix ./msmtp.nix ]; options.my.home.mail = with lib; { enable = my.mkDisableOption "email configuration"; + himalaya = { + enable = mkRelatedOption "himalaya configuration"; + }; + msmtp = { enable = mkRelatedOption "msmtp configuration"; }; diff --git a/home/mail/himalaya.nix b/home/mail/himalaya.nix new file mode 100644 index 0000000..c2d3b05 --- /dev/null +++ b/home/mail/himalaya.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.my.home.mail.himalaya; +in +{ + config.programs.himalaya = lib.mkIf cfg.enable { + enable = true; + + settings = { + notify-cmd = + let + notify-send = "${pkgs.libnotify}/bin/notify-send"; + in + pkgs.writeScript "mail-notifier" '' + SENDER="$1" + SUBJECT="$2" + ${notify-send} \ + -c himalaya \ + -- "$(printf 'Received email from %s\n\n%s' "$SENDER" "$SUBJECT")" + ''; + }; + }; +}