fork/home-manager
git clone https://git.julia.blue/fork/home-manager
75790441
master
1{ config , lib , ...} : 2 3with lib ; 4 5let 6 7extraConfigType = with lib . types ; 8attrsOf ( oneOf [ str int bool ( listOf str ) ]); 9 10perAccountGroups = { name , config , ...} :{ 11options = { 12name = mkOption { 13type = types . str ; 14# Make value of name the same as the name used with the dot prefix 15default = name ; 16readOnly = true ; 17description = '' 18The name of this group for this account. These names are different than 19some others, because they will hide channel names that are the same. 20'' ; 21}; 22 23channels = mkOption { 24type = types . attrsOf ( types . submodule channel ); 25default = { }; 26description = '' 27List of channels that should be grouped together into this group. When 28performing a synchronization, the groups are synchronized, rather than 29the individual channels. 30 31Using these channels and then grouping them together allows for you to 32define the maildir hierarchy as you see fit. 33'' ; 34}; 35}; 36}; 37 38# Options for configuring channel(s) that will be composed together into a group. 39channel = { name , config , ...} :{ 40options = { 41name = mkOption { 42type = types . str ; 43default = name ; 44readOnly = true ; 45description = '' 46The unique name for THIS channel in THIS group. The group will refer to 47this channel by this name. 48 49In addition, you can manually sync just this channel by specifying this 50name to mbsync on the command line. 51'' ; 52}; 53 54farPattern = mkOption { 55type = types . str ; 56default = "" ; 57example = "[Gmail]/Sent Mail" ; 58description = '' 59IMAP4 patterns for which mailboxes on the remote mail server to sync. 60If `Patterns` are specified, `farPattern` 61is interpreted as a prefix which is not matched against the patterns, 62and is not affected by mailbox list overrides. 63 64If this is left as the default, then mbsync will default to the pattern 65`INBOX`. 66'' ; 67}; 68 69nearPattern = mkOption { 70type = types . str ; 71default = "" ; 72example = "Sent" ; 73description = '' 74Name for where mail coming from the remote (far) mail server will end up 75locally. The mailbox specified by the far pattern will be placed in 76this directory. 77 78If this is left as the default, then mbsync will default to the pattern 79`INBOX`. 80'' ; 81}; 82 83patterns = mkOption { 84type = types . listOf types . str ; 85default = [ ]; 86example = [ "INBOX" ]; 87description = '' 88Instead of synchronizing *just* the mailboxes that 89match the `farPattern`, use it as a prefix which is 90not matched against the patterns, and is not affected by mailbox list 91overrides. 92'' ; 93}; 94 95extraConfig = mkOption { 96type = extraConfigType ; 97default = { }; 98example = literalExpression '' 99{ 100Create = "both"; 101CopyArrivalDate = "yes"; 102MaxMessages = 10000; 103MaxSize = "1m"; 104} 105'' ; 106description = '' 107Extra configuration lines to add to *THIS* channel's 108configuration. 109'' ; 110}; 111}; 112}; 113 114in { 115options . mbsync = { 116enable = mkEnableOption "synchronization using mbsync" ; 117 118flatten = mkOption { 119type = types . nullOr types . str ; 120default = null ; 121example = "." ; 122description = '' 123If set, flattens the hierarchy within the maildir by 124substituting the canonical hierarchy delimiter 125`/` with this value. 126'' ; 127}; 128 129subFolders = mkOption { 130type = types . enum [ "Verbatim" "Maildir++" "Legacy" ]; 131default = "Verbatim" ; 132example = "Maildir++" ; 133description = '' 134The on-disk folder naming style. This option has no 135effect when {option}`flatten` is used. 136'' ; 137}; 138 139create = mkOption { 140type = types . enum [ "none" "maildir" "imap" "both" ]; 141default = "none" ; 142example = "maildir" ; 143description = '' 144Automatically create missing mailboxes within the 145given mail store. 146'' ; 147}; 148 149remove = mkOption { 150type = types . enum [ "none" "maildir" "imap" "both" ]; 151default = "none" ; 152example = "imap" ; 153description = '' 154Propagate mailbox deletions to the given mail store. 155'' ; 156}; 157 158expunge = mkOption { 159type = types . enum [ "none" "maildir" "imap" "both" ]; 160default = "none" ; 161example = "both" ; 162description = '' 163Permanently remove messages marked for deletion from 164the given mail store. 165'' ; 166}; 167 168patterns = mkOption { 169type = types . listOf types . str ; 170default = [ "*" ]; 171description = '' 172Pattern of mailboxes to synchronize. 173'' ; 174}; 175 176groups = mkOption { 177type = types . attrsOf ( types . submodule perAccountGroups ); 178default = { }; 179# The default cannot actually be empty, but contains an attribute set where 180# the channels set is empty. If a group is specified, then a name is given, 181# creating the attribute set. 182description = '' 183Some email providers (Gmail) have a different directory hierarchy for 184synchronized email messages. Namely, when using mbsync without specifying 185a set of channels into a group, all synchronized directories end up beneath 186the `[Gmail]/` directory. 187 188This option allows you to specify a group, and subsequently channels that 189will allow you to sync your mail into an arbitrary hierarchy. 190'' ; 191}; 192 193extraConfig . channel = mkOption { 194type = extraConfigType ; 195default = { }; 196example = literalExpression '' 197{ 198MaxMessages = 10000; 199MaxSize = "1m"; 200}; 201'' ; 202description = '' 203Per channel extra configuration. 204'' ; 205}; 206 207extraConfig . local = mkOption { 208type = extraConfigType ; 209default = { }; 210description = '' 211Local store extra configuration. 212'' ; 213}; 214 215extraConfig . remote = mkOption { 216type = extraConfigType ; 217default = { }; 218description = '' 219Remote store extra configuration. 220'' ; 221}; 222 223extraConfig . account = mkOption { 224type = extraConfigType ; 225default = { }; 226example = literalExpression '' 227{ 228PipelineDepth = 10; 229Timeout = 60; 230}; 231'' ; 232description = '' 233Account section extra configuration. 234'' ; 235}; 236}; 237}