2021-05-22 23:31:06 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
{
|
|
|
|
imports = [ ../../accounts/email-test-accounts.nix ];
|
|
|
|
|
|
|
|
test.asserts.warnings.expected = [
|
|
|
|
"mbsync channels no longer use masterPattern. Use farPattern in its place."
|
|
|
|
"mbsync channels no longer use slavePattern. Use nearPattern in its place."
|
|
|
|
];
|
|
|
|
|
|
|
|
config = {
|
|
|
|
programs.mbsync = {
|
|
|
|
enable = true;
|
|
|
|
# programs.mbsync.groups and
|
|
|
|
# accounts.email.accounts.<name>.mbsync.groups should NOT be used at the
|
|
|
|
# same time.
|
2023-01-24 11:30:04 +01:00
|
|
|
# If they are, then the new version will take precedence.
|
2021-05-22 23:31:06 +02:00
|
|
|
groups.inboxes = {
|
|
|
|
"hm@example.com" = [ "Inbox1" "Inbox2" ];
|
|
|
|
hm-account = [ "Inbox" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
accounts.email.accounts = {
|
|
|
|
"hm@example.com".mbsync = {
|
|
|
|
enable = true;
|
|
|
|
groups.inboxes = {
|
|
|
|
channels = {
|
|
|
|
inbox1 = {
|
|
|
|
farPattern = "Inbox1";
|
|
|
|
nearPattern = "Inboxes";
|
|
|
|
};
|
|
|
|
inbox2 = {
|
|
|
|
farPattern = "Inbox2";
|
|
|
|
nearPattern = "Inboxes";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
hm-account.mbsync = {
|
|
|
|
enable = true;
|
|
|
|
groups.hm-account = {
|
|
|
|
channels.earlierPatternMatch = {
|
|
|
|
farPattern = "Label";
|
|
|
|
nearPattern = "SomethingUnderLabel";
|
|
|
|
patterns = [
|
|
|
|
"ThingUnderLabel"
|
|
|
|
"!NotThisMaildirThough"
|
|
|
|
''"[Weird] Label?"''
|
|
|
|
];
|
|
|
|
};
|
|
|
|
channels.inbox = {
|
|
|
|
farPattern = "Inbox";
|
|
|
|
nearPattern = "Inbox";
|
|
|
|
};
|
|
|
|
channels.strangeHostBoxName = {
|
|
|
|
farPattern = "[Weird]/Label Mess";
|
|
|
|
nearPattern = "[AnotherWeird]/Label";
|
|
|
|
};
|
|
|
|
channels.patternMatch = {
|
|
|
|
farPattern = "Label";
|
|
|
|
nearPattern = "SomethingUnderLabel";
|
|
|
|
patterns = [
|
|
|
|
"ThingUnderLabel"
|
|
|
|
"!NotThisMaildirThough"
|
|
|
|
''"[Weird] Label?"''
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
# No group should be printed.
|
|
|
|
groups.emptyGroup = { };
|
|
|
|
# Group should be printed, but left with default channels.
|
|
|
|
groups.emptyChannels = {
|
|
|
|
channels.empty1 = { };
|
|
|
|
channels.empty2 = { };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
test.asserts.warnings.expected = [
|
|
|
|
"mbsync channels no longer use masterPattern. use farPattern in its place."
|
|
|
|
"mbsync channels no longer use slavePattern. Use nearPattern in its place."
|
|
|
|
];
|
|
|
|
|
2021-10-30 20:44:21 +02:00
|
|
|
test.stubs.isync = { };
|
|
|
|
|
2021-05-22 23:31:06 +02:00
|
|
|
nmt.script = ''
|
|
|
|
assertFileExists home-files/.mbsyncrc
|
|
|
|
assertFileContent home-files/.mbsyncrc ${./mbsync-expected.conf}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|