Files
home-manager/tests/modules/programs/firefox/global-extensions-assertions.nix
Austin Horstman a786067676 mkFirefoxModule: assert managed package for global extensions
Reject globalExtensions when Home Manager has no browser-managed policy
carrier. This follows up the global extension policy work with a clear
failure mode, a regression test, and a news entry so affected users know
how to fix package = null setups.
2026-06-18 12:53:30 -05:00

36 lines
977 B
Nix

modulePath:
{
config,
lib,
pkgs,
...
}:
let
firefoxMockOverlay = import ./setup-firefox-mock-overlay.nix modulePath;
extensionWithoutAddonId = config.lib.test.mkStubPackage {
name = "extension-without-addon-id";
};
in
{
imports = [ firefoxMockOverlay ];
config = lib.mkIf config.test.enableBig (
lib.setAttrByPath modulePath {
enable = true;
package = lib.mkIf pkgs.stdenv.hostPlatform.isLinux null;
globalExtensions = [ extensionWithoutAddonId ];
}
// {
test.asserts.assertions.expected =
lib.optionals pkgs.stdenv.hostPlatform.isLinux [
"'${lib.showOption modulePath}.globalExtensions' requires '${lib.showOption modulePath}.package' to be set to a non-null value unless '${lib.showOption modulePath}.darwinDefaultsId' is set on Darwin."
]
++ [
"${lib.showOption modulePath}.globalExtensions requires each package to expose addonId in passthru."
];
}
);
}