diff options
Diffstat (limited to 'modules/communication/neomutt/account/default.nix')
| -rw-r--r-- | modules/communication/neomutt/account/default.nix | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/modules/communication/neomutt/account/default.nix b/modules/communication/neomutt/account/default.nix index 07a4b89..1d8046a 100644 --- a/modules/communication/neomutt/account/default.nix +++ b/modules/communication/neomutt/account/default.nix @@ -2,6 +2,7 @@ { config, lib, ... }: let cfg = config.communication.neomutt; + mbsyncGroupNames = (import ../lib.nix { inherit lib; }).mbsyncGroupNames; in { imports = [ @@ -47,10 +48,10 @@ in inherit (accountInformation.folders) inbox trash; } // lib.optionalAttrs (accountInformation.folders.drafts != null) { - drafts = accountInformation.folders.drafts; + inherit (accountInformation.folders) drafts; } // lib.optionalAttrs (accountInformation.folders.sent != null) { - sent = accountInformation.folders.sent; + inherit (accountInformation.folders) sent; }; neomutt = { @@ -62,14 +63,43 @@ in mbsync = { enable = true; create = accountInformation.mbsync.create; + expunge = "both"; patterns = accountInformation.mbsync.patterns; flatten = accountInformation.mbsync.flatten; extraConfig = { - account = accountInformation.mbsync.extraConfig.account; + account = { + PipelineDepth = 50; + } + // accountInformation.mbsync.extraConfig.account; channel = accountInformation.mbsync.extraConfig.channel; local = accountInformation.mbsync.extraConfig.local; remote = accountInformation.mbsync.extraConfig.remote; }; + + groups = + let + group = mbsyncGroupNames accountName; + + mkChannels = + sync: + lib.mapAttrs (local: remote: { + farPattern = remote; + nearPattern = local; + extraConfig = { + Create = "Near"; + Expunge = "Both"; + Sync = sync; + SyncState = "*"; + }; + }) accountInformation.mbsync.folders.map; + in + { + "${group.full}".channels = mkChannels "All"; + "${group.quick}".channels = mkChannels [ + "Pull" + "New" + ]; + }; }; notmuch = { |
