From 410f5732267d48d78ff0a1e6f38f512c4aea4808 Mon Sep 17 00:00:00 2001
From: SoonHo Seo <dnsdhrj123@gmail.com>
Date: Wed, 23 Oct 2019 20:17:04 +0900
Subject: [PATCH] getmail: add port option (#882)

Fixed bug where "accounts.email.accounts.<name>.imap.port" option was being ignored in getmail.
---
 modules/programs/getmail.nix                 | 1 +
 tests/modules/programs/getmail-expected.conf | 1 +
 2 files changed, 2 insertions(+)

diff --git a/modules/programs/getmail.nix b/modules/programs/getmail.nix
index 8c1ac5e02..04a958d6c 100644
--- a/modules/programs/getmail.nix
+++ b/modules/programs/getmail.nix
@@ -31,6 +31,7 @@ let
       [retriever]
       type = ${retrieverType}
       server = ${imap.host}
+      ${optionalString (imap.port != null) "port = ${imap.port}"}
       username = ${userName}
       password_command = (${passCmd})
       mailboxes = ( ${renderedMailboxes} )
diff --git a/tests/modules/programs/getmail-expected.conf b/tests/modules/programs/getmail-expected.conf
index da54e7092..a652e7199 100644
--- a/tests/modules/programs/getmail-expected.conf
+++ b/tests/modules/programs/getmail-expected.conf
@@ -2,6 +2,7 @@
 [retriever]
 type = SimpleIMAPSSLRetriever
 server = imap.example.com
+
 username = home.manager
 password_command = ('password-command')
 mailboxes = ( 'INBOX', 'Sent', 'Work' )