buildMozillaMach: Add distribution identifier and distribution.ini

Adds a distribution id useful for aggregation of crash statistics.

Also creates a NixOS flavor, visible through the About window, that is
also exposed through telemetry data, if enabled.
This commit is contained in:
Martin Weinelt 2022-05-16 00:26:57 +02:00
parent f9e1911d34
commit 318fae87c0
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759
4 changed files with 27 additions and 1 deletions

View File

@ -4,6 +4,7 @@
, updateScript ? null , updateScript ? null
, binaryName ? "firefox" , binaryName ? "firefox"
, application ? "browser" , application ? "browser"
, applicationName ? "Mozilla Firefox"
, src , src
, unpackPhase ? null , unpackPhase ? null
, extraPatches ? [] , extraPatches ? []
@ -18,6 +19,7 @@
{ lib { lib
, pkgs
, stdenv , stdenv
# build time # build time
@ -161,6 +163,22 @@ let
ln -s $lib $out/lib/wasm32-wasi ln -s $lib $out/lib/wasm32-wasi
done done
''; '';
distributionIni = pkgs.writeText "distribution.ini" (lib.generators.toINI {} {
# Some light branding indicating this build uses our distro preferences
Global = {
id = "nixos";
version = "1.0";
about = "${applicationName} for NixOS";
};
Preferences = {
# These values are exposed through telemetry
"app.distributor" = "nixos";
"app.distributor.channel" = "nixpkgs";
"app.partner.nixos" = "nixos";
};
});
in in
buildStdenv.mkDerivation ({ buildStdenv.mkDerivation ({
@ -290,6 +308,7 @@ buildStdenv.mkDerivation ({
"--enable-application=${application}" "--enable-application=${application}"
"--enable-default-toolkit=cairo-gtk3${lib.optionalString waylandSupport "-wayland"}" "--enable-default-toolkit=cairo-gtk3${lib.optionalString waylandSupport "-wayland"}"
"--enable-system-pixman" "--enable-system-pixman"
"--with-distribution-id=org.nixos"
"--with-libclang-path=${llvmPackages.libclang.lib}/lib" "--with-libclang-path=${llvmPackages.libclang.lib}/lib"
"--with-system-ffi" "--with-system-ffi"
"--with-system-icu" "--with-system-icu"
@ -429,7 +448,11 @@ buildStdenv.mkDerivation ({
cd mozobj cd mozobj
''; '';
postInstall = lib.optionalString buildStdenv.isLinux '' postInstall = ''
# Install distribution customizations
install -Dvm644 ${distributionIni} $out/lib/${binaryName}/distribution/distribution.ini
'' + lib.optionalString buildStdenv.isLinux ''
# Remove SDK cruft. FIXME: move to a separate output? # Remove SDK cruft. FIXME: move to a separate output?
rm -rf $out/share/idl $out/include $out/lib/${binaryName}-devel-* rm -rf $out/share/idl $out/include $out/lib/${binaryName}-devel-*

View File

@ -29,6 +29,7 @@ rec {
firefox-esr-91 = buildMozillaMach rec { firefox-esr-91 = buildMozillaMach rec {
pname = "firefox-esr"; pname = "firefox-esr";
version = "91.9.0esr"; version = "91.9.0esr";
applicationName = "Mozilla Firefox ESR";
src = fetchurl { src = fetchurl {
url = "mirror://mozilla/firefox/releases/${version}/source/firefox-${version}.source.tar.xz"; url = "mirror://mozilla/firefox/releases/${version}/source/firefox-${version}.source.tar.xz";
sha512 = "fd69d489429052013d2c1b8b766a47920ecee62f0688505758f593b27ae66d6343b9107163749406251aedebdf836147e4d562415a811b04d7ab2ae31e32f133"; sha512 = "fd69d489429052013d2c1b8b766a47920ecee62f0688505758f593b27ae66d6343b9107163749406251aedebdf836147e4d562415a811b04d7ab2ae31e32f133";

View File

@ -5,6 +5,7 @@ let
in in
(buildMozillaMach rec { (buildMozillaMach rec {
pname = "librewolf"; pname = "librewolf";
applicationName = "LibreWolf";
binaryName = "librewolf"; binaryName = "librewolf";
version = librewolf-src.packageVersion; version = librewolf-src.packageVersion;
src = librewolf-src.firefox; src = librewolf-src.firefox;

View File

@ -12,6 +12,7 @@ rec {
pname = "thunderbird"; pname = "thunderbird";
version = "91.9.0"; version = "91.9.0";
application = "comm/mail"; application = "comm/mail";
applicationName = "Mozilla Thunderbird";
binaryName = pname; binaryName = pname;
src = fetchurl { src = fetchurl {
url = "mirror://mozilla/thunderbird/releases/${version}/source/thunderbird-${version}.source.tar.xz"; url = "mirror://mozilla/thunderbird/releases/${version}/source/thunderbird-${version}.source.tar.xz";