Skip to content

Commit 99e9553

Browse files
committed
fix: sync state in gmail mbsync as well
1 parent d7b7981 commit 99e9553

File tree

1 file changed

+15
-28
lines changed
  • home/gabriel/features/productivity

1 file changed

+15
-28
lines changed

home/gabriel/features/productivity/mail.nix

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,54 +24,43 @@
2424
};
2525
};
2626

27+
commonChannelCfg = {
28+
Expunge = "Both"; # Sync deleted messages
29+
Create = "Both"; # Create mailboxes if needed
30+
Remove = "None"; # Don't ever delete mailboxes
31+
SyncState = "*"; # Ensure sync state is in mail dir
32+
};
33+
2734
gmail_channels = {
2835
Inbox = {
2936
farPattern = "INBOX";
3037
nearPattern = "Inbox";
31-
extraConfig = {
32-
Create = "Near";
33-
Expunge = "Both";
34-
};
38+
extraConfig = commonChannelCfg;
3539
};
3640
Archive = {
3741
farPattern = "Archived Mail";
3842
nearPattern = "Archive";
39-
extraConfig = {
40-
Create = "Both";
41-
Expunge = "Both";
42-
};
43+
extraConfig = commonChannelCfg;
4344
};
4445
Junk = {
4546
farPattern = "[Gmail]/Spam";
4647
nearPattern = "Junk";
47-
extraConfig = {
48-
Create = "Near";
49-
Expunge = "Both";
50-
};
48+
extraConfig = commonChannelCfg;
5149
};
5250
Trash = {
5351
farPattern = "[Gmail]/Trash";
5452
nearPattern = "Trash";
55-
extraConfig = {
56-
Create = "Near";
57-
Expunge = "Both";
58-
};
53+
extraConfig = commonChannelCfg;
5954
};
6055
Drafts = {
6156
farPattern = "[Gmail]/Drafts";
6257
nearPattern = "Drafts";
63-
extraConfig = {
64-
Create = "Near";
65-
Expunge = "Both";
66-
};
58+
extraConfig = commonChannelCfg;
6759
};
6860
Sent = {
6961
farPattern = "[Gmail]/Sent Mail";
7062
nearPattern = "Sent";
71-
extraConfig = {
72-
Create = "Near";
73-
Expunge = "Both";
74-
};
63+
extraConfig = commonChannelCfg;
7564
};
7665
};
7766
in {
@@ -96,8 +85,7 @@ in {
9685
imap.host = "mail.m7.rs";
9786
mbsync = {
9887
enable = true;
99-
create = "maildir";
100-
expunge = "both";
88+
extraConfig.channel = commonChannelCfg;
10189
};
10290
neomutt = {
10391
enable = true;
@@ -125,9 +113,8 @@ in {
125113

126114
mbsync = {
127115
enable = true;
128-
create = "maildir";
129-
expunge = "both";
130116
groups.usp.channels = gmail_channels;
117+
extraConfig.channel = commonChannelCfg;
131118
extraConfig.account.AuthMechs = "XOAUTH2";
132119
};
133120
neomutt = {

0 commit comments

Comments
 (0)