From 489f834fcfb6b09fb64addef368ae82024b2e11b Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Thu, 3 Apr 2025 23:21:53 -0400 Subject: [PATCH 1/2] firefox: don't include xdg-open in wrapped closure on darwin xdg-open is not used by MacOS to open URIs. This reduces the closure size from ~2.5G to ~800M on Darwin. Signed-off-by: Ihar Hrachyshka --- pkgs/applications/networking/browsers/firefox/wrapper.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/networking/browsers/firefox/wrapper.nix b/pkgs/applications/networking/browsers/firefox/wrapper.nix index f6244310858a..3cc7dc962cc2 100644 --- a/pkgs/applications/networking/browsers/firefox/wrapper.nix +++ b/pkgs/applications/networking/browsers/firefox/wrapper.nix @@ -330,7 +330,7 @@ let "1" ] - ++ lib.optionals (!xdg-utils.meta.broken) [ + ++ lib.optionals (!xdg-utils.meta.broken && !isDarwin) [ # make xdg-open overridable at runtime "--suffix" "PATH" From 7bdcd453f2ceee0da7f334b0b743f9a595a6f0eb Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Fri, 4 Apr 2025 18:36:30 -0400 Subject: [PATCH 2/2] firefox: additional closure cleanup for darwin gtk, libcanberra, glvnd, pulseaudio, gsettings - none are used on Darwin. Neither Wayland variables are needed on the platform. Signed-off-by: Ihar Hrachyshka --- .../networking/browsers/firefox/wrapper.nix | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/pkgs/applications/networking/browsers/firefox/wrapper.nix b/pkgs/applications/networking/browsers/firefox/wrapper.nix index 3cc7dc962cc2..64cc87a62425 100644 --- a/pkgs/applications/networking/browsers/firefox/wrapper.nix +++ b/pkgs/applications/networking/browsers/firefox/wrapper.nix @@ -49,7 +49,7 @@ let wmClass ? applicationName, nativeMessagingHosts ? [ ], pkcs11Modules ? [ ], - useGlvnd ? true, + useGlvnd ? (!isDarwin), cfg ? config.${applicationName} or { }, ## Following options are needed for extra prefs & policies @@ -109,13 +109,13 @@ let zlib ] ) - ++ lib.optional (config.pulseaudio or true) libpulseaudio + ++ lib.optional (config.pulseaudio or (!isDarwin)) libpulseaudio ++ lib.optional alsaSupport alsa-lib ++ lib.optional sndioSupport sndio ++ lib.optional jackSupport libjack2 ++ lib.optional smartcardSupport opensc ++ pkcs11Modules - ++ gtk_modules; + ++ lib.optionals (!isDarwin) gtk_modules; gtk_modules = [ libcanberra-gtk3 ]; # Darwin does not rename bundled binaries @@ -289,7 +289,7 @@ let lndir jq ]; - buildInputs = [ browser.gtk3 ]; + buildInputs = lib.optionals (!isDarwin) [ browser.gtk3 ]; makeWrapperArgs = [ @@ -298,11 +298,6 @@ let ":" "${finalAttrs.libs}" - "--suffix" - "GTK_PATH" - ":" - "${lib.concatStringsSep ":" finalAttrs.gtk_modules}" - "--suffix" "PATH" ":" @@ -319,6 +314,12 @@ let "--set" "MOZ_ALLOW_DOWNGRADE" "1" + ] + ++ lib.optionals (!isDarwin) [ + "--suffix" + "GTK_PATH" + ":" + "${lib.concatStringsSep ":" finalAttrs.gtk_modules}" "--suffix" "XDG_DATA_DIRS" @@ -457,8 +458,11 @@ let oldExe="$executablePrefix/.${applicationName}"-old mv "$executablePath" "$oldExe" fi - + '' + + lib.optionalString (!isDarwin) '' appendToVar makeWrapperArgs --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" + '' + + '' concatTo makeWrapperArgs oldWrapperArgs makeWrapper "$oldExe" "$out/${finalBinaryPath}" "''${makeWrapperArgs[@]}"