accounts.email: add option to disable an account

Allow a user to disable an email account by setting
`accounts.email.accounts.<name>.enable = false`.  This is useful if
someone wants to configure email accounts globally but only use them in
certain circumstances.

Everywhere email account configuration is used, check if the account is
enabled before checking any attributes of the account.
This commit is contained in:
Adam Dinwoodie 2025-08-05 11:04:49 +01:00 committed by Austin Horstman
parent 07b994baed
commit dbfcd3292d
22 changed files with 164 additions and 26 deletions

View file

@ -20,7 +20,9 @@ let
cfg = config.programs.mbsync;
# Accounts for which mbsync is enabled.
mbsyncAccounts = lib.filter (a: a.mbsync.enable) (lib.attrValues config.accounts.email.accounts);
mbsyncAccounts = lib.filter (a: a.enable && a.mbsync.enable) (
lib.attrValues config.accounts.email.accounts
);
# Given a SINGLE group's channels attribute set, return true if ANY of the channel's
# patterns use the invalidOption attribute set value name.