mbsync: Adds extraConfig.{local|remote}
... to be able to limit the number of mails to be retrieved. local refers to the "store" configuration, remote to the "channel".
This commit is contained in:
parent
4d870f665b
commit
9d9d826054
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
extraConfigType = with lib.types; attrsOf (either (either str int) bool);
|
||||||
|
in
|
||||||
{
|
{
|
||||||
options.mbsync = {
|
options.mbsync = {
|
||||||
enable = mkEnableOption "synchronization using mbsync";
|
enable = mkEnableOption "synchronization using mbsync";
|
||||||
|
@ -53,5 +56,27 @@ with lib;
|
||||||
Pattern of mailboxes to synchronize.
|
Pattern of mailboxes to synchronize.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extraConfig.local = mkOption {
|
||||||
|
type = extraConfigType;
|
||||||
|
default = {};
|
||||||
|
description = ''
|
||||||
|
Per store extra config.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
extraConfig.remote = mkOption {
|
||||||
|
type = extraConfigType;
|
||||||
|
default = {};
|
||||||
|
example = literalExample ''
|
||||||
|
{
|
||||||
|
MaxMessages = 10000;
|
||||||
|
MaxSize = 1m;
|
||||||
|
};
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
Per channel extra config.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,10 +33,13 @@ let
|
||||||
genSection = header: entries:
|
genSection = header: entries:
|
||||||
let
|
let
|
||||||
escapeValue = escape [ "\"" ];
|
escapeValue = escape [ "\"" ];
|
||||||
|
hasSpace = v: builtins.match ".* .*" v != null;
|
||||||
genValue = v:
|
genValue = v:
|
||||||
if isList v
|
if isList v
|
||||||
then concatMapStringsSep " " genValue v
|
then concatMapStringsSep " " genValue v
|
||||||
else "\"${escapeValue v}\"";
|
else if isInt v then toString v
|
||||||
|
else if (hasSpace v) then "\"${escapeValue v}\""
|
||||||
|
else v;
|
||||||
in
|
in
|
||||||
''
|
''
|
||||||
${header}
|
${header}
|
||||||
|
@ -70,11 +73,12 @@ let
|
||||||
Inbox = "${maildir.absPath}/${folders.inbox}";
|
Inbox = "${maildir.absPath}/${folders.inbox}";
|
||||||
SubFolders = "Verbatim";
|
SubFolders = "Verbatim";
|
||||||
}
|
}
|
||||||
//
|
// optionalAttrs (mbsync.flatten != null) { Flatten = mbsync.flatten; }
|
||||||
optionalAttrs (mbsync.flatten != null) { Flatten = mbsync.flatten; }
|
// mbsync.extraConfig.local
|
||||||
)
|
)
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ genSection "Channel ${name}" {
|
+ genSection "Channel ${name}" (
|
||||||
|
{
|
||||||
Master = ":${name}-remote:";
|
Master = ":${name}-remote:";
|
||||||
Slave = ":${name}-local:";
|
Slave = ":${name}-local:";
|
||||||
Patterns = mbsync.patterns;
|
Patterns = mbsync.patterns;
|
||||||
|
@ -83,6 +87,8 @@ let
|
||||||
Expunge = masterSlaveMapping.${mbsync.expunge};
|
Expunge = masterSlaveMapping.${mbsync.expunge};
|
||||||
SyncState = "*";
|
SyncState = "*";
|
||||||
}
|
}
|
||||||
|
// mbsync.extraConfig.remote
|
||||||
|
)
|
||||||
+ "\n";
|
+ "\n";
|
||||||
|
|
||||||
genGroupConfig = name: channels:
|
genGroupConfig = name: channels:
|
||||||
|
|
Loading…
Reference in a new issue