1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-02 13:03:33 +02:00

email: allow null certificatesFile

Allow the value of certificatesFile to be null.

Also fixup uses of this variable.

Fixes: #2206
This commit is contained in:
Matthew Leach 2021-08-02 19:23:50 +01:00 committed by Robert Helgesson
parent 2c4234cb79
commit 5515ec99cc
No known key found for this signature in database
GPG Key ID: 36BDAA14C2797E89
5 changed files with 9 additions and 7 deletions

View File

@ -71,7 +71,7 @@ let
}; };
certificatesFile = mkOption { certificatesFile = mkOption {
type = types.path; type = types.nullOr types.path;
default = config.accounts.email.certificatesFile; default = config.accounts.email.certificatesFile;
defaultText = "config.accounts.email.certificatesFile"; defaultText = "config.accounts.email.certificatesFile";
description = '' description = ''
@ -354,7 +354,7 @@ let
in { in {
options.accounts.email = { options.accounts.email = {
certificatesFile = mkOption { certificatesFile = mkOption {
type = types.path; type = types.nullOr types.path;
default = "/etc/ssl/certs/ca-certificates.crt"; default = "/etc/ssl/certs/ca-certificates.crt";
description = '' description = ''
Path to default file containing certificate authorities that Path to default file containing certificate authorities that

View File

@ -295,7 +295,8 @@ in {
"ssl") "ssl")
else else
""; "";
smtpSslCertPath = mkIf smtp.tls.enable smtp.tls.certificatesFile; smtpSslCertPath =
mkIf smtp.tls.enable (toString smtp.tls.certificatesFile);
smtpServer = smtp.host; smtpServer = smtp.host;
smtpUser = userName; smtpUser = userName;
from = address; from = address;

View File

@ -21,11 +21,12 @@ let
user = userName; user = userName;
tls = onOff smtp.tls.enable; tls = onOff smtp.tls.enable;
tls_starttls = onOff smtp.tls.useStartTls; tls_starttls = onOff smtp.tls.useStartTls;
tls_trust_file = smtp.tls.certificatesFile;
} // optionalAttrs (msmtp.tls.fingerprint != null) { } // optionalAttrs (msmtp.tls.fingerprint != null) {
tls_fingerprint = msmtp.tls.fingerprint; tls_fingerprint = msmtp.tls.fingerprint;
} // optionalAttrs (smtp.port != null) { port = toString smtp.port; } } // optionalAttrs (smtp.port != null) { port = toString smtp.port; }
// optionalAttrs (passwordCommand != null) { // optionalAttrs (smtp.tls.certificatesFile != null) {
tls_trust_file = smtp.tls.certificatesFile;
} // optionalAttrs (passwordCommand != null) {
passwordeval = toString passwordCommand; passwordeval = toString passwordCommand;
} // msmtp.extraConfig) ++ optional primary '' } // msmtp.extraConfig) ++ optional primary ''

View File

@ -185,7 +185,7 @@ let
'' ''
# Generated by Home Manager. # Generated by Home Manager.
set ssl_force_tls = yes set ssl_force_tls = yes
set certificate_file=${config.accounts.email.certificatesFile} set certificate_file=${toString config.accounts.email.certificatesFile}
# GPG section # GPG section
set crypt_use_gpgme = yes set crypt_use_gpgme = yes

View File

@ -56,7 +56,7 @@ let
ssl = if imap.tls.enable then { ssl = if imap.tls.enable then {
ssl = true; ssl = true;
sslcacertfile = imap.tls.certificatesFile; sslcacertfile = toString imap.tls.certificatesFile;
starttls = imap.tls.useStartTls; starttls = imap.tls.useStartTls;
} else { } else {
ssl = false; ssl = false;