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
This commit is contained in:
Martin Weinelt 2022-05-22 01:49:20 +02:00
parent 0750e47a4d
commit 2d97db7873
No known key found for this signature in database
GPG key ID: 87C1E9888F856759

View file

@ -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?