diff --git a/home-manager-modules/mails/afewconfig b/home-manager-modules/mails/afewconfig deleted file mode 100644 index f8e77d4..0000000 --- a/home-manager-modules/mails/afewconfig +++ /dev/null @@ -1,101 +0,0 @@ - - -[Filter.1] -query = subject:"Formulaire d'externement" -tags = +externement -message = Externement - - -[Filter.2] -query = subject:/\[DG\]/ -tags = +dg -message = Mail pour la DG - -[Filter.3] -query = subject:"Demande de malle" -tags = +malle -message = Malle - -[Filter.4] -query = subject:"Demande d'inscription de" -tags = +thurnage -message = Thurnage - -[Filter.5] -query = subject:"Formulaire situation de" -tags = +situation -message = Situation - -[Filter.6] -query = subject:"Inscription au thurnage général de" -tags = +thurnage -message = TG - -[Filter.7] -query = subject:"Prévision d'externement de" -tags = +externement -message = previsionext - -[Filter.8] -query = subject:"Demande d'accès" -tags = +malle -message = acces - -[Filter.9] -query = subject:"Rendu de malle" -tags = +malle -message = rendu - -[Filter.10] -query = subject:"Prolongation de la malle" -tags = +malle -message = prolong - -[Filter.11] -query = subject:"Fermeture de l'internat" -tags = +fermeture -message = fermeture - -[Filter.12] -query = subject:/\[COF\]/ -tags = +cof -message = COF - -[Filter.13] -query = subject:"Modification inscription TG" -tags= +thurnage - -[Filter.14] -query = subject:/\[Pouët-Pouêt\]/ -tags = +fanfare -message = fanfare - -[Filter.15] -query = subject:/\[K-Fêt\]/ -tags = +kfet -message = kfet - -[Filter.16] -query = subject:/\[Chef.fe.s\]/ -tags = +chefs -message = chefs - -[Filter.17] -query = subject:/\[BC\]/ -tags = +bc -message = bc - -[Filter.18] -query = subject:/\[>Pouët-Pouêt<\]/ -tags = +fanfare -message = fanfare - - - -[InboxFilter] - -[MailMover] -folders = ens/Inbox ens/DG -rename = True -ens/Inbox = 'tag:bc':ens/Bilan-Carbone 'tag:dg':ens/DG 'tag:COF':ens/COF 'tag:fanfare':ens/Fanfare 'tag:kfet':ens/K-Fet 'tag:chefs':ens/K-Fet/Chefs -ens/DG = 'tag:externement':ens/DG/Externements 'tag:malle':ens/DG/Malles 'tag:thurnage':ens/DG/Thurnages 'tag:situation':ens/DG/Situations 'tag:fermeture':ens/DG/Fermeture diff --git a/home-manager-modules/mails/default.nix b/home-manager-modules/mails/default.nix index 9289f8f..29570c6 100644 --- a/home-manager-modules/mails/default.nix +++ b/home-manager-modules/mails/default.nix @@ -6,68 +6,153 @@ with lib; { options.luj.emails = { enable = mkEnableOption "enable mail management"; - backend.enable = mkEnableOption "enable filtering backend"; }; - config = mkMerge [ - (mkIf cfg.enable { - programs.mbsync.enable = true; - programs.neomutt.enable = true; - programs.msmtp.enable = true; - accounts.email = { - accounts.ens = { - address = "julien.malka@ens.fr"; - imap.host = "clipper.ens.fr"; - mbsync = { - enable = true; - create = "maildir"; - extraConfig.channel = { - "CopyArrivalDate" = "yes"; - }; + config = mkIf cfg.enable { + programs.mbsync.enable = true; + programs.neomutt.enable = true; + programs.msmtp.enable = true; + accounts.email = { + accounts.ens = { + notmuch.enable = true; + address = "julien.malka@ens.fr"; + imap.host = "clipper.ens.fr"; + mbsync = { + enable = true; + create = "maildir"; + extraConfig.channel = { + "CopyArrivalDate" = "yes"; }; - msmtp.enable = true; - primary = true; - realName = "Julien Malka"; - passwordCommand = "${pkgs.coreutils}/bin/cat /home/julien/.config/ens-mail-passwd"; - smtp = { - host = "clipper.ens.fr"; - }; - userName = "jmalka"; }; + msmtp.enable = true; + primary = true; + realName = "Julien Malka"; + passwordCommand = "${pkgs.coreutils}/bin/cat /home/julien/.config/ens-mail-pw"; + smtp = { + host = "clipper.ens.fr"; + }; + userName = "jmalka"; }; - services.mbsync = { - enable = true; - frequency = "minutely"; - verbose = true; + accounts.work = { + notmuch.enable = true; + address = "julien@malka.sh"; + imap.host = "mail.julienmalka.me"; + mbsync = { + enable = true; + create = "maildir"; + extraConfig.channel = { + "CopyArrivalDate" = "yes"; + }; + }; + msmtp.enable = true; + primary = false; + realName = "Julien Malka"; + passwordCommand = "${pkgs.coreutils}/bin/cat /home/julien/.config/work-mail-pw"; + smtp = { + host = "mail.julienmalka.me"; + }; + userName = "julien@malka.sh"; }; - xdg.configFile = { - "neomutt/neomuttrc".source = lib.mkForce ./neomuttrc; + + accounts.telecom = { + notmuch.enable = true; + address = "julien.malka@telecom-paris.fr"; + imap.host = "z.imt.fr"; + mbsync = { + enable = true; + create = "maildir"; + extraConfig.channel = { + "CopyArrivalDate" = "yes"; + }; + }; + msmtp.enable = true; + primary = false; + realName = "Julien Malka"; + passwordCommand = "${pkgs.coreutils}/bin/cat /home/julien/.config/telecom-mail-pw"; + smtp = { + host = "z.imt.fr"; + }; + userName = "julien.malka@telecom-paris.fr"; + }; + + accounts.dgnum = { + notmuch.enable = true; + address = "luj@dgnum.eu"; + imap.host = "kurisu.lahfa.xyz"; + mbsync = { + enable = true; + create = "maildir"; + extraConfig.channel = { + "CopyArrivalDate" = "yes"; + }; + }; + msmtp.enable = true; + primary = false; + realName = "Julien Malka"; + passwordCommand = "${pkgs.coreutils}/bin/cat /home/julien/.config/dgnum-mail-pw"; + smtp = { + host = "kurisu.lahfa.xyz"; + }; + userName = "luj@dgnum.eu"; }; - }) + }; - (mkIf (cfg.enable && cfg.backend.enable) { - programs.afew.enable = true; - accounts.email.accounts.ens.notmuch.enable = true; - services.mbsync.postExec = "${pkgs.notmuch}/bin/notmuch new"; - programs.notmuch = { - enable = true; - new.tags = [ "new" ]; - hooks.postNew = '' - ${pkgs.afew}/bin/afew --tag --new - ${pkgs.afew}/bin/afew --move-mails - ''; - }; - xdg.configFile = { - "afew/config".source = lib.mkForce ./afewconfig; - }; + services.mbsync = { + enable = true; + frequency = "minutely"; + verbose = true; + }; + services.mbsync.postExec = "${pkgs.notmuch}/bin/notmuch new"; + programs.notmuch = { + enable = true; + new.tags = [ ]; + hooks.postNew = '' + # julien@malka.sh + notmuch tag +work-inbox -- folder:work/Inbox + notmuch tag +work-lobsters -- folder:work/Inbox/lobsters + notmuch tag +work-dn42 -- folder:work/Inbox/dn42 + notmuch tag +work-fosdem -- folder:work/Inbox/fosdem + notmuch tag +work-frnog -- folder:work/Inbox/frnog + notmuch tag +work-github -- folder:work/Inbox/github + notmuch tag +work-netdata -- folder:work/Inbox/netdata + notmuch tag +work-nixos-discourse -- folder:work/Inbox/nixos-discourse + notmuch tag +work-proxmox -- folder:work/Inbox/proxmox + + #julien.malka@ens.fr + notmuch tag +ens-inbox path:ens/Inbox/** + notmuch tag +ens-bilan-carbone -ens-inbox -- path:ens/Bilan-Carbone/** + notmuch tag +ens-dg -ens-inbox -- path:ens/DG/** + notmuch tag +ens-cof -ens-inbox -- path:ens/COF/** + notmuch tag +ens-fanfare -ens-inbox -- path:ens/Fanfare/** + notmuch tag +ens-kfet -ens-inbox -- path:ens/K-Fet/** - }) + #julien.malka@telecom-paris.fr + notmuch tag +telecom-inbox path:telecom/Inbox/** + + #luj@dgnum.eu + notmuch tag +dgnum-inbox path:dgnum/Inbox/** + notmuch tag +dgnum-bureau -dgnum-inbox -- path:dgnum/Inbox/Bureau/** + notmuch tag +dgnum-nixcon -dgnum-inbox -- path:dgnum/Inbox/NixCon/** + + ''; + }; + + xdg.configFile = { + "neomutt/neomuttrc".source = lib.mkForce ./neomuttrc; + "neomutt/dracula.muttrc".source = lib.mkForce ./dracula.muttrc; + "neomutt/ens.profile".source = lib.mkForce ./ens.profile; + "neomutt/telecom.profile".source = lib.mkForce ./telecom.profile; + "neomutt/work.profile".source = lib.mkForce ./work.profile; + "neomutt/discourse.profile".source = lib.mkForce ./discourse.profile; + "neomutt/dgnum.profile".source = lib.mkForce ./dgnum.profile; + }; - ]; - + }; } + + diff --git a/home-manager-modules/mails/dgnum.profile b/home-manager-modules/mails/dgnum.profile new file mode 100644 index 0000000..6f91b06 --- /dev/null +++ b/home-manager-modules/mails/dgnum.profile @@ -0,0 +1,3 @@ +set from = "julien.malka@dgnum.eu" +set record=+dgnum/Sent +set collapse_unread = no diff --git a/home-manager-modules/mails/discourse.profile b/home-manager-modules/mails/discourse.profile new file mode 100644 index 0000000..623c403 --- /dev/null +++ b/home-manager-modules/mails/discourse.profile @@ -0,0 +1,4 @@ +set collapse_unread = yes +set from = "julien@malka.sh" +set record= +work/Sent + diff --git a/home-manager-modules/mails/dracula.muttrc b/home-manager-modules/mails/dracula.muttrc new file mode 100644 index 0000000..aa77d0f --- /dev/null +++ b/home-manager-modules/mails/dracula.muttrc @@ -0,0 +1,42 @@ +############################################################################### +# Dracula Theme for Mutt: https://draculatheme.com/ +# +# @author Paul Townsend + +# general ------------ foreground ---- background ----------------------------- +color error color231 color212 +color indicator color231 color241 +color markers color210 default +color message default default +color normal default default +color prompt default default +color search color84 default +color status color141 color236 +color tilde color231 default +color tree color141 default + +# message index ------ foreground ---- background ----------------------------- +color index color210 default ~D # deleted messages +color index color84 default ~F # flagged messages +color index color117 default ~N # new messages +color index color212 default ~Q # messages which have been replied to +color index color215 default ~T # tagged messages +color index color141 default ~v # messages part of a collapsed thread + +# message headers ---- foreground ---- background ----------------------------- +color hdrdefault color117 default +color header color231 default ^Subject:.* + +# message body ------- foreground ---- background ----------------------------- +color attachment color228 default +color body color231 default [\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+ # email addresses +color body color228 default (https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+ # URLs +color body color231 default (^|[[:space:]])\\*[^[:space:]]+\\*([[:space:]]|$) # *bold* text +color body color231 default (^|[[:space:]])_[^[:space:]]+_([[:space:]]|$) # _underlined_ text +color body color231 default (^|[[:space:]])/[^[:space:]]+/([[:space:]]|$) # /italic/ text +color quoted color61 default +color quoted1 color117 default +color quoted2 color84 default +color quoted3 color215 default +color quoted4 color212 default +color signature color212 default diff --git a/home-manager-modules/mails/ens.profile b/home-manager-modules/mails/ens.profile new file mode 100644 index 0000000..98f0d2c --- /dev/null +++ b/home-manager-modules/mails/ens.profile @@ -0,0 +1,4 @@ +set from = "julien.malka@ens.fr" +set record="+ens/Sent\ Messages" +set collapse_unread = no + diff --git a/home-manager-modules/mails/neomuttrc b/home-manager-modules/mails/neomuttrc index 6ce0b2b..0a65921 100644 --- a/home-manager-modules/mails/neomuttrc +++ b/home-manager-modules/mails/neomuttrc @@ -1,8 +1,6 @@ -set from = "julien.malka@ens.fr" - +set from = "julien@malka.sh" # Nom complet de l'expéditeur set realname = "Julien Malka" - # Génération du champs from set use_from = yes @@ -12,20 +10,14 @@ set mark_old=no set editor = "nvim -c 'set tw=72' -c 'set wrap'" #set editor="vim +':set textwidth=0' +':set wrapmargin=0' +':set wrap'" #set wrap="72" -set folder = ~/Maildir/ens +set folder = ~/Maildir +#set spoolfile=/home/julien/Maildir/ens/Inbox set mbox_type=Maildir set virtual_spoolfile=yes set header_cache=~/.cache/mutt set sidebar_visible = yes -set record = "+Sent\ Messages" -#mailboxes =Inbox =DG =DG/Malles =DG/Externements =DG/Thurnages =DG/Situations =DG/Fermeture =Sent\ Messages -#named-mailboxes "Malles" =DG/Malles -#named-mailboxes "Externements" =DG/Externements -#named-mailboxes "Thurnages" =DG/Thurnages -#named-mailboxes "Situations" =DG/Situations -#named-mailboxes "Fermeture" =DG/Fermeture -#named-mailboxes "Sent" =Sent\ Messages +#set record = "+Sent\ Messages" set nm_unread_tag = unread set mail_check_stats=yes set sidebar_short_path = yes @@ -33,17 +25,32 @@ set sidebar_short_path = yes set timeout=10 set mail_check=10 -virtual-mailboxes "Inbox" "notmuch://?query=tag:inbox and NOT tag:dg and NOT tag:cof and NOT tag:fanfare and NOT tag:kfet and NOT tag:chefs and NOT tag:bc" -virtual-mailboxes "K-Fêt" "notmuch://?query=tag:kfet" -virtual-mailboxes "Chefs" "notmuch://?query=tag:chefs" -virtual-mailboxes "Bilan Carbone" "notmuch://?query=tag:bc" -virtual-mailboxes "DG" "notmuch://?query=tag:dg and NOT tag:externement and NOT tag:fermeture and NOT tag:malle and NOT tag:situation and NOT tag:thurnage" -virtual-mailboxes "Externements" "notmuch://?query=tag:externement" -virtual-mailboxes "Fermeture" "notmuch://?query=tag:fermeture" -virtual-mailboxes "Malles" "notmuch://?query=tag:malle" -virtual-mailboxes "Situations" "notmuch://?query=tag:situation" -virtual-mailboxes "Thurnages" "notmuch://?query=tag:thurnage" -virtual-mailboxes "Fanfare" "notmuch://?query=tag:fanfare" +named-mailboxes "-----work-----" =sep1 +virtual-mailboxes "inbox" "notmuch://?query=tag:work-inbox +virtual-mailboxes "dn42" "notmuch://?query=tag:work-dn42 +virtual-mailboxes "fosdem" "notmuch://?query=tag:work-fosdem +virtual-mailboxes "frnog" "notmuch://?query=tag:work-frnog +virtual-mailboxes "github" "notmuch://?query=tag:work-github +virtual-mailboxes "lobsters" "notmuch://?query=tag:work-lobsters +virtual-mailboxes "netdata" "notmuch://?query=tag:work-netdata +virtual-mailboxes "nixos-discourse" "notmuch://?query=tag:work-nixos-discourse +virtual-mailboxes "proxmox" "notmuch://?query=tag:work-proxmox + +named-mailboxes "-----ens-----" =sep2 +virtual-mailboxes "inbox" "notmuch://?query=tag:ens-inbox +virtual-mailboxes "bilan-carbone" "notmuch://?query=tag:ens-bilan-carbone +virtual-mailboxes "cof" "notmuch://?query=tag:ens-cof +virtual-mailboxes "dg" "notmuch://?query=tag:ens-dg +virtual-mailboxes "kfet" "notmuch://?query=tag:ens-kfet + +named-mailboxes "---telecom---" =sep3 +virtual-mailboxes "inbox" "notmuch://?query=tag:telecom-inbox + +named-mailboxes "----dgnum----" =sep4 +virtual-mailboxes "inbox" "notmuch://?query=tag:dgnum-inbox +virtual-mailboxes "bureau" "notmuch://?query=tag:dgnum-bureau +virtual-mailboxes "nixcon" "notmuch://?query=tag:dgnum-nixcon + set sidebar_width=15 set sidebar_divider_char='|' @@ -61,6 +68,7 @@ set nm_default_url = "notmuch:///home/julien/Maildir" macro index \\ "" set metoo=yes +set query_command="notmuch-addrlookup --format=mutt '%s'" set text_flowed set collapse_unread = no @@ -68,17 +76,39 @@ set collapse_all = yes bind index - collapse-thread +bind editor complete-query +bind editor ^T complete + set sort = threads set sort_aux = reverse-last-date-received -folder-hook . 'source /home/julien/dotfiles/profile.default' -folder-hook "DG" 'source /home/julien/dotfiles/profile.dg' -folder-hook "K-Fêt" 'source /home/julien/dotfiles/profile.kfet' -folder-hook "Chefs" 'source /home/julien/dotfiles/profile.chefs' + +folder-hook "ens-inbox" 'source ~/.config/neomutt/ens.profile' +folder-hook "ens-bilan-carbone" 'source ~/.config/neomutt/ens.profile' +folder-hook "ens-cof" 'source ~/.config/neomutt/ens.profile' +folder-hook "ens-dg" 'source ~/.config/neomutt/ens.profile' +folder-hook "ens-kfet" 'source ~/.config/neomutt/ens.profile' + +folder-hook "telecom-inbox" 'source ~/.config/neomutt/telecom.profile' + +folder-hook "work-nixos-discourse" 'source ~/.config/neomutt/discourse.profile' +folder-hook "work-dn42" 'source ~/.config/neomutt/work.profile' +folder-hook "work-frnog" 'source ~/.config/neomutt/work.profile' +folder-hook "work-inbox" 'source ~/.config/neomutt/work.profile' +folder-hook "work-github" 'source ~/.config/neomutt/work.profile' +folder-hook "work-fosdem" 'source ~/.config/neomutt/work.profile' +folder-hook "work-proxmox" 'source ~/.config/neomutt/work.profile' +folder-hook "work-netdata" 'source ~/.config/neomutt/work.profile' +folder-hook "work-lobsters" 'source ~/.config/neomutt/work.profile' + +folder-hook "dgnum-inbox" 'source ~/.config/neomutt/dgnum.profile' +folder-hook "dgnum-bureau" 'source ~/.config/neomutt/dgnum.profile' +folder-hook "dgnum-nixcon" 'source ~/.config/neomutt/dgnum.profile' + set sidebar_format = '%D%* %?N?(%N)?%*' color sidebar_unread yellow default -source ~/dotfiles/dracula.muttrc +source dracula.muttrc set sendmail = "msmtp" diff --git a/home-manager-modules/mails/telecom.profile b/home-manager-modules/mails/telecom.profile new file mode 100644 index 0000000..dfd221c --- /dev/null +++ b/home-manager-modules/mails/telecom.profile @@ -0,0 +1,3 @@ +set from = "julien.malka@telecom-paris.fr" +set record=+telecom/Sent +set collapse_unread = no diff --git a/home-manager-modules/mails/work.profile b/home-manager-modules/mails/work.profile new file mode 100644 index 0000000..cb99259 --- /dev/null +++ b/home-manager-modules/mails/work.profile @@ -0,0 +1,4 @@ +set from = "julien@malka.sh" +set record= +work/Sent +set collapse_unread = no +