Firefox/ru: Difference between revisions
Created page with "=== Поделиться Экраном через Wayland ===" |
Created page with "<syntaxhighlight lang="nix"> # только если programs.firefox.enable == true programs.firefox.wrapperConfig = { pipewireSupport = true; };" |
||
(3 intermediate revisions by the same user not shown) | |||
Line 8: | Line 8: | ||
Keep in mind that the NixOS and Home Manager modules have different options, so choose accordingly. | Keep in mind that the NixOS and Home Manager modules have different options, so choose accordingly. | ||
</div> | </div> | ||
< | <span id="Firefox_Variants"></span> | ||
== Firefox | == Версии Firefox == | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
There are several Firefox variants that you can choose to install. To choose a variant, set <code>programs.firefox.package</code> accordingly. | There are several Firefox variants that you can choose to install. To choose a variant, set <code>programs.firefox.package</code> accordingly. | ||
Line 182: | Line 181: | ||
}; | }; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
< | <span id="Troubleshooting"></span> | ||
== | == Устранение неполадок == | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
=== If you can't start the browser because of a configuration error === | === If you can't start the browser because of a configuration error === | ||
Line 217: | Line 215: | ||
</div> | </div> | ||
* Добавить поддержку Pipewire в Firefox: | * Добавить поддержку Pipewire в Firefox: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
# | # только если programs.firefox.enable == true | ||
programs.firefox.wrapperConfig = { | programs.firefox.wrapperConfig = { | ||
pipewireSupport = true; | pipewireSupport = true; | ||
}; | }; | ||
# или же | |||
# | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> |
Latest revision as of 20:16, 22 August 2024
Firefox is a graphical web browser developed by Mozilla. It can be used with a Firefox Sync Server.
Установка
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.
Версии Firefox
There are several Firefox variants that you can choose to install. 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. Thus, you'll have to choose one among these options.
Variant: Official Binaries
Mozilla provides official pre-built Firefox binaries. This is the firefox-bin
package and will be downloaded directly from the Mozilla servers.
Variant: 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.
Variant: Nightly
Nightly builds - это ежедневные сборки Firefox из центрального репозитория Mozilla.
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:
inputs = {
firefox.url = "github:nix-community/flake-firefox-nightly";
firefox.inputs.nixpkgs.follows = "nixpkgs";
};
Then, using the specialArgs attribute to pass flake inputs to external configuration files, add the nightly package to your system:
{ pkgs, inputs, config, ... }:
{
environment.systemPackages = [
inputs.firefox.packages.${pkgs.system}.firefox-nightly-bin
];
}
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.
Non-reproducible (Impure)
Использование этого метода плохо сказывается на воспроизводимости, так как ресурсы берутся с URL-адресов, не относящихся к привязке, но это также означает, что вы всегда получаете последнюю Nightly версию, когда собираете свою систему.
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;
Once you've added the overlay, you'll need to pass the --impure
option to nix commands. For example, in order to build and activate your configuration, you'll have to run:
$ nixos-rebuild switch --impure
Customizing with Home Manager
Home manager allows more customization for firefox. Such as extensions, search engines, bookmarks, userChrome and user.js. The example below shows a basic config defining Nix packages & options as a search engine.
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}"; }
];
}];
};
};
};
};
};
ЧАВО
Как использовать ALSA в Firefox вместо PulseAudio?
programs.firefox.package = (pkgs.wrapFirefox.override { libpulseaudio = pkgs.libpressureaudio; }) pkgs.firefox-unwrapped { };
Советы
=== Enabling Plasma Browser Integration ===
1. Add the following line to your configuration.nix
(note that enabling Plasma automatically does this):
programs.firefox.nativeMessagingHosts.packages = [ pkgs.plasma5Packages.plasma-browser-integration ];
2. Install KDE's Firefox extension.
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 'configuration.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;
};
};
Использовать 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";
};
Устранение неполадок
If you can't start the browser because of a configuration error
Например:
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
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
не работает
Such as enablePlasmaBrowserIntegration
, enableGnomeExtensions
, and enableBrowserpass
.
They do not work with the firefox-bin
derivation[1] or with firefox
installed via nix-env
Поделиться Экраном через Wayland
When using Firefox with Wayland, screen sharing options might be limited and require additional configuration (exact capabilities vary with different compositors).
- Добавить поддержку Pipewire в Firefox:
# только если programs.firefox.enable == true
programs.firefox.wrapperConfig = {
pipewireSupport = true;
};
# или же
<div lang="en" dir="ltr" class="mw-content-ltr">
environment.systemPackages = [
# Replace this
pkgs.firefox
# With this
(pkgs.wrapFirefox (pkgs.firefox-unwrapped.override { pipewireSupport = true;}) {})
];
- 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 = {
# only needed for Sway
XDG_CURRENT_DESKTOP = "sway";
};
# Home Manager setup
home.sessionVariables = {
# 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