Skip to content

Commit

Permalink
thunderbird: implement extensions for profiles
Browse files Browse the repository at this point in the history
Closes: #5654
  • Loading branch information
booxter authored and rycee committed Dec 21, 2024
1 parent f342df3 commit 51160a0
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions modules/programs/thunderbird.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ let
"Thunderbird preference (int, bool, string, and also attrs, list, float as a JSON string)";
};

# The extensions path shared by all profiles.
extensionPath = "extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";

moduleName = "programs.thunderbird";

enabledAccounts = attrValues
(filterAttrs (_: a: a.thunderbird.enable) config.accounts.email.accounts);

Expand Down Expand Up @@ -249,6 +254,27 @@ in {
default = { };
description = "Declarative search engine configuration.";
};

extensions = mkOption {
type = types.listOf types.package;
default = [ ];
example = literalExpression ''
[
pkgs.some-thunderbird-extension
]
'';
description = ''
List of ${name} add-on packages to install for this profile.
Note that it is necessary to manually enable extensions
inside ${name} after the first installation.
To automatically enable extensions add
`"extensions.autoDisableScopes" = 0;`
to
[{option}`${moduleName}.profiles.<profile>.settings`](#opt-${moduleName}.profiles._name_.settings)
'';
};
};
}));
description = "Attribute set of Thunderbird profiles.";
Expand Down Expand Up @@ -417,6 +443,18 @@ in {
force = profile.search.force;
source = profile.search.file;
};

"${thunderbirdProfilesPath}/${name}/extensions" =
mkIf (profile.extensions != [ ]) {
source = let
extensionsEnvPkg = pkgs.buildEnv {
name = "hm-thunderbird-extensions";
paths = profile.extensions;
};
in "${extensionsEnvPkg}/share/mozilla/${extensionPath}";
recursive = true;
force = true;
};
}));
};
}

0 comments on commit 51160a0

Please sign in to comment.