From 6db559daa952833fb16bd52c5ae24e1c4fffd488 Mon Sep 17 00:00:00 2001 From: VwCSXg Date: Tue, 4 Apr 2023 23:37:41 +0200 Subject: [PATCH] thunderbird: add extraConfig option The added extraConfig option allowes users to insert custom text at the end of the generated profile `user.js` file. This allows the users to import templates as part of their configuration. --- modules/programs/thunderbird.nix | 14 ++++++++++++-- .../thunderbird/thunderbird-expected-first.js | 2 ++ .../thunderbird/thunderbird-expected-second.js | 1 + tests/modules/programs/thunderbird/thunderbird.nix | 3 +++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/modules/programs/thunderbird.nix b/modules/programs/thunderbird.nix index efd3b7821..786eff051 100644 --- a/modules/programs/thunderbird.nix +++ b/modules/programs/thunderbird.nix @@ -94,12 +94,13 @@ let "mail.smtp.defaultserver" = "smtp_${id}"; } // account.thunderbird.settings id; - mkUserJs = prefs: '' + mkUserJs = prefs: extraPrefs: '' // Generated by Home Manager. ${concatStrings (mapAttrsToList (name: value: '' user_pref("${name}", ${builtins.toJSON value}); '') prefs)} + ${extraPrefs} ''; in { meta.maintainers = with hm.maintainers; [ d-dervishi jkarlson ]; @@ -179,6 +180,14 @@ in { *{scrollbar-width:none !important} ''; }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Extra preferences to add to user.js. + ''; + }; }; })); }; @@ -327,7 +336,8 @@ in { { "mail.openpgp.allow_external_gnupg" = profile.withExternalGnupg; } profile.settings - ] ++ (map (a: toThunderbirdAccount a profile) accounts))); + ] ++ (map (a: toThunderbirdAccount a profile) accounts))) + profile.extraConfig; }; })); }; diff --git a/tests/modules/programs/thunderbird/thunderbird-expected-first.js b/tests/modules/programs/thunderbird/thunderbird-expected-first.js index de6775754..e9c3d6d9d 100644 --- a/tests/modules/programs/thunderbird/thunderbird-expected-first.js +++ b/tests/modules/programs/thunderbird/thunderbird-expected-first.js @@ -59,3 +59,5 @@ user_pref("mail.smtpserver.smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfa user_pref("mail.smtpservers", "smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc,smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f"); user_pref("privacy.donottrackheader.enabled", true); +user_pref("mail.html_compose", false); + diff --git a/tests/modules/programs/thunderbird/thunderbird-expected-second.js b/tests/modules/programs/thunderbird/thunderbird-expected-second.js index 12d7991e0..a7c32fd86 100644 --- a/tests/modules/programs/thunderbird/thunderbird-expected-second.js +++ b/tests/modules/programs/thunderbird/thunderbird-expected-second.js @@ -29,3 +29,4 @@ user_pref("mail.smtpservers", "smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d9938 user_pref("privacy.donottrackheader.enabled", true); user_pref("second.setting", "some-test-setting"); + diff --git a/tests/modules/programs/thunderbird/thunderbird.nix b/tests/modules/programs/thunderbird/thunderbird.nix index 776be0f70..2536ff41a 100644 --- a/tests/modules/programs/thunderbird/thunderbird.nix +++ b/tests/modules/programs/thunderbird/thunderbird.nix @@ -41,6 +41,9 @@ userContent = '' * { color: red !important; } ''; + extraConfig = '' + user_pref("mail.html_compose", false); + ''; }; second.settings = { "second.setting" = "some-test-setting"; };