2023-01-25 12:00:01 -03:00
|
|
|
{ pkgs, lib, ... }:
|
2023-01-22 23:11:57 -03:00
|
|
|
let
|
2023-01-25 12:00:01 -03:00
|
|
|
inherit (pkgs.uservars.theme) color;
|
2023-01-22 23:11:57 -03:00
|
|
|
|
|
|
|
downloadEmails = "${pkgs.offlineimap}/bin/offlineimap";
|
|
|
|
afterSync = "${pkgs.notmuch}/bin/notmuch new";
|
2023-01-22 23:59:01 -03:00
|
|
|
onNewEmails = ''
|
|
|
|
${pkgs.libnotify}/bin/notify-send "You've got mail!"
|
|
|
|
'';
|
2023-01-22 23:11:57 -03:00
|
|
|
|
|
|
|
defaultAccountSettings = {
|
|
|
|
astroid.enable = true;
|
|
|
|
imapnotify = {
|
|
|
|
enable = true;
|
|
|
|
boxes = [ "INBOX" ];
|
|
|
|
onNotify = downloadEmails;
|
|
|
|
onNotifyPost = afterSync;
|
|
|
|
};
|
|
|
|
offlineimap = {
|
|
|
|
enable = true;
|
|
|
|
postSyncHookCommand = afterSync;
|
|
|
|
};
|
|
|
|
msmtp.enable = true;
|
|
|
|
notmuch.enable = true;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
2023-01-22 18:12:04 -03:00
|
|
|
accounts.email.accounts =
|
2023-01-22 23:11:57 -03:00
|
|
|
{
|
|
|
|
"personal" = {
|
|
|
|
primary = true;
|
2023-01-22 18:12:04 -03:00
|
|
|
realName = "Leonardo Eugênio";
|
2023-01-22 23:11:57 -03:00
|
|
|
address = "lelgenio@disroot.org";
|
|
|
|
userName = "lelgenio";
|
|
|
|
imap.host = "disroot.org";
|
|
|
|
smtp.host = "disroot.org";
|
2023-01-22 18:12:04 -03:00
|
|
|
passwordCommand = toString (pkgs.writeShellScript "get_pass" ''
|
2023-01-22 23:11:57 -03:00
|
|
|
pass "disroot.org" | head -n1
|
2023-01-22 18:12:04 -03:00
|
|
|
'');
|
2023-01-22 23:11:57 -03:00
|
|
|
} // defaultAccountSettings;
|
|
|
|
"work" = {
|
|
|
|
realName = "Leonardo Eugênio";
|
|
|
|
address = "leonardo@wopus.com.br";
|
|
|
|
userName = "leonardo@wopus.com.br";
|
|
|
|
imap.host = "imap.wopus.com.br";
|
|
|
|
smtp.host = "smtp.wopus.com.br";
|
|
|
|
passwordCommand = toString (pkgs.writeShellScript "get_pass" ''
|
|
|
|
pass "Trabalho/wopus_email/leonardo@wopus.com.br" | head -n1
|
|
|
|
'');
|
|
|
|
} // defaultAccountSettings;
|
2023-01-22 02:13:10 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
services.imapnotify.enable = true;
|
|
|
|
|
2023-01-22 23:11:57 -03:00
|
|
|
programs.offlineimap.enable = true;
|
|
|
|
systemd.user.services.offlineimap = {
|
|
|
|
Unit = {
|
|
|
|
Description = "offlineimap mailbox synchronization";
|
|
|
|
};
|
|
|
|
Service = {
|
|
|
|
Type = "oneshot";
|
|
|
|
ExecStart = downloadEmails;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
systemd.user.timers.offlineimap = {
|
|
|
|
Unit = { Description = "offlineimap mailbox synchronization"; };
|
|
|
|
Timer = {
|
|
|
|
OnCalendar = "*:0/5";
|
|
|
|
Unit = "offlineimap.service";
|
|
|
|
};
|
|
|
|
Install = { WantedBy = [ "timers.target" ]; };
|
|
|
|
};
|
|
|
|
|
2023-01-22 02:13:10 -03:00
|
|
|
programs.notmuch.enable = true;
|
2023-01-22 23:11:57 -03:00
|
|
|
programs.notmuch.hooks.postInsert = onNewEmails;
|
2023-01-22 02:13:10 -03:00
|
|
|
|
|
|
|
programs.msmtp.enable = true;
|
|
|
|
|
2023-01-22 23:11:57 -03:00
|
|
|
programs.astroid = {
|
|
|
|
enable = true;
|
2023-01-24 10:07:04 -03:00
|
|
|
externalEditor = "terminal -e $EDITOR %1";
|
2023-01-22 23:11:57 -03:00
|
|
|
pollScript = downloadEmails;
|
|
|
|
extraConfig = { };
|
|
|
|
};
|
2023-01-25 12:00:01 -03:00
|
|
|
|
|
|
|
xdg.configFile = lib.mkIf (color.type == "dark") {
|
|
|
|
"astroid/ui/thread-view.scss".text = ''
|
|
|
|
/* ui-version: 5 (do not change when modifying theme for yourself) */
|
|
|
|
|
|
|
|
* {
|
|
|
|
color: #ffffff !important;
|
|
|
|
background-color: #181818 !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
@import '/nix/store/g46fiqmjirak92ah3dc4nafmm8blmfab-astroid-0.16/share/astroid/ui/thread-view.scss';
|
|
|
|
'';
|
|
|
|
"astroid/ui/part.scss".text = ''
|
|
|
|
/* ui-version: 5 (do not change when modifying theme for yourself) */
|
|
|
|
|
|
|
|
* {
|
|
|
|
color: #eee !important;
|
|
|
|
background-color: #202020 !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
// @import '/nix/store/g46fiqmjirak92ah3dc4nafmm8blmfab-astroid-0.16/share/astroid/ui/part.scss';
|
|
|
|
'';
|
|
|
|
};
|
2023-01-22 02:13:10 -03:00
|
|
|
}
|