1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00:00

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.
This commit is contained in:
Robert Helgesson 2020-06-16 00:45:20 +02:00
parent ad4f33cfc4
commit bf7297d55c
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
11 changed files with 131 additions and 98 deletions

View file

@ -374,19 +374,7 @@ in {
}; };
accounts = mkOption { accounts = mkOption {
type = types.attrsOf (types.submodule ([ type = types.attrsOf (types.submodule mailAccountOpts);
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) ]));
default = { }; default = { };
description = "List of email accounts."; description = "List of email accounts.";
}; };

View file

@ -114,106 +114,112 @@ let
''; '';
in { in {
options.programs.alot = { options = {
enable = mkOption { programs.alot = {
type = types.bool; enable = mkOption {
default = false; type = types.bool;
example = true; default = false;
description = '' example = true;
Whether to enable the Alot mail user agent. Alot uses the description = ''
Notmuch email system and will therefore be automatically Whether to enable the Alot mail user agent. Alot uses the
enabled for each email account that is managed by Notmuch. Notmuch email system and will therefore be automatically
''; enabled for each email account that is managed by Notmuch.
}; '';
};
hooks = mkOption { hooks = mkOption {
type = types.lines; type = types.lines;
default = ""; default = "";
description = '' description = ''
Content of the hooks file. Content of the hooks file.
''; '';
}; };
bindings = mkOption { bindings = mkOption {
type = types.submodule { type = types.submodule {
options = { options = {
global = mkOption { global = mkOption {
type = types.attrsOf types.str; type = types.attrsOf types.str;
default = { }; default = { };
description = "Global keybindings."; description = "Global keybindings.";
}; };
bufferlist = mkOption { bufferlist = mkOption {
type = types.attrsOf types.str; type = types.attrsOf types.str;
default = { }; default = { };
description = "Bufferlist mode keybindings."; description = "Bufferlist mode keybindings.";
}; };
search = mkOption { search = mkOption {
type = types.attrsOf types.str; type = types.attrsOf types.str;
default = { }; default = { };
description = "Search mode keybindings."; description = "Search mode keybindings.";
}; };
envelope = mkOption { envelope = mkOption {
type = types.attrsOf types.str; type = types.attrsOf types.str;
default = { }; default = { };
description = "Envelope mode keybindings."; description = "Envelope mode keybindings.";
}; };
taglist = mkOption { taglist = mkOption {
type = types.attrsOf types.str; type = types.attrsOf types.str;
default = { }; default = { };
description = "Taglist mode keybindings."; description = "Taglist mode keybindings.";
}; };
thread = mkOption { thread = mkOption {
type = types.attrsOf types.str; type = types.attrsOf types.str;
default = { }; default = { };
description = "Thread mode keybindings."; description = "Thread mode keybindings.";
};
}; };
}; };
default = { };
description = ''
Keybindings.
'';
}; };
default = { };
description = ''
Keybindings.
'';
};
tags = mkOption { tags = mkOption {
type = types.attrsOf tagSubmodule; type = types.attrsOf tagSubmodule;
default = { }; default = { };
description = "How to display the tags."; 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;
}; };
example = literalExample ''
{ 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; auto_remove_unread = true;
ask_subject = false; handle_mouse = true;
thread_indent_replies = 2; prefer_plaintext = true;
} };
''; example = literalExample ''
description = '' {
Configuration options added to alot configuration file. 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.
'';
};
}; };
extraConfig = mkOption { accounts.email.accounts = mkOption {
type = types.lines; type = with types; attrsOf (submodule (import ./alot-accounts.nix pkgs));
default = "";
description = ''
Extra lines added to alot configuration file.
'';
}; };
}; };

View file

@ -98,6 +98,10 @@ in {
''; '';
}; };
}; };
accounts.email.accounts = mkOption {
type = with types; attrsOf (submodule (import ./astroid-accounts.nix));
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -49,6 +49,12 @@ let
".getmail/getmail${if a.primary then "rc" else a.name}"; ".getmail/getmail${if a.primary then "rc" else a.name}";
in { in {
options = {
accounts.email.accounts = mkOption {
type = with types; attrsOf (submodule (import ./getmail-accounts.nix));
};
};
config = mkIf getmailEnabled { config = mkIf getmailEnabled {
home.file = foldl' (a: b: a // b) { } home.file = foldl' (a: b: a // b) { }
(map (a: { "${renderConfigFilepath a}".text = renderAccountConfig a; }) (map (a: { "${renderConfigFilepath a}".text = renderAccountConfig a; })

View file

@ -43,6 +43,10 @@ in {
options = { options = {
programs.lieer.enable = programs.lieer.enable =
mkEnableOption "lieer Gmail synchronization for notmuch"; mkEnableOption "lieer Gmail synchronization for notmuch";
accounts.email.accounts = mkOption {
type = with types; attrsOf (submodule (import ./lieer-accounts.nix));
};
}; };
config = mkIf cfg.enable (mkMerge [ config = mkIf cfg.enable (mkMerge [

View file

@ -122,6 +122,10 @@ in {
''; '';
}; };
}; };
accounts.email.accounts = mkOption {
type = with types; attrsOf (submodule (import ./mbsync-accounts.nix));
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -56,6 +56,10 @@ in {
''; '';
}; };
}; };
accounts.email.accounts = mkOption {
type = with types; attrsOf (submodule (import ./msmtp-accounts.nix));
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -262,6 +262,10 @@ in {
description = "Extra configuration appended to the end."; description = "Extra configuration appended to the end.";
}; };
}; };
accounts.email.accounts = mkOption {
type = with types; attrsOf (submodule (import ./neomutt-accounts.nix));
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -143,6 +143,10 @@ in {
}; };
}; };
}; };
accounts.email.accounts = mkOption {
type = with types; attrsOf (submodule (import ./notmuch-accounts.nix));
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -147,6 +147,11 @@ in {
''; '';
}; };
}; };
accounts.email.accounts = mkOption {
type = with types;
attrsOf (submodule (import ./offlineimap-accounts.nix));
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

@ -52,6 +52,10 @@ in {
options = { options = {
services.lieer.enable = services.lieer.enable =
mkEnableOption "lieer Gmail synchronization service"; mkEnableOption "lieer Gmail synchronization service";
accounts.email.accounts = mkOption {
type = with types; attrsOf (submodule (import ./lieer-accounts.nix));
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {