diff options
author | Robert Helgesson <robert@rycee.net> | 2020-06-16 00:45:20 +0200 |
---|---|---|
committer | Robert Helgesson <robert@rycee.net> | 2020-06-16 00:45:20 +0200 |
commit | bf7297d55cb0edc1917cbb2c46be27dcd230db43 (patch) | |
tree | ca141bb7b7c42654cb5a67b2709b0f24ec94d68f /modules | |
parent | ad4f33cfc49cbf094c8ffdf9e7b3640d9f2760a9 (diff) |
Move email account options to their owning modules
This removes the long list of submodules from
modules/accounts/email.nix
and instead move each entry to its owning module.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/accounts/email.nix | 14 | ||||
-rw-r--r-- | modules/programs/alot.nix | 184 | ||||
-rw-r--r-- | modules/programs/astroid.nix | 4 | ||||
-rw-r--r-- | modules/programs/getmail.nix | 6 | ||||
-rw-r--r-- | modules/programs/lieer.nix | 4 | ||||
-rw-r--r-- | modules/programs/mbsync.nix | 4 | ||||
-rw-r--r-- | modules/programs/msmtp.nix | 4 | ||||
-rw-r--r-- | modules/programs/neomutt.nix | 4 | ||||
-rw-r--r-- | modules/programs/notmuch.nix | 4 | ||||
-rw-r--r-- | modules/programs/offlineimap.nix | 5 | ||||
-rw-r--r-- | modules/services/lieer.nix | 4 |
11 files changed, 135 insertions, 102 deletions
diff --git a/modules/accounts/email.nix b/modules/accounts/email.nix index a1970667b47..1e7aff94611 100644 --- a/modules/accounts/email.nix +++ b/modules/accounts/email.nix @@ -374,19 +374,7 @@ in { }; accounts = mkOption { - type = types.attrsOf (types.submodule ([ - mailAccountOpts - (import ../programs/alot-accounts.nix pkgs) - (import ../programs/astroid-accounts.nix) - (import ../programs/getmail-accounts.nix) - (import ../programs/lieer-accounts.nix) - (import ../programs/mbsync-accounts.nix) - (import ../programs/msmtp-accounts.nix) - (import ../programs/neomutt-accounts.nix) - (import ../programs/notmuch-accounts.nix) - (import ../programs/offlineimap-accounts.nix) - ] ++ optionals pkgs.stdenv.hostPlatform.isLinux - [ (import ../services/lieer-accounts.nix) ])); + type = types.attrsOf (types.submodule mailAccountOpts); default = { }; description = "List of email accounts."; }; diff --git a/modules/programs/alot.nix b/modules/programs/alot.nix index 638630e1c58..e907cd3e0ac 100644 --- a/modules/programs/alot.nix +++ b/modules/programs/alot.nix @@ -114,106 +114,112 @@ let ''; in { - options.programs.alot = { - enable = mkOption { - type = types.bool; - default = false; - example = true; - description = '' - Whether to enable the Alot mail user agent. Alot uses the - Notmuch email system and will therefore be automatically - enabled for each email account that is managed by Notmuch. - ''; - }; - - hooks = mkOption { - type = types.lines; - default = ""; - description = '' - Content of the hooks file. - ''; - }; - - bindings = mkOption { - type = types.submodule { - options = { - global = mkOption { - type = types.attrsOf types.str; - default = { }; - description = "Global keybindings."; - }; - - bufferlist = mkOption { - type = types.attrsOf types.str; - default = { }; - description = "Bufferlist mode keybindings."; - }; + options = { + programs.alot = { + enable = mkOption { + type = types.bool; + default = false; + example = true; + description = '' + Whether to enable the Alot mail user agent. Alot uses the + Notmuch email system and will therefore be automatically + enabled for each email account that is managed by Notmuch. + ''; + }; - search = mkOption { - type = types.attrsOf types.str; - default = { }; - description = "Search mode keybindings."; - }; + hooks = mkOption { + type = types.lines; + default = ""; + description = '' + Content of the hooks file. + ''; + }; - envelope = mkOption { - type = types.attrsOf types.str; - default = { }; - description = "Envelope mode keybindings."; + bindings = mkOption { + type = types.submodule { + options = { + global = mkOption { + type = types.attrsOf types.str; + default = { }; + description = "Global keybindings."; + }; + + bufferlist = mkOption { + type = types.attrsOf types.str; + default = { }; + description = "Bufferlist mode keybindings."; + }; + + search = mkOption { + type = types.attrsOf types.str; + default = { }; + description = "Search mode keybindings."; + }; + + envelope = mkOption { + type = types.attrsOf types.str; + default = { }; + description = "Envelope mode keybindings."; + }; + + taglist = mkOption { + type = types.attrsOf types.str; + default = { }; + description = "Taglist mode keybindings."; + }; + + thread = mkOption { + type = types.attrsOf types.str; + default = { }; + description = "Thread mode keybindings."; + }; }; + }; + default = { }; + description = '' + Keybindings. + ''; + }; - taglist = mkOption { - type = types.attrsOf types.str; - default = { }; - description = "Taglist mode keybindings."; - }; + tags = mkOption { + type = types.attrsOf tagSubmodule; + default = { }; + description = "How to display the tags."; + }; - thread = mkOption { - type = types.attrsOf types.str; - default = { }; - description = "Thread mode keybindings."; - }; + settings = mkOption { + type = with types; + let primitive = either (either (either str int) bool) float; + in attrsOf primitive; + default = { + initial_command = "search tag:inbox AND NOT tag:killed"; + auto_remove_unread = true; + handle_mouse = true; + prefer_plaintext = true; }; + example = literalExample '' + { + auto_remove_unread = true; + ask_subject = false; + thread_indent_replies = 2; + } + ''; + description = '' + Configuration options added to alot configuration file. + ''; }; - default = { }; - description = '' - Keybindings. - ''; - }; - - tags = mkOption { - type = types.attrsOf tagSubmodule; - default = { }; - description = "How to display the tags."; - }; - settings = mkOption { - type = with types; - let primitive = either (either (either str int) bool) float; - in attrsOf primitive; - default = { - initial_command = "search tag:inbox AND NOT tag:killed"; - auto_remove_unread = true; - handle_mouse = true; - prefer_plaintext = true; + extraConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Extra lines added to alot configuration file. + ''; }; - example = literalExample '' - { - auto_remove_unread = true; - ask_subject = false; - thread_indent_replies = 2; - } - ''; - description = '' - Configuration options added to alot configuration file. - ''; }; - extraConfig = mkOption { - type = types.lines; - default = ""; - description = '' - Extra lines added to alot configuration file. - ''; + accounts.email.accounts = mkOption { + type = with types; attrsOf (submodule (import ./alot-accounts.nix pkgs)); }; }; diff --git a/modules/programs/astroid.nix b/modules/programs/astroid.nix index 8b3762fac0b..af12b10edbb 100644 --- a/modules/programs/astroid.nix +++ b/modules/programs/astroid.nix @@ -98,6 +98,10 @@ in { ''; }; }; + + accounts.email.accounts = mkOption { + type = with types; attrsOf (submodule (import ./astroid-accounts.nix)); + }; }; config = mkIf cfg.enable { diff --git a/modules/programs/getmail.nix b/modules/programs/getmail.nix index 2c3919dcf2f..f83c469ff24 100644 --- a/modules/programs/getmail.nix +++ b/modules/programs/getmail.nix @@ -49,6 +49,12 @@ let ".getmail/getmail${if a.primary then "rc" else a.name}"; in { + options = { + accounts.email.accounts = mkOption { + type = with types; attrsOf (submodule (import ./getmail-accounts.nix)); + }; + }; + config = mkIf getmailEnabled { home.file = foldl' (a: b: a // b) { } (map (a: { "${renderConfigFilepath a}".text = renderAccountConfig a; }) diff --git a/modules/programs/lieer.nix b/modules/programs/lieer.nix index c04786dbb59..e34a247af46 100644 --- a/modules/programs/lieer.nix +++ b/modules/programs/lieer.nix @@ -43,6 +43,10 @@ in { options = { programs.lieer.enable = mkEnableOption "lieer Gmail synchronization for notmuch"; + + accounts.email.accounts = mkOption { + type = with types; attrsOf (submodule (import ./lieer-accounts.nix)); + }; }; config = mkIf cfg.enable (mkMerge [ diff --git a/modules/programs/mbsync.nix b/modules/programs/mbsync.nix index 6ade10986fe..f2814b393d0 100644 --- a/modules/programs/mbsync.nix +++ b/modules/programs/mbsync.nix @@ -122,6 +122,10 @@ in { ''; }; }; + + accounts.email.accounts = mkOption { + type = with types; attrsOf (submodule (import ./mbsync-accounts.nix)); + }; }; config = mkIf cfg.enable { diff --git a/modules/programs/msmtp.nix b/modules/programs/msmtp.nix index f34fd72f8b1..7b6704860e0 100644 --- a/modules/programs/msmtp.nix +++ b/modules/programs/msmtp.nix @@ -56,6 +56,10 @@ in { ''; }; }; + + accounts.email.accounts = mkOption { + type = with types; attrsOf (submodule (import ./msmtp-accounts.nix)); + }; }; config = mkIf cfg.enable { diff --git a/modules/programs/neomutt.nix b/modules/programs/neomutt.nix index b6bbae0ff4c..2cc7bc6e2f9 100644 --- a/modules/programs/neomutt.nix +++ b/modules/programs/neomutt.nix @@ -262,6 +262,10 @@ in { description = "Extra configuration appended to the end."; }; }; + + accounts.email.accounts = mkOption { + type = with types; attrsOf (submodule (import ./neomutt-accounts.nix)); + }; }; config = mkIf cfg.enable { diff --git a/modules/programs/notmuch.nix b/modules/programs/notmuch.nix index 7e7a140b20c..9070d755671 100644 --- a/modules/programs/notmuch.nix +++ b/modules/programs/notmuch.nix @@ -143,6 +143,10 @@ in { }; }; }; + + accounts.email.accounts = mkOption { + type = with types; attrsOf (submodule (import ./notmuch-accounts.nix)); + }; }; config = mkIf cfg.enable { diff --git a/modules/programs/offlineimap.nix b/modules/programs/offlineimap.nix index 4ce12ec0a61..b6ba847e9b7 100644 --- a/modules/programs/offlineimap.nix +++ b/modules/programs/offlineimap.nix @@ -147,6 +147,11 @@ in { ''; }; }; + + accounts.email.accounts = mkOption { + type = with types; + attrsOf (submodule (import ./offlineimap-accounts.nix)); + }; }; config = mkIf cfg.enable { diff --git a/modules/services/lieer.nix b/modules/services/lieer.nix index 35ac7d643cc..571e2af75c8 100644 --- a/modules/services/lieer.nix +++ b/modules/services/lieer.nix @@ -52,6 +52,10 @@ in { options = { services.lieer.enable = mkEnableOption "lieer Gmail synchronization service"; + + accounts.email.accounts = mkOption { + type = with types; attrsOf (submodule (import ./lieer-accounts.nix)); + }; }; config = mkIf cfg.enable { |