diff --git a/tests/modules/programs/thunderbird/thunderbird-native-messaging-host.nix b/tests/modules/programs/thunderbird/thunderbird-native-messaging-host.nix index 189ca1efb..d58f3f35a 100644 --- a/tests/modules/programs/thunderbird/thunderbird-native-messaging-host.nix +++ b/tests/modules/programs/thunderbird/thunderbird-native-messaging-host.nix @@ -1,24 +1,29 @@ # Confirm that both Firefox and Thunderbird can be configured at the same time. -{ lib, realPkgs, ... }: -lib.recursiveUpdate (import ./thunderbird.nix { inherit lib realPkgs; }) { +{ + config, + lib, + pkgs, + ... +}: +let + isDarwin = pkgs.stdenv.hostPlatform.isDarwin; + nativeHostsDir = + if isDarwin then "Library/Mozilla/NativeMessagingHosts" else ".mozilla/native-messaging-hosts"; +in +lib.recursiveUpdate (import ./thunderbird.nix { inherit config lib pkgs; }) { programs.thunderbird = { - 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 + nativeMessagingHosts = [ + (config.lib.test.mkStubPackage { + name = "browserpass"; + buildScript = '' + mkdir -p $out/lib/mozilla/native-messaging-hosts + echo test > $out/lib/mozilla/native-messaging-hosts/com.github.browserpass.native.json + ''; + }) ]; }; - nmt.script = - let - isDarwin = realPkgs.stdenv.hostPlatform.isDarwin; - nativeHostsDir = - if isDarwin then "Library/Mozilla/NativeMessagingHosts" else ".mozilla/native-messaging-hosts"; - in - '' - assertFileExists home-files/${nativeHostsDir}/com.github.browserpass.native.json - ''; + nmt.script = '' + assertFileExists home-files/${nativeHostsDir}/com.github.browserpass.native.json + ''; } diff --git a/tests/modules/programs/thunderbird/thunderbird-with-firefox.nix b/tests/modules/programs/thunderbird/thunderbird-with-firefox.nix index 0d23460d2..a7b6fb1b6 100644 --- a/tests/modules/programs/thunderbird/thunderbird-with-firefox.nix +++ b/tests/modules/programs/thunderbird/thunderbird-with-firefox.nix @@ -1,9 +1,13 @@ # Confirm that both Firefox and Thunderbird can be configured at the same time. -{ lib, realPkgs, ... }: -lib.recursiveUpdate (import ./thunderbird.nix { inherit lib realPkgs; }) { +{ + config, + lib, + pkgs, + ... +}: +lib.recursiveUpdate (import ./thunderbird.nix { inherit config lib pkgs; }) { programs.firefox = { enable = true; - # Darwin doesn't support wrapped Firefox, using unwrapped instead - package = realPkgs.firefox-unwrapped; + package = null; }; } diff --git a/tests/modules/programs/thunderbird/thunderbird.nix b/tests/modules/programs/thunderbird/thunderbird.nix index c900cdebb..9f575f0bf 100644 --- a/tests/modules/programs/thunderbird/thunderbird.nix +++ b/tests/modules/programs/thunderbird/thunderbird.nix @@ -1,6 +1,12 @@ -{ lib, realPkgs, ... }: { - imports = [ ../../accounts/email-test-accounts.nix ]; + config, + pkgs, + ... +}: +{ + imports = [ + ../../accounts/email-test-accounts.nix + ]; accounts.email.accounts = { "hm@example.com" = { @@ -54,14 +60,13 @@ programs.thunderbird = { enable = true; + package = config.lib.test.mkStubPackage { + name = "thunderbird"; + }; # Disable warning so that platforms' behavior is the same darwinSetupWarning = false; - # Darwin doesn't support wrapped Thunderbird, using unwrapped instead; - # using -latest- because ESR is currently broken on Darwin - package = realPkgs.thunderbird-latest-unwrapped; - profiles = { first = { isDefault = true; @@ -105,7 +110,7 @@ nmt.script = let - isDarwin = realPkgs.stdenv.hostPlatform.isDarwin; + isDarwin = pkgs.stdenv.hostPlatform.isDarwin; configDir = if isDarwin then "Library/Thunderbird" else ".thunderbird"; profilesDir = if isDarwin then "${configDir}/Profiles" else "${configDir}"; platform = if isDarwin then "darwin" else "linux";