From 39e49918562f28cfce01fbaf3ddeecbb52ea5416 Mon Sep 17 00:00:00 2001 From: Andrew Fontaine Date: Wed, 3 Mar 2021 21:24:19 -0500 Subject: [PATCH] git: Add configured SSL certificate for SMTP (#1833) If you have a custom SSL certificate configured for SMTP TLS, git should use it. --- modules/programs/git.nix | 1 + tests/modules/programs/git/git-with-email-expected.conf | 2 ++ tests/modules/programs/git/git-with-email.nix | 2 ++ tests/modules/programs/git/git-with-msmtp-expected.conf | 1 + 4 files changed, 6 insertions(+) diff --git a/modules/programs/git.nix b/modules/programs/git.nix index 5f86d0e0..d5f1bfee 100644 --- a/modules/programs/git.nix +++ b/modules/programs/git.nix @@ -290,6 +290,7 @@ in { "ssl") else ""; + smtpSslCertPath = mkIf smtp.tls.enable smtp.tls.certificatesFile; smtpServer = smtp.host; smtpUser = userName; from = address; diff --git a/tests/modules/programs/git/git-with-email-expected.conf b/tests/modules/programs/git/git-with-email-expected.conf index f48b7c33..c34ab1d7 100644 --- a/tests/modules/programs/git/git-with-email-expected.conf +++ b/tests/modules/programs/git/git-with-email-expected.conf @@ -2,12 +2,14 @@ from = "hm@example.org" smtpEncryption = "tls" smtpServer = "smtp.example.org" + smtpSslCertPath = "/etc/test/certificates.crt" smtpUser = "home.manager.jr" [sendemail "hm@example.com"] from = "hm@example.com" smtpEncryption = "ssl" smtpServer = "smtp.example.com" + smtpSslCertPath = "/etc/ssl/certs/ca-certificates.crt" smtpUser = "home.manager" [user] diff --git a/tests/modules/programs/git/git-with-email.nix b/tests/modules/programs/git/git-with-email.nix index 49089a97..ec18ecb9 100644 --- a/tests/modules/programs/git/git-with-email.nix +++ b/tests/modules/programs/git/git-with-email.nix @@ -6,6 +6,8 @@ with lib; imports = [ ../../accounts/email-test-accounts.nix ]; config = { + accounts.email.accounts.hm-account.smtp.tls.certificatesFile = + "/etc/test/certificates.crt"; programs.git = { enable = true; package = pkgs.gitMinimal; diff --git a/tests/modules/programs/git/git-with-msmtp-expected.conf b/tests/modules/programs/git/git-with-msmtp-expected.conf index b8c99758..1f2c7b79 100644 --- a/tests/modules/programs/git/git-with-msmtp-expected.conf +++ b/tests/modules/programs/git/git-with-msmtp-expected.conf @@ -2,6 +2,7 @@ from = "hm@example.org" smtpEncryption = "tls" smtpServer = "smtp.example.org" + smtpSslCertPath = "/etc/ssl/certs/ca-certificates.crt" smtpUser = "home.manager.jr" [sendemail "hm@example.com"]