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