firefox: set non-default configPath on darwin

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.
This commit is contained in:
Ihar Hrachyshka
2026-08-27 18:51:59 -04:00
committed by Austin Horstman
parent 922a645e84
commit c41f8b81d1
3 changed files with 98 additions and 0 deletions

View File

@@ -93,6 +93,17 @@ in
config = lib.mkIf cfg.enable {
warnings = lib.optional linuxConfigPathStateVersion.shouldWarn linuxConfigPathStateVersion.warning;
# On macOS 27+, Firefox builds not signed by Mozilla cannot access the
# traditional data directory. Use org.nixos.firefox directory instead.
# When package is null, we don't know if it's a signed version (e.g.
# firefox-bin-unwrapped or from Homebrew) or not, so we leave it up to the
# user to adjust as needed.
programs.firefox.configPath = lib.mkIf (
pkgs.stdenv.hostPlatform.isDarwin
&& cfg.package != null
&& lib.versionAtLeast config.home.stateVersion "26.11"
) (lib.mkDefault "Library/Application Support/org.nixos.firefox");
mozilla.firefoxNativeMessagingHosts =
cfg.nativeMessagingHosts
# package configured native messaging hosts (entire browser actually)