1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-16 14:01:08 +01:00

tests/thunderbird: dont use realPkgs

Not relevant for testing.
This commit is contained in:
Austin Horstman 2025-04-18 14:33:16 -05:00
parent fc09cb7aaa
commit 412eb166eb
3 changed files with 43 additions and 29 deletions

View file

@ -1,24 +1,29 @@
# Confirm that both Firefox and Thunderbird can be configured at the same time. # Confirm that both Firefox and Thunderbird can be configured at the same time.
{ lib, realPkgs, ... }: {
lib.recursiveUpdate (import ./thunderbird.nix { inherit lib realPkgs; }) { config,
programs.thunderbird = { lib,
nativeMessagingHosts = with realPkgs; [ pkgs,
# 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
];
};
nmt.script =
let let
isDarwin = realPkgs.stdenv.hostPlatform.isDarwin; isDarwin = pkgs.stdenv.hostPlatform.isDarwin;
nativeHostsDir = nativeHostsDir =
if isDarwin then "Library/Mozilla/NativeMessagingHosts" else ".mozilla/native-messaging-hosts"; if isDarwin then "Library/Mozilla/NativeMessagingHosts" else ".mozilla/native-messaging-hosts";
in in
'' lib.recursiveUpdate (import ./thunderbird.nix { inherit config lib pkgs; }) {
programs.thunderbird = {
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 = ''
assertFileExists home-files/${nativeHostsDir}/com.github.browserpass.native.json assertFileExists home-files/${nativeHostsDir}/com.github.browserpass.native.json
''; '';
} }

View file

@ -1,9 +1,13 @@
# Confirm that both Firefox and Thunderbird can be configured at the same time. # 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 = { programs.firefox = {
enable = true; enable = true;
# Darwin doesn't support wrapped Firefox, using unwrapped instead package = null;
package = realPkgs.firefox-unwrapped;
}; };
} }

View file

@ -1,6 +1,12 @@
{ lib, realPkgs, ... }:
{ {
imports = [ ../../accounts/email-test-accounts.nix ]; config,
pkgs,
...
}:
{
imports = [
../../accounts/email-test-accounts.nix
];
accounts.email.accounts = { accounts.email.accounts = {
"hm@example.com" = { "hm@example.com" = {
@ -54,14 +60,13 @@
programs.thunderbird = { programs.thunderbird = {
enable = true; enable = true;
package = config.lib.test.mkStubPackage {
name = "thunderbird";
};
# Disable warning so that platforms' behavior is the same # Disable warning so that platforms' behavior is the same
darwinSetupWarning = false; 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 = { profiles = {
first = { first = {
isDefault = true; isDefault = true;
@ -105,7 +110,7 @@
nmt.script = nmt.script =
let let
isDarwin = realPkgs.stdenv.hostPlatform.isDarwin; isDarwin = pkgs.stdenv.hostPlatform.isDarwin;
configDir = if isDarwin then "Library/Thunderbird" else ".thunderbird"; configDir = if isDarwin then "Library/Thunderbird" else ".thunderbird";
profilesDir = if isDarwin then "${configDir}/Profiles" else "${configDir}"; profilesDir = if isDarwin then "${configDir}/Profiles" else "${configDir}";
platform = if isDarwin then "darwin" else "linux"; platform = if isDarwin then "darwin" else "linux";