home: mail: add himalaya

This mail client is very KISS. I like it.
This commit is contained in:
Bruno BELANYI 2021-06-22 17:59:47 +02:00
parent 791109c3c1
commit ff8e64d601
3 changed files with 32 additions and 0 deletions

View file

@ -15,6 +15,10 @@ let
inherit primary;
himalaya = {
enable = cfg.himalaya.enable;
};
msmtp = {
enable = cfg.msmtp.enable;
};

View file

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

23
home/mail/himalaya.nix Normal file
View file

@ -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")"
'';
};
};
}