From 2d97db78736a4b60f4c6ab39350fa07fedc8ab3c Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Sun, 22 May 2022 01:49:20 +0200 Subject: [PATCH] buildMozillaMach: set geo.provider.network.url for new profiles. Use Mozilla Location Service as geolocation provider for new profiles, since our Google API key does not seem to work for geolocation at this time. Related: https://github.com/NixOS/nixpkgs/issues/173758 --- .../networking/browsers/firefox/common.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkgs/applications/networking/browsers/firefox/common.nix b/pkgs/applications/networking/browsers/firefox/common.nix index bb07a21d1705..c246ccec1135 100644 --- a/pkgs/applications/networking/browsers/firefox/common.nix +++ b/pkgs/applications/networking/browsers/firefox/common.nix @@ -180,6 +180,18 @@ let }; }); + defaultPrefs = { + "geo.provider.network.url" = { + value = "https://location.services.mozilla.com/v1/geolocate?key=%MOZILLA_API_KEY%"; + reason = "Use MLS by default for geolocation, since our Google API Keys are not working"; + }; + }; + + defaultPrefsFile = pkgs.writeText "nixos-default-prefs.js" (lib.concatStringsSep "\n" (lib.mapAttrsToList (key: value: '' + // ${value.reason} + pref("${key}", ${builtins.toJSON value.value}); + '') defaultPrefs)); + in buildStdenv.mkDerivation ({ @@ -458,6 +470,7 @@ buildStdenv.mkDerivation ({ postInstall = '' # Install distribution customizations install -Dvm644 ${distributionIni} $out/lib/${binaryName}/distribution/distribution.ini + install -Dvm644 ${defaultPrefsFile} $out/lib/${binaryName}/browser/defaults/preferences/nixos-default-prefs.js '' + lib.optionalString buildStdenv.isLinux '' # Remove SDK cruft. FIXME: move to a separate output?