mbsync: add subFolders option (#1760)

The `SubFolders` option in mbsync controls the folder naming style in
the maildir.  There are three different styles:

* Verbatim - <maildirPath>/top/sub/subsub
* Maildir++ - <inboxPath>/.top.sub.subsub (used by Dovecot)
* Legacy - <maildirPath>/top/.sub/.subsub

Previously, the `SubFolders` option was hardcoded to `Verbatim`.  This
change allows configuration of the `SubFolders` option.
This commit is contained in:
yoctocell 2021-02-06 21:25:49 +00:00 committed by GitHub
parent fc87ac92af
commit 6dfa9ef85c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 3 deletions

View file

@ -125,6 +125,16 @@ in {
'';
};
subFolders = mkOption {
type = types.enum [ "Verbatim" "Maildir++" "Legacy" ];
default = "Verbatim";
example = "Maildir++";
description = ''
The on-disk folder naming style. This option has no
effect when <option>flatten</option> is used.
'';
};
create = mkOption {
type = types.enum [ "none" "maildir" "imap" "both" ];
default = "none";

View file

@ -65,10 +65,13 @@ let
+ genSection "IMAPStore ${name}-remote"
({ Account = name; } // mbsync.extraConfig.remote) + "\n"
+ genSection "MaildirStore ${name}-local" ({
Path = "${maildir.absPath}/";
Inbox = "${maildir.absPath}/${folders.inbox}";
SubFolders = "Verbatim";
} // optionalAttrs (mbsync.flatten != null) { Flatten = mbsync.flatten; }
} // optionalAttrs
(mbsync.subFolders != "Maildir++" || mbsync.flatten != null) {
Path = "${maildir.absPath}/";
} // optionalAttrs (mbsync.flatten == null) {
SubFolders = mbsync.subFolders;
} // optionalAttrs (mbsync.flatten != null) { Flatten = mbsync.flatten; }
// mbsync.extraConfig.local) + "\n" + genChannels account;
genChannels = account: