Firefox: Difference between revisions

Dander (talk | contribs)
capitalize firefox; don't use "you"; tidy up
Qweered (talk | contribs)
m Modern alias
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<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]
}}
<translate>
<translate>
<!--T:1-->
<!--T:1-->
[https://www.mozilla.org/firefox Firefox] is a graphical web browser developed by Mozilla.
<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 == <!--T:3-->
 
==== Shell ==== <!--T:4-->
</translate>
</translate>
{{code|lang=bash|line=no|1=$ nix-shell -p firefox}}
<translate>
<translate>
== Installation == <!--T:2-->
<!--T:5-->
The command above makes <code>firefox</code> available in your current shell without modifying any configuration files.
 
==== System setup ==== <!--T:6-->
</translate>
</translate>
{{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
];}}
<translate>
<translate>
<!--T:3-->
<!--T:7-->
Set <code>programs.firefox.enable</code> to true in your system or [[Home Manager]] configuration.
After rebuilding with <code>nixos-rebuild switch</code>, Firefox will be installed system-wide.
Keep in mind that the NixOS and Home Manager modules have different options, so choose accordingly.
 
== Configuration == <!--T:8-->
 
==== Basic ==== <!--T:9-->
</translate>
</translate>
{{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;
  };
};
}}
<translate>
<!--T:10-->
The snippet above enables Firefox for all users (or the current Home Manager profile, if placed in <code>home.nix</code>).
==== Advanced ==== <!--T:11-->
</translate>
<translate>
<!--T:11a-->
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.
</translate>
{{code|lang=nix|line=no|1=
programs.firefox = {
  enable = true;
  languagePacks = [ "en-US" ];
  policies = {
    # Updates & Background Services
    AppAutoUpdate                = false;
    BackgroundAppUpdate          = false;
    # Feature Disabling
    DisableBuiltinPDFViewer      = true;
    DisableFirefoxStudies        = true;
    DisableFirefoxAccounts        = true;
    DisableFirefoxScreenshots    = true;
    DisableForgetButton          = true;
    DisableMasterPasswordCreation = true;
    DisableProfileImport          = true;
    DisableProfileRefresh        = true;
    DisableSetDesktopBackground  = true;
    DisablePocket                = true;
    DisableTelemetry              = true;
    DisableFormHistory            = true;
    DisablePasswordReveal        = true;
    # Access Restrictions
    BlockAboutConfig              = false;
    BlockAboutProfiles            = true;
    BlockAboutSupport            = true;
    # UI and Behavior
    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;
      };
      "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"
            ];
            externalLists = lib.concatStringsSep "\n" importedLists;
          };
          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"
          ];
        };
      };
    };
  };
  profiles.default.search = {
    force          = true;
    default        = "DuckDuckGo";
    privateDefault  = "DuckDuckGo";
    engines = {
      "Nix Packages" = {
        urls = [
          {
            template = "https://search.nixos.org/packages";
            params = [
              { name = "channel"; value = "unstable"; }
              { 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" ];
      };
    };
  };
};
}}
<translate>
<translate>
== Firefox Variants == <!--T:4-->
<!--T:11b-->
[https://nix-community.github.io/home-manager/options.xhtml#opt-programs.firefox.enable More options are available on Home Manager's site.]
</translate>
</translate>
<translate>
<translate>
<!--T:5-->
 
There are several Firefox variants that you can choose to install. To choose a variant, set <code>programs.firefox.package</code> accordingly.
== Firefox Variants == <!--T:12-->
</translate>
</translate>
<translate>
<translate>
<!--T:6-->
<!--T:13-->
'''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.
There are several Firefox variants available. To choose one, set the <code>programs.firefox.package</code> option accordingly.
</translate>
</translate>
{{Note|The packages for the variants listed below are installed ''instead'' of the normal <code>firefox</code> package.}}
<translate>
<translate>
=== Variant: Official Binaries === <!--T:7-->
=== Variant: Official Binaries === <!--T:14-->
</translate>
</translate>
<translate>
<translate>
<!--T:8-->
<!--T:15-->
Mozilla provides official pre-built Firefox binaries. This is the <code>firefox-bin</code> package and will be downloaded directly from the Mozilla servers.
Mozilla provides official pre-built Firefox binaries via the <code>firefox-bin</code> package, which are downloaded directly from Mozilla's servers.
</translate>
</translate>
<translate>
<translate>
=== Variant: Extended Support Release (ESR) === <!--T:9-->
=== Variant: Extended Support Release (ESR) === <!--T:16-->
</translate>
</translate>
<translate>
<translate>
<!--T:10-->
<!--T:17-->
<code>firefox-esr</code> is a variant of Firefox provided by Mozilla, which receives security updates for a longer period of time and a more relaxed cadence of feature implementation. It also allows users to change otherwise untouchable behavior with Firefox using policies.
<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.
</translate>
</translate>
<translate>
<translate>
=== Variant: Nightly === <!--T:11-->
=== Variant: Nightly === <!--T:18-->
</translate>
</translate>
<translate>
<translate>
<!--T:12-->
<!--T:19-->
Nightly builds are daily builds of Firefox from the central Mozilla repository.
Nightly builds are daily builds from the central Mozilla repository.
</translate>
</translate>
<translate>
<translate>
==== Method #1: Using nix-community/flake-firefox-nightly ==== <!--T:13-->
==== Method 1: Using nix-community/flake-firefox-nightly ==== <!--T:20-->
</translate>
</translate>
<translate>
<translate>
<!--T:14-->
<!--T:21-->
This method is reproducible but may lag behind the upstream version of Firefox Nightly. It uses flakes.
This method is reproducible but may lag behind the upstream version. First, add the input to your flake:
 
<!--T:15-->
First, add the following inputs to your flake:
</translate>
</translate>
<syntaxhighlight lang="nix">
{{code|lang=nix|line=no|1=
inputs = {
inputs = {
   firefox.url = "github:nix-community/flake-firefox-nightly";
   firefox.url = "github:nix-community/flake-firefox-nightly";
   firefox.inputs.nixpkgs.follows = "nixpkgs";
   firefox.inputs.nixpkgs.follows = "nixpkgs";
};
};
</syntaxhighlight>
}}
<translate>
<!--T:16-->
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:
</translate>
<syntaxhighlight lang="nix">
{ pkgs, inputs, config, ... }:
{
  environment.systemPackages = [
    inputs.firefox.packages.${pkgs.system}.firefox-nightly-bin
  ];
}
</syntaxhighlight>
==== Method #2: Using mozilla/nixpkgs-mozilla ==== <!--T:18-->
<nowiki></translate></nowiki>
<translate>
<!--T:19-->
This method is not necessarily reproducible without a [[Flake]]-like system because it fetches resources from non-pinned URLs, but it will always be the latest Nightly  version.
<syntaxhighlight lang="nix">
nixpkgs.overlays =
  let
    # Change this to a rev sha to pin
    moz-rev = "master";
    moz-url = builtins.fetchTarball { url = "https://github.com/mozilla/nixpkgs-mozilla/archive/${moz-rev}.tar.gz";};
    nightlyOverlay = (import "${moz-url}/firefox-overlay.nix");
  in [
    nightlyOverlay
  ];
programs.firefox.package = pkgs.latest.firefox-nightly-bin;
</syntaxhighlight>
</translate>
<translate>
<translate>
<!--T:22-->
<!--T:22-->
It is also needed to pass the <code>--impure</code> option to nix commands. For example,
Then, add the package to your system:
</translate>
</translate>
<syntaxHighlight lang="console">
{{code|lang=nix|line=no|1=
$ nixos-rebuild switch --impure
# In configuration.nix, assuming use of specialArgs
</syntaxHighlight>
environment.systemPackages = [
  inputs.firefox.packages.${pkgs.stdenv.hostPlatform.system}.firefox-nightly-bin
];
}}
<translate>
<translate>
== Customizing with [[Home Manager]] == <!--T:23-->
==== Method 2: Using mozilla/nixpkgs-mozilla ==== <!--T:23-->
</translate>
</translate>
<translate>
<translate>
<!--T:24-->
<!--T:24-->
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.
This method is not necessarily reproducible without a flake-like system but will always be the latest version.
</translate>
</translate>
{{code|lang=nix|line=no|1=
nixpkgs.overlays = [
  (import (builtins.fetchTarball "https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz"))
];
programs.firefox.package = pkgs.latest.firefox-nightly-bin;
}}
<translate>
<translate>
<!--T:25-->
<!--T:25-->
[https://nix-community.github.io/home-manager/options.xhtml More options are available on Home Manager's site]
Using this method requires the <code>--impure</code> flag for Nix commands, for example:
</translate>
</translate>
<syntaxhighlight lang="nix">
{{code|lang=bash|line=no|1=$ nixos-rebuild switch --impure}}
home-manager.users.username = {
  programs.firefox = {
    enable = true;
    profiles = {
      "user" = {
        id = 0;
        isDefault = true;


        search.engines = {
          "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}"; }
              ];
            }];
          };
        };
      };
    };
  };
</syntaxhighlight>
<translate>
<translate>
== FAQ == <!--T:26-->
== Tips and Tricks == <!--T:26-->
</translate>
</translate>
<translate>
<translate>
=== How do I use ALSA with Firefox instead of PulseAudio? === <!--T:27-->
==== Enhancing Privacy ==== <!--T:27-->
</translate>
</translate>
<syntaxhighlight lang="nix">
{{Note|Hardening Firefox often involves a trade-off between privacy and convenience. Some websites may not function correctly with aggressive settings.}}
programs.firefox.package = (pkgs.wrapFirefox.override { libpulseaudio = pkgs.libpressureaudio; }) pkgs.firefox-unwrapped { };
</syntaxhighlight>
<translate>
<translate>
== Tips == <!--T:28-->
<!--T:28-->
Beyond the declarative settings above, you can further enhance privacy:
* '''Container Tabs''': Use an extension like [https://addons.mozilla.org/en-US/firefox/addon/multi-account-containers/ Multi-Account Containers] to isolate websites from each other, preventing cross-site tracking.
* '''DNS over HTTPS (DoH)''': Encrypt your DNS queries by enabling DoH in Firefox's network settings to prevent ISP snooping.
</translate>
</translate>
<translate>
<translate>
<!--T:29-->
==== Wayland support ==== <!--T:29-->
=== Enabling
[https://community.kde.org/Plasma/Browser_Integration#How_to_install Plasma Browser Integration] ===
</translate>
</translate>
{{code|lang=nix|line=no|1=environment.sessionVariables.MOZ_ENABLE_WAYLAND = "1";}}
<translate>
<translate>
<!--T:30-->
<!--T:30-->
1. Add the following line to your <code>configuration.nix</code> (note that [[KDE#Installation|enabling Plasma]] automatically does this):
Setting the variable above makes Firefox use Wayland when available.
</translate>
</translate>
<syntaxhighlight lang="nix">
programs.firefox.nativeMessagingHosts.packages = [ pkgs.plasma5Packages.plasma-browser-integration ];
</syntaxhighlight>
<translate>
<translate>
<!--T:31-->
==== Touchpad Gestures and Smooth Scrolling ==== <!--T:31-->
2. Install [https://addons.mozilla.org/en-US/firefox/addon/plasma-integration/ KDE's Firefox extension].
</translate>
</translate>
<translate>
<translate>
=== Use KDE file picker === <!--T:32-->
<!--T:32-->
Enable <code>xinput2</code> to improve touchscreen support and enable additional touchpad gestures and smooth scrolling.
</translate>
</translate>
{{code|lang=nix|line=no|1=
environment.sessionVariables.MOZ_USE_XINPUT2 = "1";
}}
<translate>
<translate>
<!--T:33-->
==== KDE Plasma Integration ==== <!--T:33-->
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>
</translate>
</translate>
<syntaxhighlight lang="nix">
  # Make Firefox use the KDE file picker.
  # Preferences source: https://wiki.archlinux.org/title/firefox#KDE_integration
  programs.firefox = {
    enable = true;
    preferences = {
      "widget.use-xdg-desktop-portal.file-picker" = 1;
    };
  };
</syntaxhighlight>
<translate>
<translate>
=== Use xinput2 === <!--T:34-->
<!--T:34-->
1. Add the native messaging host package to your configuration:
</translate>
</translate>
{{code|lang=nix|line=no|1=programs.firefox.nativeMessagingHosts.packages = [ pkgs.plasma-browser-integration ];}}
<translate>
<translate>
<!--T:35-->
<!--T:35-->
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:
2. Install the corresponding [https://addons.mozilla.org/en-US/firefox/addon/plasma-integration/ browser add-on].
</translate>
</translate>
<syntaxhighlight lang="nix">
environment.sessionVariables = {
  MOZ_USE_XINPUT2 = "1";
};
</syntaxhighlight>
<translate>
<translate>
== Troubleshooting==
==== Use KDE file picker ==== <!--T:36-->
=== <code>nativeMessagingHosts</code> doesn't work === <!--T:40-->
</translate>
</translate>
<translate>
<translate>
<!--T:41-->
<!--T:37-->
These options, for example  <code>enablePlasmaBrowserIntegration</code>,  or<code>enableGnomeExtensions</code>,  do not work with the <code>bin</code> variants of the Firefox packages or with Firefox installed via<code>nix-env</code>.
To use the KDE file picker instead of the GTK one, set the following preference:
</translate>
</translate>
<hr />
{{code|lang=nix|line=no|1=
programs.firefox.preferences = {
  "widget.use-xdg-desktop-portal.file-picker" = 1;
};
}}


<translate>
<translate>
=== Screen Sharing under Wayland === <!--T:43-->
== Troubleshooting == <!--T:38-->
</translate>
</translate>
<translate>
<translate>
<!--T:44-->
==== Native Messaging Hosts Fail to Load ==== <!--T:39-->
When using Firefox with Wayland, screen sharing options might be limited and require additional configuration (exact capabilities vary with different compositors).
</translate>
</translate>
<translate>
<translate>
<!--T:47-->
<!--T:40-->
* Enable [https://pipewire.org/ PipeWire]
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.
</translate>
</translate>
<syntaxhighlight lang="nix">
services.pipewire.enable = true;
</syntaxhighlight>
<translate>
<translate>
<!--T:45-->
==== ALSA audio instead of PulseAudio ==== <!--T:41-->
* Add PipeWire support to Firefox:
</translate>
</translate>
<translate>
<translate>
<!--T:46-->
<!--T:42-->
<syntaxhighlight lang="nixos">
To force Firefox to use ALSA, you can override it with a wrapper:
programs.firefox.enable = true
programs.firefox.wrapperConfig = {
  pipewireSupport = true;
};
</syntaxhighlight>
Alternatively, it is possible to override the Firefox derivation with [[PipeWire]] support to it:<syntaxhighlight lang="diff">
environment.systemPackages = [
-  pkgs.firefox
+  pkgs.wrapFirefox (pkgs.firefox-unwrapped.override { pipewireSupport = true;}) {})
];
 
</syntaxhighlight>
</translate>
</translate>
{{code|lang=nix|line=no|1=programs.firefox.package = pkgs.wrapFirefox pkgs.firefox-unwrapped { libpulseaudio = pkgs.libalsa; };}}
<translate>
<translate>
<!--T:48-->
==== Screen Sharing under Wayland ==== <!--T:43-->
* Enable [https://github.com/flatpak/xdg-desktop-portal/blob/master/README.md xdg desktop integration]:
</translate>
</translate>
<syntaxhighlight lang="nix">
xdg = {
  portal = {
    enable = true;
    extraPortals = with pkgs; [
      xdg-desktop-portal-wlr
      xdg-desktop-portal-gtk
    ];
  };
};
</syntaxhighlight>
<translate>
<translate>
<!--T:49-->
<!--T:44-->
* Set environment variables to hint Firefox to use Wayland features. E.g.:
Screen sharing on Wayland requires enabling PipeWire and the appropriate XDG Desktop Portals.
</translate>
</translate>
<translate>
{{code|lang=nix|line=no|1=
<!--T:50-->
services.pipewire.enable = true;
<syntaxhighlight lang="nix">
xdg.portal = {
# NixOS setup
  enable = true;
environment.sessionVariables = {
   # Add the portal for your compositor, e.g.:
   # only needed for Sway
  extraPortals = with pkgs; [
   XDG_CURRENT_DESKTOP = "sway";  
    xdg-desktop-portal-wlr # For Sway/wlroots
    # xdg-desktop-portal-gtk # For GNOME
    # xdg-desktop-portal-kde # For KDE
   ];
};
};
</syntaxhighlight>
}}
</translate>
 
<translate>
<translate>
<!--T:51-->
== See also == <!--T:45-->
<syntaxhighlight lang="nix">
# Home Manager setup
home.sessionVariables = {
  # only needed for Sway
  XDG_CURRENT_DESKTOP = "sway";
};
</syntaxhighlight>
</translate>
</translate>
<translate>
<translate>
<!--T:52-->
* [[Home Manager]] – Declarative per-user configuration
* Ensure that the environment variables are correctly set for the user systemd units, e.g.
* [https://search.nixos.org/options?channel=unstable&query=programs.firefox NixOS options for Firefox]
* [https://discourse.nixos.org/tag/firefox Firefox topics on NixOS Discourse]
</translate>
</translate>
<translate>
<translate>
<!--T:53-->
== References == <!--T:46-->
# 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
</translate>
</translate>
<syntaxhighlight lang="bash">
exec systemctl --user import-environment
</syntaxhighlight>


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