thunderbird: merge account prefs with mergeAttrsList

The SMTP, identity, and profile pref sets were combined with linear foldl'
of //. mergeAttrsList performs the equivalent right-biased shallow merge and
scales with the account/address count without quadratic recopies.
This commit is contained in:
Austin Horstman 2026-06-15 21:15:17 -05:00
parent 50978d4bf6
commit ea0bf49c9d

View file

@ -263,16 +263,14 @@ let
// optionalAttrs (account.ews != null && account.ews.authentication != null) {
"mail.server.server_${id}.authMethod" = toThunderbirdAuthMethod account.ews.authentication;
}
// builtins.foldl' (a: b: a // b) { } (map (address: toThunderbirdSMTP account address) addresses)
// lib.mergeAttrsList (map (address: toThunderbirdSMTP account address) addresses)
// optionalAttrs (account.smtp != null && account.primary) {
"mail.smtp.defaultserver" = "smtp_${id}";
}
// optionalAttrs (account.smtp == null && account.ews != null && account.primary) {
"mail.smtp.defaultserver" = "ews_${id}";
}
// builtins.foldl' (a: b: a // b) { } (
map (address: toThunderbirdIdentity account address) addresses
)
// lib.mergeAttrsList (map (address: toThunderbirdIdentity account address) addresses)
// account.thunderbird.settings id;
toThunderbirdCalendar =
@ -1176,7 +1174,7 @@ in
);
in
{
text = mkUserJs (builtins.foldl' (a: b: a // b) { } (
text = mkUserJs (lib.mergeAttrsList (
[
cfg.settings