mirror of
https://github.com/nix-community/home-manager.git
synced 2026-10-02 19:49:18 +00:00
On macOS 27+, wrapped package will have no Mozilla signature and will fail to access the default datadir. Move users with recent stateVersion to a non-default datadir recommended by: https://github.com/NixOS/nixpkgs/pull/556611 Users with existing profiles under default datadir will have to migrate them to a different location on macOS 27 upgrade. Migrating existing directory is out of scope for Home Manager.
75 lines
1.7 KiB
Nix
75 lines
1.7 KiB
Nix
{
|
|
expectedDarwinPath,
|
|
packageIsNull ? false,
|
|
stateVersion,
|
|
}:
|
|
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.programs.firefox;
|
|
|
|
expectedConfigPath =
|
|
if pkgs.stdenv.hostPlatform.isDarwin then expectedDarwinPath else ".config/mozilla/firefox";
|
|
|
|
expectedAppDataDir =
|
|
if
|
|
pkgs.stdenv.hostPlatform.isDarwin && !packageIsNull && lib.versionAtLeast stateVersion "26.11"
|
|
then
|
|
"${config.home.homeDirectory}/${expectedDarwinPath}"
|
|
else
|
|
null;
|
|
|
|
firefoxPackage = lib.makeOverridable (
|
|
{
|
|
cfg ? { },
|
|
extraPolicies ? { },
|
|
pkcs11Modules ? [ ],
|
|
appDataDir ? null,
|
|
}:
|
|
builtins.deepSeq
|
|
[
|
|
cfg
|
|
extraPolicies
|
|
pkcs11Modules
|
|
]
|
|
(
|
|
config.lib.test.mkStubPackage {
|
|
name = "firefox-config-path-darwin-default-test-stub";
|
|
extraAttrs = {
|
|
browserName = "firefox";
|
|
inherit appDataDir;
|
|
meta.mainProgram = "firefox";
|
|
};
|
|
}
|
|
)
|
|
) { };
|
|
in
|
|
{
|
|
config = lib.mkIf config.test.enableBig {
|
|
home.stateVersion = stateVersion;
|
|
|
|
programs.firefox = {
|
|
enable = true;
|
|
package = if packageIsNull then null else firefoxPackage;
|
|
profiles.test.settings."general.smoothScroll" = false;
|
|
};
|
|
|
|
assertions = [
|
|
{
|
|
assertion = cfg.configPath == expectedConfigPath;
|
|
message = "Firefox configPath has an unexpected default";
|
|
}
|
|
{
|
|
assertion = cfg.finalPackage == null || cfg.finalPackage.appDataDir == expectedAppDataDir;
|
|
message = "Firefox wrapper received an unexpected appDataDir";
|
|
}
|
|
];
|
|
|
|
mozilla.firefoxNativeMessagingHosts = lib.mkForce [ ];
|
|
};
|
|
}
|