From e72e241d7a602559285205820cfd708282a4197a Mon Sep 17 00:00:00 2001 From: Thibaut Marty Date: Mon, 1 Mar 2021 23:58:18 +0100 Subject: [PATCH] getmail: fix configuration mailboxes generation (#1719) The mailboxes must be a tuple of string or the string "ALL". The generated value was broken if the mailboxes configuration was a list of only one string (but not "ALL"): the generated expression ( "str" ) was not a tuple but a string. Now, we always generate a tuple (by adding a comma, even with a list of size one). Getmail works with the special value "ALL" whether it is a in tuple or not, so this case is not specifically handled. --- modules/programs/getmail.nix | 3 +-- tests/modules/programs/getmail/getmail-expected.conf | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/programs/getmail.nix b/modules/programs/getmail.nix index f83c469f..eaf297cf 100644 --- a/modules/programs/getmail.nix +++ b/modules/programs/getmail.nix @@ -11,8 +11,7 @@ let with account; let passCmd = concatMapStringsSep ", " (x: "'${x}'") passwordCommand; - renderedMailboxes = - concatMapStringsSep ", " (x: "'${x}'") getmail.mailboxes; + renderedMailboxes = concatMapStrings (x: "'${x}', ") getmail.mailboxes; retrieverType = if imap.tls.enable then "SimpleIMAPSSLRetriever" else diff --git a/tests/modules/programs/getmail/getmail-expected.conf b/tests/modules/programs/getmail/getmail-expected.conf index 90dc963e..a91522a5 100644 --- a/tests/modules/programs/getmail/getmail-expected.conf +++ b/tests/modules/programs/getmail/getmail-expected.conf @@ -5,7 +5,7 @@ server = imap.example.com port = 993 username = home.manager password_command = ('password-command') -mailboxes = ( 'INBOX', 'Sent', 'Work' ) +mailboxes = ( 'INBOX', 'Sent', 'Work', ) [destination] type = MDA_external