Merge pull request #173738 from mweinelt/firefox-mls

This commit is contained in:
Martin Weinelt 2022-05-24 20:08:46 +02:00 committed by GitHub
commit c5e0d57cdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,6 +103,7 @@
, crashreporterSupport ? !privacySupport
, geolocationSupport ? !privacySupport
, googleAPISupport ? geolocationSupport
, mlsAPISupport ? geolocationSupport
, webrtcSupport ? !privacySupport
# digital rights managemewnt
@ -185,6 +186,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 ({
@ -304,11 +317,17 @@ buildStdenv.mkDerivation ({
'' + lib.optionalString googleAPISupport ''
# Google API key used by Chromium and Firefox.
# Note: These are for NixOS/nixpkgs use ONLY. For your own distribution,
# please get your own set of keys.
echo "AIzaSyDGi15Zwl11UNe6Y-5XW_upsfyw31qwZPI" > $TMPDIR/ga
# please get your own set of keys at https://www.chromium.org/developers/how-tos/api-keys/.
echo "AIzaSyDGi15Zwl11UNe6Y-5XW_upsfyw31qwZPI" > $TMPDIR/google-api-key
# 60.5+ & 66+ did split the google API key arguments: https://bugzilla.mozilla.org/show_bug.cgi?id=1531176
configureFlagsArray+=("--with-google-location-service-api-keyfile=$TMPDIR/ga")
configureFlagsArray+=("--with-google-safebrowsing-api-keyfile=$TMPDIR/ga")
configureFlagsArray+=("--with-google-location-service-api-keyfile=$TMPDIR/google-api-key")
configureFlagsArray+=("--with-google-safebrowsing-api-keyfile=$TMPDIR/google-api-key")
'' + lib.optionalString mlsAPISupport ''
# Mozilla Location services API key
# Note: These are for NixOS/nixpkgs use ONLY. For your own distribution,
# please get your own set of keys at https://location.services.mozilla.com/api.
echo "dfd7836c-d458-4917-98bb-421c82d3c8a0" > $TMPDIR/mls-api-key
configureFlagsArray+=("--with-mozilla-api-keyfile=$TMPDIR/mls-api-key")
'' + lib.optionalString enableOfficialBranding ''
export MOZILLA_OFFICIAL=1
'';
@ -467,6 +486,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?