Firefox/en: Difference between revisions

FuzzyBot (talk | contribs)
Updating to match new version of source page
FuzzyBot (talk | contribs)
Updating to match new version of source page
Tags: Mobile edit Mobile web edit
 
Line 1: Line 1:
[https://www.mozilla.org/firefox Firefox] is a graphical web browser developed by Mozilla. It can be used with a [[Firefox Sync Server]].
<languages/>
{{infobox application
  |name=Mozilla Firefox
  |image=Firefox logo, 2019.svg
  |type=Web Browser
  |developer=Mozilla Foundation & Community
  |firstRelease=November 9, 2004
  |latestRelease=Firefox 140.0 (June 24, 2025)
  |status=Active
  |license=[https://www.mozilla.org/MPL/2.0/ Mozilla Public License 2.0]
  |os=Cross-platform (Linux, macOS, Windows, *BSD)
  |website=[https://www.mozilla.org/firefox mozilla.org/firefox]
  |github=mozilla/firefox
  |bugTracker=[https://bugzilla.mozilla.org/ Bugzilla]
  |documentation=[https://support.mozilla.org/ Official Support]
}}
<strong>Firefox</strong><ref>Mozilla Foundation, "Firefox", Official Website, Accessed June 2025. https://www.mozilla.org/firefox</ref> is a free and open-source web browser developed by the Mozilla Foundation. It is known for its focus on privacy, security, and user freedom, offering a customizable experience through a rich ecosystem of add-ons and themes.
 
== Installation ==
== Installation ==
Set <code>programs.firefox.enable</code> to true in your system or [[Home Manager]] configuration.
Keep in mind that the NixOS and Home Manager modules have different options, so choose accordingly.
== Firefox Variants ==
There are several Firefox variants that you can choose to install. To choose a variant, set <code>programs.firefox.package</code> accordingly.
'''Note:''' The packages for the variants listed below are installed ''instead'' of the normal <code>firefox</code> package. Thus, you'll have to choose one among these options.
=== Variant: Official Binaries ===
Mozilla provides official pre-built Firefox binaries. This is the <code>firefox-bin</code> package and will be downloaded directly from the Mozilla servers.
=== Variant: ESR ===
<code>firefox-esr</code> is the '''E'''xtended '''S'''upport '''R'''elease of Firefox provided by Mozilla, which receives only security updates and a more relaxed cadence of feature implementation.
=== Variant: Nightly ===
Nightly builds are daily builds of Firefox from the central Mozilla repository.
==== Reproducible ====
This method uses flakes to pull in nightly versions of Firefox in a reproducible way, and is recommended for use. If you don't want to use flakes, check out the next section.


First, add the following inputs to your flake:
==== Shell ====
<syntaxhighlight lang="nix">
 
inputs = {
{{code|lang=bash|line=no|1=$ nix-shell -p firefox}}
   firefox.url = "github:nix-community/flake-firefox-nightly";
 
   firefox.inputs.nixpkgs.follows = "nixpkgs";
The command above makes <code>firefox</code> available in your current shell without modifying any configuration files.
 
==== System setup ====
 
{{code|lang=nix|line=no|1=# Example for /etc/nixos/configuration.nix
environment.systemPackages = [
   pkgs.firefox
];
 
# User-specific installation (in ~/.config/nixpkgs/home.nix)
home.packages = [
  pkgs.firefox
];}}
After rebuilding with <code>nixos-rebuild switch</code>, Firefox will be installed system-wide.
 
== Configuration ==
 
==== Basic ====
 
{{code|lang=nix|line=no|1=
programs.firefox = {
  enable = true;
 
  languagePacks = [ "en-US" "de" "fr" ];
 
   preferences = {
    "browser.startup.homepage"      = "https://example.com";
    "privacy.resistFingerprinting" = true;
  };
 
  policies = {
    DisableTelemetry = true;
  };
};
};
</syntaxhighlight>
}}
Then, using the [[Flakes#Using_nix_flakes_with_NixOS|specialArgs]] attribute to pass flake inputs to external configuration files, add the nightly package to your system:
 
<syntaxhighlight lang="nix">
The snippet above enables Firefox for all users (or the current Home Manager profile, if placed in <code>home.nix</code>).
{ pkgs, inputs, config, ... }:
 
{
==== Advanced ====
  environment.systemPackages = [
 
    inputs.firefox.packages.${pkgs.system}.firefox-nightly-bin
Home Manager allows for deep customization of Firefox, including extensions, search engines, bookmarks, and themes. The example below shows a configuration for adding custom search engines with aliases.
   ];
 
}
{{code|lang=nix|line=no|1=
</syntaxhighlight>
programs.firefox = {
The downside of using this method is that you'll have to update the flake input before you can get a new nightly version, which also means that you might miss new builds since the flake lags behind the nightly release.
  enable = true;
==== Non-reproducible (Impure) ====
 
Using this method is bad for reproducibility since it fetches resources from non-pinned URLs, but it also means you always get the latest nightly version when you build your system.
  languagePacks = [ "en-US" ];
{{tip|1=If you don't want to use flakes but you still want to reproducibly install Firefox nightly, you might want to use this method with [https://github.com/nmattia/niv niv].}}
 
<syntaxhighlight lang="nix">
   policies = {
nixpkgs.overlays =
    # Updates & Background Services
  let
    AppAutoUpdate                = false;
     # Change this to a rev sha to pin
    BackgroundAppUpdate          = false;
     moz-rev = "master";
 
     moz-url = builtins.fetchTarball { url = "https://github.com/mozilla/nixpkgs-mozilla/archive/${moz-rev}.tar.gz";};
    # Feature Disabling
     nightlyOverlay = (import "${moz-url}/firefox-overlay.nix");
    DisableBuiltinPDFViewer      = true;
  in [
    DisableFirefoxStudies        = true;
    nightlyOverlay
    DisableFirefoxAccounts        = true;
  ];
    DisableFirefoxScreenshots    = true;
programs.firefox.package = pkgs.latest.firefox-nightly-bin;
    DisableForgetButton          = true;
</syntaxhighlight>
    DisableMasterPasswordCreation = true;
Once you've added the overlay, you'll need to pass the <code>--impure</code> option to nix commands. For example, in order to build and activate your configuration, you'll have to run:
    DisableProfileImport          = true;
<syntaxHighlight lang="console">
    DisableProfileRefresh        = true;
$ nixos-rebuild switch --impure
    DisableSetDesktopBackground  = true;
</syntaxHighlight>
    DisablePocket                = true;
== Customizing with [[Home Manager]] ==
    DisableTelemetry              = true;
Home manager allows more customization for firefox. Such as  extensions, search engines, bookmarks, [https://www.userchrome.org/ userChrome] and [https://kb.mozillazine.org/User.js_file user.js]. The example below shows a basic config defining Nix packages & options as a search engine.
    DisableFormHistory            = true;
[https://nix-community.github.io/home-manager/options.xhtml More options are available on Home Manager's site]
    DisablePasswordReveal        = true;
<syntaxhighlight lang="nix">
 
home-manager.users.username = {
    # Access Restrictions
  programs.firefox = {
    BlockAboutConfig              = false;
     enable = true;
    BlockAboutProfiles            = true;
     profiles = {
    BlockAboutSupport            = true;
       "user" = {
 
         id = 0;
    # UI and Behavior
        isDefault = true;
    DisplayMenuBar                = "never";
    DontCheckDefaultBrowser      = true;
    HardwareAcceleration          = false;
     OfferToSaveLogins            = false;
     DefaultDownloadDirectory      = "${home}/Downloads";
 
    # Extensions
     ExtensionSettings = let
      moz = short: "https://addons.mozilla.org/firefox/downloads/latest/${short}/latest.xpi";
     in {
      "*".installation_mode = "blocked";
 
      "uBlock0@raymondhill.net" = {
        install_url      = moz "ublock-origin";
        installation_mode = "force_installed";
        updates_disabled  = true;
      };
 
      "{f3b4b962-34b4-4935-9eee-45b0bce58279}" = {
        install_url      = moz "animated-purple-moon-lake";
        installation_mode = "force_installed";
        updates_disabled  = true;
      };
 
      "{73a6fe31-595d-460b-a920-fcc0f8843232}" = {
        install_url      = moz "noscript";
        installation_mode = "force_installed";
        updates_disabled  = true;
      };
     };
 
     # Extension configuration
    "3rdparty".Extensions = {
       "uBlock0@raymondhill.net".adminSettings = {
         userSettings = rec {
          uiTheme            = "dark";
          uiAccentCustom    = true;
          uiAccentCustom0    = "#8300ff";
          cloudStorageEnabled = mkForce false;
 
          importedLists = [
            "https:#filters.adtidy.org/extension/ublock/filters/3.txt"
            "https:#github.com/DandelionSprout/adfilt/raw/master/LegitimateURLShortener.txt"
          ];


        search.engines = {
           externalLists = lib.concatStringsSep "\n" importedLists;
          "Nix Packages" = {
            urls = [{
              template = "https://search.nixos.org/packages";
              params = [
                { name = "query"; value = "{searchTerms}"; }
              ];
            }];
            icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
            definedAliases = [ "@np" ];
           };
          "Nix Options" = {
            definedAliases = [ "@no" ];
            urls = [{
              template = "https://search.nixos.org/options";
              params = [
                { name = "query"; value = "{searchTerms}"; }
              ];
            }];
          };
         };
         };
        selectedFilterLists = [
          "CZE-0"
          "adguard-generic"
          "adguard-annoyance"
          "adguard-social"
          "adguard-spyware-url"
          "easylist"
          "easyprivacy"
          "https:#github.com/DandelionSprout/adfilt/raw/master/LegitimateURLShortener.txt"
          "plowe-0"
          "ublock-abuse"
          "ublock-badware"
          "ublock-filters"
          "ublock-privacy"
          "ublock-quick-fixes"
          "ublock-unbreak"
          "urlhaus-1"
        ];
       };
       };
     };
     };
   };
   };
</syntaxhighlight>
== FAQ ==
=== How do I use ALSA with Firefox instead of PulseAudio? ===
<syntaxhighlight lang="nix">
programs.firefox.package = (pkgs.wrapFirefox.override { libpulseaudio = pkgs.libpressureaudio; }) pkgs.firefox-unwrapped { };
</syntaxhighlight>
== Tips ==
=== Enabling
[https://community.kde.org/Plasma/Browser_Integration#How_to_install Plasma Browser Integration] ===
1. Add the following line to your <code>configuration.nix</code> (note that [[KDE#Installation|enabling Plasma]] automatically does this):


<syntaxhighlight lang="nix">
  profiles.default.search = {
programs.firefox.nativeMessagingHosts.packages = [ pkgs.plasma5Packages.plasma-browser-integration ];
    force          = true;
</syntaxhighlight>
    default        = "DuckDuckGo";
2. Install [https://addons.mozilla.org/en-US/firefox/addon/plasma-integration/ KDE's Firefox extension].
    privateDefault  = "DuckDuckGo";
=== Use KDE file picker ===
 
You must instruct Firefox to use the file picker offered by the XDG Desktop Portal framework. This setting can be found in Firefox's ''about:config'' as ''widget.use-xdg-desktop-portal.file-picker''. The value 1 means "always". To set it using NixOS, add to '<code>configuration.nix'</code>
    engines = {
<syntaxhighlight lang="nix">
      "Nix Packages" = {
  # Make Firefox use the KDE file picker.
        urls = [
  # Preferences source: https://wiki.archlinux.org/title/firefox#KDE_integration
          {
  programs.firefox = {
            template = "https://search.nixos.org/packages";
    enable = true;
            params = [
    preferences = {
              { name = "channel"; value = "unstable"; }
      "widget.use-xdg-desktop-portal.file-picker" = 1;
              { name = "query";  value = "{searchTerms}"; }
            ];
          }
        ];
        icon          = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
        definedAliases = [ "@np" ];
      };
 
      "Nix Options" = {
        urls = [
          {
            template = "https://search.nixos.org/options";
            params = [
              { name = "channel"; value = "unstable"; }
              { name = "query";  value = "{searchTerms}"; }
            ];
          }
        ];
        icon          = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
        definedAliases = [ "@no" ];
      };
 
      "NixOS Wiki" = {
        urls = [
          {
            template = "https://wiki.nixos.org/w/index.php";
            params = [
              { name = "search"; value = "{searchTerms}"; }
            ];
          }
        ];
        icon          = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
        definedAliases = [ "@nw" ];
      };
     };
     };
   };
   };
</syntaxhighlight>
=== Use xinput2 ===
You can make Firefox use xinput2 by setting the <code>MOZ_USE_XINPUT2</code> environment variable. This improves touchscreen support and enables additional touchpad gestures. It also enables smooth scrolling as opposed to the stepped scrolling that Firefox has by default. To do this, put the following in your config:
<syntaxhighlight lang="nix">
environment.sessionVariables = {
  MOZ_USE_XINPUT2 = "1";
};
};
</syntaxhighlight>
}}
== Troubleshooting==
 
=== If you can't start the browser because of a configuration error ===  
[https://nix-community.github.io/home-manager/options.xhtml#opt-programs.firefox.enable More options are available on Home Manager's site.]
 
== Firefox Variants ==
 
There are several Firefox variants available. To choose one, set the <code>programs.firefox.package</code> option accordingly.
 
{{Note|The packages for the variants listed below are installed ''instead'' of the normal <code>firefox</code> package.}}
 
=== Variant: Official Binaries ===
 
Mozilla provides official pre-built Firefox binaries via the <code>firefox-bin</code> package, which are downloaded directly from Mozilla's servers.
 
=== Variant: Extended Support Release (ESR) ===
 
<code>firefox-esr</code> is a variant that receives security updates for a longer period with a slower feature implementation cadence. It also allows for more extensive policy-based configuration.
 
=== Variant: Nightly ===


For example:
Nightly builds are daily builds from the central Mozilla repository.
<syntaxhighlight lang="text">
firefox
1554035168269 Marionette FATAL XML parsing error: undefined entity
Location: chrome://browser/content/browser.xul
Line 2526, column 13:            <toolbarbutton id="tracking-protection-preferences-button"
JavaScript error: resource:///modules/aboutpages/AboutPrivateBrowsingHandler.jsm, line 28: TypeError: this.pageListener is undefined
</syntaxhighlight>
An easy way to get away from this is to start firefox with the <code>firefox -safe-mode</code> command. Then you can troubleshoot your actual problem or you can call your luck by calling the refresh option (a special button will appear when firefox starts in this mode). This will reset your configuration to a sane state and you will be usually able to start the browser again, but you will lose most of your customization.
=== <code>nativeMessagingHosts</code> doesn't work ===
Such as <code>enablePlasmaBrowserIntegration</code>, <code>enableGnomeExtensions</code>, and <code>enableBrowserpass</code>.


They do not work with the <code>firefox-bin</code> derivation<ref>https://github.com/NixOS/nixpkgs/issues/47340#issuecomment-476368401</ref> or with <code>firefox</code> installed via <code>nix-env</code>
==== Method 1: Using nix-community/flake-firefox-nightly ====
<hr />
 
<references />
This method is reproducible but may lag behind the upstream version. First, add the input to your flake:
=== Screen Sharing under Wayland ===
 
When using Firefox with Wayland, screen sharing options might be limited and require additional configuration (exact capabilities vary with different compositors).
{{code|lang=nix|line=no|1=
* add Pipewire support to Firefox:
inputs = {
<syntaxhighlight lang="nix">
  firefox.url = "github:nix-community/flake-firefox-nightly";
# when programs.firefox.enable == true
   firefox.inputs.nixpkgs.follows = "nixpkgs";
programs.firefox.wrapperConfig = {
   pipewireSupport = true;
};
};
}}


# or, alternatively
Then, add the package to your system:


{{code|lang=nix|line=no|1=
# In configuration.nix, assuming use of specialArgs
environment.systemPackages = [
environment.systemPackages = [
   # Replace this
   inputs.firefox.packages.${pkgs.stdenv.hostPlatform.system}.firefox-nightly-bin
  pkgs.firefox
];
  # With this
}}
   (pkgs.wrapFirefox (pkgs.firefox-unwrapped.override { pipewireSupport = true;}) {})
 
==== Method 2: Using mozilla/nixpkgs-mozilla ====
 
This method is not necessarily reproducible without a flake-like system but will always be the latest version.
 
{{code|lang=nix|line=no|1=
nixpkgs.overlays = [
   (import (builtins.fetchTarball "https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz"))
];
];
</syntaxhighlight>
programs.firefox.package = pkgs.latest.firefox-nightly-bin;
* Enable [https://pipewire.org/ PipeWire]
}}
<syntaxhighlight lang="nix">
 
Using this method requires the <code>--impure</code> flag for Nix commands, for example:
 
{{code|lang=bash|line=no|1=$ nixos-rebuild switch --impure}}
 
== Tips and Tricks ==
 
==== Force XWayland (X11) instead of Wayland ====
 
Firefox defaults to native Wayland when running under a Wayland compositor. To force it to use XWayland (X11) instead:
 
{{code|lang=nix|line=no|1=environment.sessionVariables.MOZ_ENABLE_WAYLAND = "0";}}
 
This is useful when troubleshooting Wayland-specific issues or when certain features work better under X11.
 
==== Touchpad Gestures and Smooth Scrolling ====
 
Enable <code>xinput2</code> to improve touchscreen support and enable additional touchpad gestures and smooth scrolling.
 
{{code|lang=nix|line=no|1=
environment.sessionVariables.MOZ_USE_XINPUT2 = "1";
}}
 
==== KDE Plasma Integration ====
 
1. Add the native messaging host package to your configuration:
 
{{code|lang=nix|line=no|1=programs.firefox.nativeMessagingHosts.packages = [ pkgs.kdePackages.plasma-browser-integration ];}}
 
2. Install the corresponding [https://addons.mozilla.org/en-US/firefox/addon/plasma-integration/ browser add-on].
 
==== Use KDE file picker ====
 
To use the KDE file picker instead of the GTK one, set the following preference:
 
{{code|lang=nix|line=no|1=
programs.firefox.preferences = {
  "widget.use-xdg-desktop-portal.file-picker" = 1;
};
}}
 
== Troubleshooting ==
 
==== Native Messaging Hosts Fail to Load ====
 
Native messaging hosts (used for extensions like Plasma Integration) do not work with the <code>-bin</code> variants of Firefox or with Firefox installed imperatively via <code>nix-env</code>. You must use a variant built from source via your NixOS or Home Manager configuration.
 
==== ALSA audio instead of PulseAudio ====
 
To force Firefox to use ALSA, you can override it with a wrapper:
 
{{code|lang=nix|line=no|1=programs.firefox.package = pkgs.wrapFirefox pkgs.firefox-unwrapped { libpulseaudio = pkgs.libalsa; };}}
 
==== Screen Sharing under Wayland ====
 
Screen sharing on Wayland requires enabling PipeWire and the appropriate XDG Desktop Portals.
 
{{code|lang=nix|line=no|1=
services.pipewire.enable = true;
services.pipewire.enable = true;
</syntaxhighlight>
xdg.portal = {
* Enable [https://github.com/flatpak/xdg-desktop-portal/blob/master/README.md xdg desktop integration]:
   enable = true;
<syntaxhighlight lang="nix">
  # Add the portal for your compositor, e.g.:
xdg = {
  extraPortals = with pkgs; [
   portal = {
    xdg-desktop-portal-wlr # For Sway/wlroots
    enable = true;
    # xdg-desktop-portal-gtk # For GNOME
    extraPortals = with pkgs; [
     # xdg-desktop-portal-kde # For KDE
      xdg-desktop-portal-wlr
   ];
      xdg-desktop-portal-gtk
     ];
   };
};
};
</syntaxhighlight>
}}
* Set environment variables to hint Firefox to use Wayland features. E.g.:
 
<syntaxhighlight lang="nix">
== See also ==
# Classical NixOS setup
 
environment.sessionVariables = {
* [[Home Manager]] – Declarative per-user configuration
  # only needed for Sway
* [https://search.nixos.org/options?channel=unstable&query=programs.firefox NixOS options for Firefox]
  XDG_CURRENT_DESKTOP = "sway";
* [https://discourse.nixos.org/tag/firefox Firefox topics on NixOS Discourse]
};
 
</syntaxhighlight>
== References ==
<syntaxhighlight lang="nix">
# Home Manager setup
home.sessionVariables = {
  # only needed for Sway
  XDG_CURRENT_DESKTOP = "sway";
};
</syntaxhighlight>
* Ensure that the environment variables are correctly set for the user systemd units, e.g.
# Sway users might achieve this by adding the following to their Sway config file
# This ensures all user units started after the command (not those already running) set the variables
<syntaxhighlight lang="bash">
exec systemctl --user import-environment
</syntaxhighlight>


[[Category:Cookbook]]
[[Category:Applications]]
[[Category:Applications]]
[[Category:Web Browser]]