anchor.diff:        base_dir = ${baseDir}
         protocols = ${concatStringsSep " " cfg.protocols}
         sendmail_path = /run/wrappers/bin/sendmail
  +      # defining mail_plugins must be done before the first protocol {} filter because of https://doc.dovecot.org/configuration_manual/config_file/config_file_syntax/#variable-expansion
  +      mail_plugins = $mail_plugins ${concatStringsSep " " cfg.mailPlugins.globally.enable}
       ''
  +
  +    (concatStringsSep "\n" (mapAttrsToList (protocol: plugins: ''
  +      protocol ${protocol} {
  +        mail_plugins = $mail_plugins ${concatStringsSep " " plugins.enable}
  +      }
  +    '') cfg.mailPlugins.perProtocol))
   
       (if cfg.sslServerCert == null then ''
         ssl = no
  
positive.code:       default = "";
        example = "mail_debug = yes";
        description = "Additional entries to put verbatim into Dovecot's config file.";
      };
  
      configFile = mkOption {
  
negative.code:      optional cfg.enableImap "imap"
       ++ optional cfg.enablePop3 "pop3"
       ++ optional cfg.enableLmtp "lmtp";
  
      services.dovecot2.mailPlugins = mkIf cfg.enableQuota {
        globally.enable = [ "quota" ];
        perProtocol.imap.enable = [ "imap_quota" ];
      };
  
      users.users = {
        dovenull =
  