home: mail: use make_mbsync_channels func

This commit is contained in:
Antoine Martin 2022-05-09 01:51:11 +02:00
parent fb09f2a6cd
commit d2e2cfeb8f

View file

@ -10,6 +10,10 @@
mkEnableOption mkEnableOption
mkIf mkIf
; ;
inherit
(builtins)
typeOf
;
myName = "Antoine Martin"; myName = "Antoine Martin";
email_perso = "antoine@alarsyo.net"; email_perso = "antoine@alarsyo.net";
@ -18,9 +22,18 @@
cfg = config.my.home.mail; cfg = config.my.home.mail;
make_mbsync_channel = patterns: { make_mbsync_channel = patterns:
(
if (typeOf patterns) == "list"
then {
inherit patterns;
}
else {
farPattern = patterns.far; farPattern = patterns.far;
nearPattern = patterns.near; nearPattern = patterns.near;
}
)
// {
extraConfig = { extraConfig = {
Create = "Both"; Create = "Both";
Expunge = "Both"; Expunge = "Both";
@ -77,23 +90,11 @@ in {
create = "both"; create = "both";
expunge = "both"; expunge = "both";
groups = { groups = {
alarsyo-main.channels.alarsyo-main = { alarsyo-main.channels = make_mbsync_channels {
patterns = ["INBOX" "Sent" "Drafts" "Junk" "Trash"]; main = ["INBOX" "Sent" "Drafts" "Junk" "Trash"];
extraConfig = {
Create = "Both";
Expunge = "Both";
Remove = "None";
SyncState = "*";
};
};
alarsyo-full.channels.alarsyo-full = {
patterns = ["*" "!INBOX" "!Sent" "!Drafts" "!Junk" "!Trash"];
extraConfig = {
Create = "Both";
Expunge = "Both";
Remove = "None";
SyncState = "*";
}; };
alarsyo-full.channels = make_mbsync_channels {
full = ["*" "!INBOX" "!Sent" "!Drafts" "!Junk" "!Trash"];
}; };
}; };
}; };
@ -156,26 +157,12 @@ in {
expunge = "both"; expunge = "both";
groups = { groups = {
prologin-main.channels = prologin-main.channels =
{ (make_mbsync_channels {
main = { main = ["INBOX" "membres@"];
patterns = ["INBOX" "membres@"]; })
extraConfig = {
Create = "Both";
Expunge = "Both";
Remove = "None";
SyncState = "*";
};
};
}
// gmail_mbsync_channels; // gmail_mbsync_channels;
prologin-info.channels.prologin-info = { prologin-info.channels = make_mbsync_channels {
patterns = ["info@" "info@gcc"]; info = ["info@" "info@gcc"];
extraConfig = {
Create = "Both";
Expunge = "Both";
Remove = "None";
SyncState = "*";
};
}; };
}; };
}; };