mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-03 07:31:03 +01:00
thunderbird: configure SMTP and GPG for aliases
Signed-off-by: tsrk. <tsrk@tsrk.me>
This commit is contained in:
parent
d52abd5b52
commit
3978bcd696
4 changed files with 91 additions and 12 deletions
|
|
@ -85,30 +85,51 @@ let
|
|||
let
|
||||
id = getId account address;
|
||||
addressIsString = builtins.isString address;
|
||||
identity = if addressIsString then account else address // { inherit id; };
|
||||
in
|
||||
{
|
||||
"mail.identity.id_${id}.fullName" = if addressIsString then account.realName else address.realName;
|
||||
"mail.identity.id_${id}.fullName" = identity.realName;
|
||||
"mail.identity.id_${id}.useremail" = if addressIsString then address else address.address;
|
||||
"mail.identity.id_${id}.valid" = true;
|
||||
"mail.identity.id_${id}.htmlSigText" =
|
||||
if account.signature.showSignature == "none" then "" else account.signature.text;
|
||||
if identity.signature.showSignature == "none" then "" else identity.signature.text;
|
||||
}
|
||||
// optionalAttrs (account.gpg != null) {
|
||||
// optionalAttrs (identity.gpg != null) {
|
||||
"mail.identity.id_${id}.attachPgpKey" = false;
|
||||
"mail.identity.id_${id}.autoEncryptDrafts" = true;
|
||||
"mail.identity.id_${id}.e2etechpref" = 0;
|
||||
"mail.identity.id_${id}.encryptionpolicy" = if account.gpg.encryptByDefault then 2 else 0;
|
||||
"mail.identity.id_${id}.encryptionpolicy" = if identity.gpg.encryptByDefault then 2 else 0;
|
||||
"mail.identity.id_${id}.is_gnupg_key_id" = true;
|
||||
"mail.identity.id_${id}.last_entered_external_gnupg_key_id" = account.gpg.key;
|
||||
"mail.identity.id_${id}.openpgp_key_id" = account.gpg.key;
|
||||
"mail.identity.id_${id}.last_entered_external_gnupg_key_id" = identity.gpg.key;
|
||||
"mail.identity.id_${id}.openpgp_key_id" = identity.gpg.key;
|
||||
"mail.identity.id_${id}.protectSubject" = true;
|
||||
"mail.identity.id_${id}.sign_mail" = account.gpg.signByDefault;
|
||||
"mail.identity.id_${id}.sign_mail" = identity.gpg.signByDefault;
|
||||
}
|
||||
// optionalAttrs (account.smtp != null) {
|
||||
"mail.identity.id_${id}.smtpServer" = "smtp_${account.id}";
|
||||
// optionalAttrs (identity.smtp != null) {
|
||||
"mail.identity.id_${id}.smtpServer" = "smtp_${identity.id}";
|
||||
}
|
||||
// account.thunderbird.perIdentitySettings id;
|
||||
|
||||
toThunderbirdSMTP =
|
||||
account: address:
|
||||
let
|
||||
id = getId account address;
|
||||
addressIsString = builtins.isString address;
|
||||
in
|
||||
optionalAttrs (!addressIsString && address.smtp != null) {
|
||||
"mail.smtpserver.smtp_${id}.authMethod" = 3;
|
||||
"mail.smtpserver.smtp_${id}.hostname" = address.smtp.host;
|
||||
"mail.smtpserver.smtp_${id}.port" = if (address.smtp.port != null) then address.smtp.port else 587;
|
||||
"mail.smtpserver.smtp_${id}.try_ssl" =
|
||||
if !address.smtp.tls.enable then
|
||||
0
|
||||
else if address.smtp.tls.useStartTls then
|
||||
2
|
||||
else
|
||||
3;
|
||||
"mail.smtpserver.smtp_${id}.username" = address.userName;
|
||||
};
|
||||
|
||||
toThunderbirdAccount =
|
||||
account: profile:
|
||||
let
|
||||
|
|
@ -154,6 +175,9 @@ let
|
|||
3;
|
||||
"mail.smtpserver.smtp_${id}.username" = account.userName;
|
||||
}
|
||||
// builtins.foldl' (a: b: a // b) { } (
|
||||
builtins.map (address: toThunderbirdSMTP account address) addresses
|
||||
)
|
||||
// optionalAttrs (account.smtp != null && account.primary) {
|
||||
"mail.smtp.defaultserver" = "smtp_${id}";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ user_pref("general.useragent.override", "");
|
|||
user_pref("mail.account.account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.identities", "id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc");
|
||||
user_pref("mail.account.account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.server", "server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc");
|
||||
user_pref("mail.account.account_c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab.server", "server_c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab");
|
||||
user_pref("mail.account.account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.identities", "id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f,id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562");
|
||||
user_pref("mail.account.account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.identities", "id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f,id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562,id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b");
|
||||
user_pref("mail.account.account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.server", "server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f");
|
||||
user_pref("mail.accountmanager.accounts", "account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f,account_c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab,imperative_account,account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc,account1");
|
||||
user_pref("mail.accountmanager.defaultaccount", "account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f");
|
||||
|
|
@ -37,6 +37,20 @@ user_pref("mail.identity.id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ec
|
|||
user_pref("mail.identity.id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562.smtpServer", "smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f");
|
||||
user_pref("mail.identity.id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562.useremail", "home-manager@example.com");
|
||||
user_pref("mail.identity.id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562.valid", true);
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.attachPgpKey", false);
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.autoEncryptDrafts", true);
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.e2etechpref", 0);
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.encryptionpolicy", 0);
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.fullName", "Home Manager");
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.htmlSigText", "");
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.is_gnupg_key_id", true);
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.last_entered_external_gnupg_key_id", "ABC");
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.openpgp_key_id", "ABC");
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.protectSubject", true);
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.sign_mail", false);
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.smtpServer", "smtp_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b");
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.useremail", "homeManager@alias.example.com");
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.valid", true);
|
||||
user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.autoEncryptDrafts", false);
|
||||
user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.fullName", "H. M. Test Jr.");
|
||||
user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.htmlSigText", "");
|
||||
|
|
@ -83,6 +97,11 @@ user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabc
|
|||
user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.type", "imap");
|
||||
user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.userName", "home.manager");
|
||||
user_pref("mail.smtp.defaultserver", "smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f");
|
||||
user_pref("mail.smtpserver.smtp_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.authMethod", 3);
|
||||
user_pref("mail.smtpserver.smtp_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.hostname", "ml.example.com");
|
||||
user_pref("mail.smtpserver.smtp_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.port", 465);
|
||||
user_pref("mail.smtpserver.smtp_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.try_ssl", 3);
|
||||
user_pref("mail.smtpserver.smtp_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.username", "homeManager@alias.example.com");
|
||||
user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.authMethod", 3);
|
||||
user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.hostname", "smtp.example.org");
|
||||
user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.port", 587);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ user_pref("general.useragent.override", "");
|
|||
user_pref("mail.account.account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.identities", "id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc");
|
||||
user_pref("mail.account.account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.server", "server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc");
|
||||
user_pref("mail.account.account_c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab.server", "server_c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab");
|
||||
user_pref("mail.account.account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.identities", "id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f,id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562");
|
||||
user_pref("mail.account.account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.identities", "id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f,id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562,id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b");
|
||||
user_pref("mail.account.account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.server", "server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f");
|
||||
user_pref("mail.accountmanager.accounts", "account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f,account_c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab,imperative_account,account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc,account1");
|
||||
user_pref("mail.accountmanager.defaultaccount", "account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f");
|
||||
|
|
@ -37,6 +37,20 @@ user_pref("mail.identity.id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ec
|
|||
user_pref("mail.identity.id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562.smtpServer", "smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f");
|
||||
user_pref("mail.identity.id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562.useremail", "home-manager@example.com");
|
||||
user_pref("mail.identity.id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562.valid", true);
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.attachPgpKey", false);
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.autoEncryptDrafts", true);
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.e2etechpref", 0);
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.encryptionpolicy", 0);
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.fullName", "Home Manager");
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.htmlSigText", "");
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.is_gnupg_key_id", true);
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.last_entered_external_gnupg_key_id", "ABC");
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.openpgp_key_id", "ABC");
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.protectSubject", true);
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.sign_mail", false);
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.smtpServer", "smtp_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b");
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.useremail", "homeManager@alias.example.com");
|
||||
user_pref("mail.identity.id_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.valid", true);
|
||||
user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.autoEncryptDrafts", false);
|
||||
user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.fullName", "H. M. Test Jr.");
|
||||
user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.htmlSigText", "");
|
||||
|
|
@ -83,6 +97,11 @@ user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabc
|
|||
user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.type", "imap");
|
||||
user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.userName", "home.manager");
|
||||
user_pref("mail.smtp.defaultserver", "smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f");
|
||||
user_pref("mail.smtpserver.smtp_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.authMethod", 3);
|
||||
user_pref("mail.smtpserver.smtp_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.hostname", "ml.example.com");
|
||||
user_pref("mail.smtpserver.smtp_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.port", 465);
|
||||
user_pref("mail.smtpserver.smtp_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.try_ssl", 3);
|
||||
user_pref("mail.smtpserver.smtp_b24ca86ede61ed219e6c87cfec261aae2c72785f812489ea943d114d1f39f55b.username", "homeManager@alias.example.com");
|
||||
user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.authMethod", 3);
|
||||
user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.hostname", "smtp.example.org");
|
||||
user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.port", 587);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,24 @@
|
|||
];
|
||||
};
|
||||
|
||||
aliases = [ "home-manager@example.com" ];
|
||||
aliases = [
|
||||
"home-manager@example.com"
|
||||
{
|
||||
realName = "Home Manager";
|
||||
address = "homeManager@alias.example.com";
|
||||
userName = "homeManager@alias.example.com";
|
||||
|
||||
signature = {
|
||||
showSignature = "none";
|
||||
};
|
||||
|
||||
smtp = {
|
||||
host = "ml.example.com";
|
||||
port = 465;
|
||||
tls.enable = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
gpg.key = "ABC";
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue