Merge pull request #244591 from Infinidoge/fix/firefox-signing

buildMozillaMach: add options to disable signing requirement and to enable addon sideloading
This commit is contained in:
Martin Weinelt 2023-11-19 21:13:16 +01:00 committed by GitHub
commit c423e3dda7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 14 deletions

View File

@ -7,6 +7,8 @@
, application ? "browser"
, applicationName ? "Mozilla Firefox"
, branding ? null
, requireSigning ? true
, allowAddonSideload ? false
, src
, unpackPhase ? null
, extraPatches ? []
@ -367,6 +369,8 @@ buildStdenv.mkDerivation {
configureFlagsArray+=("--with-mozilla-api-keyfile=$TMPDIR/mls-api-key")
'' + lib.optionalString (enableOfficialBranding && !stdenv.is32bit) ''
export MOZILLA_OFFICIAL=1
'' + lib.optionalString (!requireSigning) ''
export MOZ_REQUIRE_SIGNING=
'' + lib.optionalString stdenv.hostPlatform.isMusl ''
# linking firefox hits the vm.max_map_count kernel limit with the default musl allocator
# TODO: Default vm.max_map_count has been increased, retest without this
@ -408,6 +412,7 @@ buildStdenv.mkDerivation {
# https://bugzilla.mozilla.org/show_bug.cgi?id=1482204
++ lib.optional (ltoSupport && (buildStdenv.isAarch32 || buildStdenv.isi686 || buildStdenv.isx86_64)) "--disable-elf-hack"
++ lib.optional (!drmSupport) "--disable-eme"
++ lib.optional (allowAddonSideload) "--allow-addon-sideload"
++ [
(enableFeature alsaSupport "alsa")
(enableFeature crashreporterSupport "crashreporter")

View File

@ -56,10 +56,11 @@
};
};
firefox-devedition = (buildMozillaMach rec {
firefox-devedition = buildMozillaMach rec {
pname = "firefox-devedition";
version = "120.0b9";
applicationName = "Mozilla Firefox Developer Edition";
requireSigning = false;
branding = "browser/branding/aurora";
src = fetchurl {
url = "mirror://mozilla/devedition/releases/${version}/source/firefox-${version}.source.tar.xz";
@ -84,9 +85,7 @@
versionSuffix = "b[0-9]*";
baseUrl = "https://archive.mozilla.org/pub/devedition/releases/";
};
}).overrideAttrs (prev: {
env.MOZ_REQUIRE_SIGNING = "";
});
};
firefox-esr-115 = buildMozillaMach rec {
pname = "firefox-esr-115";

View File

@ -115,18 +115,15 @@ let
nameArray = builtins.map(a: a.name) (lib.optionals usesNixExtensions nixExtensions);
requiresSigning = browser ? MOZ_REQUIRE_SIGNING
-> toString browser.MOZ_REQUIRE_SIGNING != "";
# Check that every extension has a unqiue .name attribute
# and an extid attribute
extensions = if nameArray != (lib.unique nameArray) then
throw "Firefox addon name needs to be unique"
else if requiresSigning && !lib.hasSuffix "esr" browser.name then
throw "Nix addons are only supported without signature enforcement (eg. Firefox ESR)"
else if browser.requireSigning || !browser.allowAddonSideload then
throw "Nix addons are only supported with signature enforcement disabled and addon sideloading enabled (eg. LibreWolf)"
else builtins.map (a:
if ! (builtins.hasAttr "extid" a) then
throw "nixExtensions has an invalid entry. Missing extid attribute. Please use fetchfirefoxaddon"
throw "nixExtensions has an invalid entry. Missing extid attribute. Please use fetchFirefoxAddon"
else
a
) (lib.optionals usesNixExtensions nixExtensions);

View File

@ -3,12 +3,14 @@
let
librewolf-src = callPackage ./librewolf.nix { };
in
((buildMozillaMach rec {
(buildMozillaMach rec {
pname = "librewolf";
applicationName = "LibreWolf";
binaryName = "librewolf";
version = librewolf-src.packageVersion;
src = librewolf-src.firefox;
requireSigning = false;
allowAddonSideload = true;
inherit (librewolf-src) extraConfigureFlags extraPatches extraPostPatch extraPassthru;
meta = {
@ -30,6 +32,4 @@ in
}).override {
crashreporterSupport = false;
enableOfficialBranding = false;
}).overrideAttrs (prev: {
MOZ_REQUIRE_SIGNING = "";
})
}