mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-11 11:31:06 +01:00
thunderbird: allow managing feed accounts (#5613)
This commit is contained in:
parent
7ceacd98a9
commit
90504b9a89
3 changed files with 50 additions and 4 deletions
|
|
@ -135,6 +135,18 @@ let
|
|||
(builtins.map (address: toThunderbirdIdentity account address) addresses)
|
||||
// account.thunderbird.settings id;
|
||||
|
||||
toThunderbirdFeed = feed: profile:
|
||||
let id = feed.id;
|
||||
in {
|
||||
"mail.account.account_${id}.server" = "server_${id}";
|
||||
"mail.server.server_${id}.name" = feed.name;
|
||||
"mail.server.server_${id}.type" = "rss";
|
||||
"mail.server.server_${id}.directory" =
|
||||
"${thunderbirdProfilesPath}/${profile.name}/Mail/Feeds-${id}";
|
||||
"mail.server.server_${id}.directory-rel" = "[ProfD]Mail/Feeds-${id}";
|
||||
"mail.server.server_${id}.hostname" = "Feeds-${id}";
|
||||
};
|
||||
|
||||
mkUserJs = prefs: extraPrefs: ''
|
||||
// Generated by Home Manager.
|
||||
|
||||
|
|
@ -196,6 +208,25 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
feedAccounts = mkOption {
|
||||
type = types.attrsOf (submodule ({ config, name, ... }: {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = name;
|
||||
readOnly = true;
|
||||
description = "This feed account's name.";
|
||||
};
|
||||
};
|
||||
}));
|
||||
default = { };
|
||||
description = ''
|
||||
Attribute set of feed accounts. Feeds themselves have to be
|
||||
managed through Thunderbird's settings. This option allows
|
||||
feeds to coexist with declaratively managed email accounts.
|
||||
'';
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = thunderbirdJson;
|
||||
default = { };
|
||||
|
|
@ -432,11 +463,17 @@ in {
|
|||
mkIf (profile.userContent != "") { text = profile.userContent; };
|
||||
|
||||
"${thunderbirdProfilesPath}/${name}/user.js" = let
|
||||
accounts = filter (a:
|
||||
emailAccounts = filter (a:
|
||||
a.thunderbird.profiles == [ ]
|
||||
|| any (p: p == name) a.thunderbird.profiles) enabledAccountsWithId;
|
||||
|
||||
smtp = filter (a: a.smtp != null) accounts;
|
||||
smtp = filter (a: a.smtp != null) emailAccounts;
|
||||
|
||||
feedAccounts =
|
||||
map (f: f // { id = builtins.hashString "sha256" f.name; })
|
||||
(attrValues profile.feedAccounts);
|
||||
|
||||
accounts = emailAccounts ++ feedAccounts;
|
||||
in {
|
||||
text = mkUserJs (builtins.foldl' (a: b: a // b) { } ([
|
||||
cfg.settings
|
||||
|
|
@ -454,7 +491,8 @@ in {
|
|||
{ "mail.openpgp.allow_external_gnupg" = profile.withExternalGnupg; }
|
||||
|
||||
profile.settings
|
||||
] ++ (map (a: toThunderbirdAccount a profile) accounts)))
|
||||
] ++ (map (a: toThunderbirdAccount a profile) emailAccounts)
|
||||
++ (map (f: toThunderbirdFeed f profile) feedAccounts)))
|
||||
profile.extraConfig;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@
|
|||
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.server", "server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f");
|
||||
user_pref("mail.accountmanager.accounts", "account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc,account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f");
|
||||
user_pref("mail.accountmanager.accounts", "account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc,account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f,account_c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab");
|
||||
user_pref("mail.accountmanager.defaultaccount", "account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f");
|
||||
user_pref("mail.identity.id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562.attachPgpKey", false);
|
||||
user_pref("mail.identity.id_8bbcff78f53202c0bfaa490a2068e3e5d6e36872144c659952ecc0ada47d7562.autoEncryptDrafts", true);
|
||||
|
|
@ -52,6 +53,11 @@ user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da50
|
|||
user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.socketType", 3);
|
||||
user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.type", "imap");
|
||||
user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.userName", "home.manager.jr");
|
||||
user_pref("mail.server.server_c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab.directory", ".thunderbird/first/Mail/Feeds-c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab");
|
||||
user_pref("mail.server.server_c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab.directory-rel", "[ProfD]Mail/Feeds-c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab");
|
||||
user_pref("mail.server.server_c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab.hostname", "Feeds-c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab");
|
||||
user_pref("mail.server.server_c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab.name", "rss");
|
||||
user_pref("mail.server.server_c6cc42837ed0a8041f93ff12c579a4af0dbe702461c97eef069f9f5f8dc4bfab.type", "rss");
|
||||
user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.directory", ".thunderbird/first/ImapMail/cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f");
|
||||
user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.directory-rel", "[ProfD]ImapMail/cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f");
|
||||
user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.hostname", "imap.example.com");
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@
|
|||
extraConfig = ''
|
||||
user_pref("mail.html_compose", false);
|
||||
'';
|
||||
|
||||
feedAccounts.rss = { };
|
||||
};
|
||||
|
||||
second.settings = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue