mbsync: extend config type with list of strings

Some configuration options can take space separated strings; for
example `SSLVersions` can be configured with multiple allowed
versions.

    SSLVersions TLSv1.3 TLSv1.2

This can now be represented in Home Manager.

    SSLVersions = [ “TLSv1.3” “TLSv1.2” ];

In implementing this change, it uses oneOf for config type, as it is a
cleaner way to represent the union than the nested eithers
formulation.

Also add SSLVersions to test lists of strings in
`account.extraConfig`.
This commit is contained in:
David Baynard 2022-09-19 22:19:21 +01:00 committed by Robert Helgesson
parent df79df8be1
commit 41790ba656
No known key found for this signature in database
GPG Key ID: 36BDAA14C2797E89
3 changed files with 4 additions and 1 deletions

View File

@ -4,7 +4,8 @@ with lib;
let
extraConfigType = with lib.types; attrsOf (either (either str int) bool);
extraConfigType = with lib.types;
attrsOf (oneOf [ str int bool (listOf str) ]);
perAccountGroups = { name, config, ... }: {
options = {

View File

@ -57,6 +57,7 @@ CertificateFile /etc/ssl/certs/ca-certificates.crt
Host imap.example.com
PassCmd password-command
SSLType IMAPS
SSLVersions TLSv1.3 TLSv1.2
User home.manager
IMAPStore hm@example.com-remote

View File

@ -21,6 +21,7 @@ with lib;
accounts.email.accounts = {
"hm@example.com".mbsync = {
enable = true;
extraConfig.account.SSLVersions = [ "TLSv1.3" "TLSv1.2" ];
groups.inboxes = {
channels = {
inbox1 = {