aboutsummaryrefslogtreecommitdiffstats
path: root/modules/communication/neomutt/account/assertions.nix
blob: 5c30311fd34bd2553f16afc44b60f68ae5d800e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Validates the neomutt account configurations
{ config, lib, ... }:
{
  config.assertions = [
    {
      assertion =
        !config.communication.neomutt.enable
        || !lib.any (account: account.enable && account.password-gopass-secret != null) (
          lib.attrValues config.communication.neomutt.accounts
        )
        || config.security.gopass.enable;
      message = ''
        An enabled communication.neomutt account uses password-gopass-secret but security.gopass.enable is not set.
        Enable security.gopass to provide the account password command.
      '';
    }
    {
      assertion =
        !config.communication.neomutt.enable
        || !lib.any (account: account.enable && account.gpg.key != null) (
          lib.attrValues config.communication.neomutt.accounts
        )
        || config.security.gpg.enable;
      message = ''
        An enabled communication.neomutt account specifies a GPG key but security.gpg.enable is not set.
        Enable security.gpg to provide mail signing and encryption support.
      '';
    }
  ];
}