mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-13 12:31:07 +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;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue