email: enable imapnotify with automatic fetching

This commit is contained in:
Benjamin Yule Bädorf 2024-03-26 22:20:39 +01:00
parent 2924b5d1a0
commit 4bc5fd8ef2
Signed by: b12f
GPG key ID: 729956E1124F8F26
3 changed files with 3 additions and 17 deletions

View file

@ -1,14 +0,0 @@
self:
with self; ''
${offlineimap}/bin/offlineimap
for dir in ~/Mail/*
do
unread=$(find "''${dir}/INBOX/" -type f | grep -vE ',[^,]*S[^,]*$')
if [ ! -z "''${unread}" ]; then
inbox=$(basename $dir)
${libnotify}/bin/notify-send "''${inbox} has unread mail"
fi
done
''

View file

@ -13,7 +13,6 @@ with prev; {
mu = writeShellScriptBin "mu" (import ./mu.nix final);
p = writeShellScriptBin "p" (import ./p.nix final);
present-md = writeShellScriptBin "present-md" (import ./present-md.nix final);
check-mail = writeShellScriptBin "check-mail" (import ./check-mail.nix final);
s = writeShellScriptBin "s" (import ./s.nix final);
sway-launcher = writeScriptBin "sway-launcher" (import ./sway-launcher.nix final);
sway-service = writeShellScriptBin "sway-service" (import ./sway-service.nix final);

View file

@ -39,9 +39,11 @@ with lib; let
tls.useStartTls = true;
};
offlineimap.enable = true;
imapnotify = {
enable = true;
boxes = [ "INBOX" ];
onNotify = "${pkgs.offlineimap}/bin/offlineimap -a ${address}";
onNotifyPost = "${pkgs.libnotify}/bin/notify-send '${address} has new mail'";
};
msmtp.enable = true;
@ -58,13 +60,11 @@ with lib; let
+Trash
'';
};
offlineimap.enable = true;
} // (if args ? "config" then args.config else {});
in {
users.users."${psCfg.user.name}".packages = with pkgs; [
w3m
mailto-mutt
check-mail
];
home-manager.users."${psCfg.user.name}" = rec {
@ -119,6 +119,7 @@ in {
];
};
services.imapnotify.enable = true;
programs.offlineimap.enable = true;
programs.msmtp.enable = true;
programs.neomutt = {