Firefox: Difference between revisions
imported>Aktaboot m remove deprecated gtkUsePortal |
imported>Hypnosis2839 m remove mentions of nix-env, java, and simplify explanations; remove repetitive text |
||
Line 3: | Line 3: | ||
== 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. | |||
< | |||
</ | |||
== Tips == | == Tips == | ||
Line 31: | Line 10: | ||
== Other Firefox Editions == | == Other Firefox Editions == | ||
Nixpkgs also offers other variants of Firefox aside from the ones stated above | Nixpkgs also offers other variants of Firefox aside from the ones stated above; these may suit your needs more than vanilla Firefox. | ||
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 and each other, which means that you'll have to choose one among these options. | '''Note:''' The packages for the variants listed below are installed ''instead'' of the normal <code>firefox</code> package and each other, which means that you'll have to choose one among these options. | ||
Line 37: | Line 17: | ||
=== Wayland === | === Wayland === | ||
Users running a Wayland compositor (such as [[Sway]]) may want to use a Wayland-compatible build of Firefox | Users running a Wayland compositor (such as [[Sway]]) may want to use a Wayland-compatible build of Firefox (<code>firefox-wayland</code>). This can help with a number of issues such as phantom scrolling. | ||
==== Screen Sharing ==== | ==== Screen Sharing ==== | ||
Line 43: | Line 23: | ||
When using Firefox with Wayland, screen sharing options might be limited and require additional configuration (exact capabilities vary with different compositors). | When using Firefox with Wayland, screen sharing options might be limited and require additional configuration (exact capabilities vary with different compositors). | ||
* Use <code>firefox-wayland</code | * Use <code>firefox-wayland</code> | ||
* Enable [https://pipewire.org/ PipeWire]:<syntaxhighlight lang="nix"> | * Enable [https://pipewire.org/ PipeWire]:<syntaxhighlight lang="nix"> | ||
services.pipewire.enable = true; | services.pipewire.enable = true; | ||
Line 77: | Line 41: | ||
# Classical NixOS setup | # Classical NixOS setup | ||
environment.sessionVariables = { | environment.sessionVariables = { | ||
MOZ_ENABLE_WAYLAND = 1; | |||
# only needed for Sway | |||
XDG_CURRENT_DESKTOP = "sway"; | |||
}; | }; | ||
Line 84: | Line 49: | ||
home.sessionVariables = { | home.sessionVariables = { | ||
MOZ_ENABLE_WAYLAND = 1; | MOZ_ENABLE_WAYLAND = 1; | ||
# only needed for Sway | |||
XDG_CURRENT_DESKTOP = "sway"; | XDG_CURRENT_DESKTOP = "sway"; | ||
}; | }; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
* Ensure that the environment variables are correctly set for the user systemd units, e.g.: | |||
* Ensure that the environment variables are correctly set for the user systemd units | <syntaxhighlight lang="bash"> | ||
# Sway users might achieve this by adding the following to their Sway config file | # 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 | # This ensures all user units started after the command (not those already running) set the variables | ||
exec systemctl --user import-environment | exec systemctl --user import-environment | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===Firefox ESR=== | ===Firefox 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. | |||
===Mozilla Distributed Binaries=== | ===Mozilla Distributed Binaries=== | ||
Mozilla themselves provide official pre-built Firefox binaries. It is possible to install these packages through Nix by using the <code>-bin</code> suffix with the package | Mozilla themselves provide official pre-built Firefox binaries. It is possible to install these packages through Nix by using the <code>-bin</code> suffix with the package (such as <code>firefox-bin</code>). This will download the binary from Mozilla's servers. | ||
===Firefox nightly=== | ===Firefox nightly=== | ||
Nightly builds are daily builds of Firefox from the Mozilla-central repository | Nightly builds are daily builds of Firefox from the Mozilla-central repository. | ||
To use them | To use them | ||
Line 115: | Line 80: | ||
nightlyOverlay | nightlyOverlay | ||
]; | ]; | ||
programs.firefox.package = pkgs.latest.firefox-nightly-bin; | |||
</syntaxhighlight> | </syntaxhighlight> | ||
== FAQ == | == FAQ == | ||
=== How | === How do I use ALSA with Firefox instead of PulseAudio? === | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
programs.firefox.package = (pkgs.wrapFirefox.override { libpulseaudio = pkgs.libpressureaudio; }) pkgs.firefox-unwrapped { }; | programs.firefox.package = (pkgs.wrapFirefox.override { libpulseaudio = pkgs.libpressureaudio; }) pkgs.firefox-unwrapped { }; | ||
Line 141: | Line 96: | ||
The official builds are available by [[FAQ#How_can_I_install_a_proprietary_or_unfree_package.3F|enabling unfree]] and installing <code>firefox-bin</code>. | The official builds are available by [[FAQ#How_can_I_install_a_proprietary_or_unfree_package.3F|enabling unfree]] and installing <code>firefox-bin</code>. | ||
== Tips == | == Tips == |
Revision as of 17:01, 6 August 2023
Firefox is a graphical web browser developed by Mozilla.
Installation
Set programs.firefox.enable
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.
Tips
Other Firefox Editions
Nixpkgs also offers other variants of Firefox aside from the ones stated above; these may suit your needs more than vanilla Firefox.
To choose a variant, set programs.firefox.package
accordingly.
Note: The packages for the variants listed below are installed instead of the normal firefox
package and each other, which means that you'll have to choose one among these options.
Wayland
Users running a Wayland compositor (such as Sway) may want to use a Wayland-compatible build of Firefox (firefox-wayland
). This can help with a number of issues such as phantom scrolling.
Screen Sharing
When using Firefox with Wayland, screen sharing options might be limited and require additional configuration (exact capabilities vary with different compositors).
- Use
firefox-wayland
- Enable PipeWire:
services.pipewire.enable = true;
- Enable xdg desktop integration:
xdg = { portal = { enable = true; extraPortals = with pkgs; [ xdg-desktop-portal-wlr xdg-desktop-portal-gtk ]; }; };
- Set environment variables to hint Firefox to use Wayland features. E.g.:
# Classical NixOS setup environment.sessionVariables = { MOZ_ENABLE_WAYLAND = 1; # only needed for Sway XDG_CURRENT_DESKTOP = "sway"; }; # Home Manager setup home.sessionVariables = { MOZ_ENABLE_WAYLAND = 1; # only needed for Sway XDG_CURRENT_DESKTOP = "sway"; };
- 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
exec systemctl --user import-environment
Firefox ESR
firefox-esr
is the Extended Support Release of Firefox provided by Mozilla, which receives only security updates and a more relaxed cadence of feature implementation.
Mozilla Distributed Binaries
Mozilla themselves provide official pre-built Firefox binaries. It is possible to install these packages through Nix by using the -bin
suffix with the package (such as firefox-bin
). This will download the binary from Mozilla's servers.
Firefox nightly
Nightly builds are daily builds of Firefox from the Mozilla-central repository.
To use them
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;
FAQ
How do I use ALSA with Firefox instead of PulseAudio?
programs.firefox.package = (pkgs.wrapFirefox.override { libpulseaudio = pkgs.libpressureaudio; }) pkgs.firefox-unwrapped { };
I want Firefox, what is Nightly?
Mozilla's trademarks on Firefox disallows distributing unofficial builds using the Firefox trademark. This is why the Nix-built Firefox is named Nightly.
The official builds are available by enabling unfree and installing firefox-bin
.
Tips
Enabling Plasma Browser Integration
1. Add the following line to your configuration.nix (note that enabling Plasma automatically does this):
nixpkgs.config.firefox.enablePlasmaBrowserIntegration = true;
If you're wondering where this part is coming from see NixOS Manual:Customising Packages
2. Install KDE's Firefox extension.
Use xinput2
You can make Firefox use xinput2 by setting the MOZ_USE_XINPUT2
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:
environment.sessionVariables = {
MOZ_USE_XINPUT2 = "1";
};
Troubleshooting
If you can't start the browser because of a configuration error
For example:
firefox
1554035168269 Marionette FATAL Error de análisis XML: entidad indefinida
Ubicación: chrome://browser/content/browser.xul
Línea 2526, columna 13: <toolbarbutton id="tracking-protection-preferences-button"
JavaScript error: resource:///modules/aboutpages/AboutPrivateBrowsingHandler.jsm, line 28: TypeError: this.pageListener is undefined
An easy way to get away from this is to start firefox with the firefox -safe-mode
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.
nativeMessagingHosts
don't work
such as enablePlasmaBrowserIntegration
, enableGnomeExtensions
, and enableBrowserpass
.
They do not work with the firefox-bin
derivation[1] or with firefox
installed via nix-env