Reapply "thunderbird: add native host support (#6292)" (#6371)

This reverts commit 6fbbfb9240.

Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
This commit is contained in:
Ihar Hrachyshka 2025-02-15 19:03:06 -05:00 committed by Austin Horstman
parent 3c82285348
commit fadb9cba44
2 changed files with 71 additions and 3 deletions

View file

@ -1,6 +1,8 @@
{ pkgs, ... }: {
{ lib, realPkgs, ... }: {
imports = [ ../../accounts/email-test-accounts.nix ];
_module.args.pkgs = lib.mkForce realPkgs;
accounts.email.accounts = {
"hm@example.com" = {
thunderbird = {
@ -41,6 +43,9 @@
# Disable warning so that platforms' behavior is the same
darwinSetupWarning = false;
# Darwin doesn't support wrapped Thunderbird, using unwrapped instead
package = realPkgs.thunderbird-unwrapped;
profiles = {
first = {
isDefault = true;
@ -62,6 +67,16 @@
};
};
nativeMessagingHosts = with realPkgs;
[
# NOTE: this is not a real Thunderbird native host module but Firefox; no
# native hosts are currently packaged for nixpkgs or elsewhere, so we
# have to improvise. Packaging wise, Firefox and Thunderbird native hosts
# are identical though. The test doesn't care if the host was meant for
# either as long as the right paths are present in the package.
browserpass
];
settings = {
"general.useragent.override" = "";
"privacy.donottrackheader.enabled" = true;
@ -69,9 +84,13 @@
};
nmt.script = let
isDarwin = pkgs.stdenv.hostPlatform.isDarwin;
isDarwin = realPkgs.stdenv.hostPlatform.isDarwin;
configDir = if isDarwin then "Library/Thunderbird" else ".thunderbird";
profilesDir = if isDarwin then "${configDir}/Profiles" else "${configDir}";
nativeHostsDir = if isDarwin then
"Library/Mozilla/NativeMessagingHosts"
else
".mozilla/native-messaging-hosts";
platform = if isDarwin then "darwin" else "linux";
in ''
assertFileExists home-files/${configDir}/profiles.ini
@ -93,5 +112,7 @@
assertFileExists home-files/${profilesDir}/first/chrome/userContent.css
assertFileContent home-files/${profilesDir}/first/chrome/userContent.css \
<(echo "* { color: red !important; }")
assertFileExists home-files/${nativeHostsDir}/com.github.browserpass.native.json
'';
}