Chromium: Difference between revisions

From NixOS Wiki
imported>Evanjs
The enablePepperPDF option was removed in https://github.com/NixOS/nixpkgs/commit/392a4c0a269f725226aec812892acacbdfcaf0f8
Klinger (talk | contribs)
 
(19 intermediate revisions by 11 users not shown)
Line 1: Line 1:
'''Note''': Firefox requires the Google Hangouts Video plugin but Chromium (37+) doesn't require any plugin to use Google Hangouts.
== Installation ==
=== NixOS ===
Add {{nixos:package|chromium}} to {{NixOS Manual|name=systemPackages|anchor=#sec-package-management}}.


== Per User ==
== Accelerated video playback ==  


It is possible to configure certain features in nixpkgs by creating <code>~/.nixpkgs/config.nix</code> and setting the options. See below for details on how to set the equivalent options for the system profile when running NixOS.
Make sure [[Accelerated Video Playback]] is setup on the system properly. Check {{ic|chrome://gpu}} to see if Chromium has enabled hardware acceleration.


To install Firefox and Chromium for a user profile you need to create <code>~/.nixpkgs/config.nix</code> and add the following options:
If accelerated video playback is not working, check relevant flags at {{ic|chrome://flags}}, or enable them using the cli:
 
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
~/.nixpkgs/config.nix:
<syntaxhighlight lang="nix">
{
{
     allowUnfree = true;
  environment.systemPackages = with pkgs; [
     (chromium.override {
      commandLineArgs = [
        "--enable-features=VaapiVideoDecodeLinuxGL"
        "--ignore-gpu-blocklist"
        "--enable-zero-copy"
      ];
    })
  ];
}
</nowiki>}}


    firefox = {
== Enabling native Wayland support ==
    enableGoogleTalkPlugin = true;
    enableAdobeFlash = true;
    };


    chromium = {
You can turn on native Wayland support in all chrome and most electron apps by setting an environment variable: <code>environment.sessionVariables.NIXOS_OZONE_WL = "1"</code>.
    enablePepperFlash = true; # Chromium's non-NSAPI alternative to Adobe Flash
    };


== Enabling DRM (Widevine support) ==
By default, {{nixos:package|chromium}} does not support playing DRM protected media. However, there is a build time flag to include the unfree Widevine blob from nixpkgs:
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{
  environment.systemPackages = with pkgs; [
    (chromium.override { enableWideVine = true; })
  ];
}
}
</syntaxhighlight>
</nowiki>}}
 
After these options have been set you need to install the "Wrapper" versions of Firefox:
 
<syntaxhighlight lang="console">
$ nix-env -i firefox-with-plugins chromium
</syntaxhighlight>
 
If you are using a version that does not have a wrapper, you can write one (add to config.nix and install with `nix-env -iA nixpkgs.pkgs.firefox-bin-wrapper` or `nix-env -iA nixos.pkgs.firefox-bin-wrapper`):
<syntaxhighlight lang="nix">
  packageOverrides = pkgs: with pkgs; rec {
    # FF bin with plugins
    firefox-bin-wrapper = wrapFirefox { browser = firefox-bin; };
  };
</syntaxhighlight>
 
== For NixOS ==
 
In NixOS you can configure nixpkgs options by adding a nixpkgs.config section to /etc/nixos/configuration.nix. This has no effect on nix-env commands but does apply to packages installed via the environment.systemPackages list. The options are exactly the same as above.
 
In order to install Firefox with support for plugins, you need to use the "Wrapper" version. For example, in /etc/nixos/configuration.nix environment.systemPackages this would be firefoxWrapper.
 
To install Firefox and Chromium with Google Talk and Flash in your system profile you can add the following to your configuration.nix file.
 
/etc/nixos/configuration.nix:
<syntaxhighlight lang="nix">
...
 
nixpkgs.config = {
 
    allowUnfree = true;
 
    firefox = {
    enableGoogleTalkPlugin = true;
    enableAdobeFlash = true;
    };
 
    chromium = {
    enablePepperFlash = true; # Chromium removed support for Mozilla (NPAPI) plugins so Adobe Flash no longer works
    };
 
  };
 
environment.systemPackages = [ pkgs.firefoxWrapper pkgs.chromium ];
...
</syntaxhighlight>
 
then run <pre>nixos-rebuild switch</pre>
 
== Java ==
 
To use Oracle's JRE as a browser's Java implementation, use the option "jre = true;" in the appropriate configuration file as described above.  Oracle's JRE must be manually downloaded to comply with its license.  These steps are described in the output when you try to install Firefox.
 
To use [http://icedtea.classpath.org/wiki/Main_Page IcedTea]/[http://openjdk.java.net/ OpenJDK] as a browser's Java implementation, use the option "icedtea = true;" in the appropriate configuration file as described above.  By using this Java implementation, it is possible to avoid a manual step whenever your system's Java implementation is updated or your configuration is used to build a new system.
 
== Enable GPU support ==
 
For intel:
 
64 bit
<syntaxhighlight lang="nix">
hardware.opengl.extraPackages = with pkgs; [ vaapiIntel ];
</syntaxhighlight>
 
32 bit
<syntaxhighlight lang="nix">
hardware.opengl.extraPackages32 = with pkgs.pkgsi686Linux; [ vaapiIntel ];
</syntaxhighlight>
 
== Gnome Shell extensions ==
 
Gnome Shell extensions can be enabled with <code>enableGnomeExtensions = true</code>. It is a mozilla plugin, therefore it does not work currently with Chromium.


[[Category:Configuration]]
[[Category:Applications]]
[[Category:Web Browser]]

Latest revision as of 20:43, 26 September 2024

Installation

NixOS

Add chromium to systemPackages.

Accelerated video playback

Make sure Accelerated Video Playback is setup on the system properly. Check chrome://gpu to see if Chromium has enabled hardware acceleration.

If accelerated video playback is not working, check relevant flags at chrome://flags, or enable them using the cli:

/etc/nixos/configuration.nix
{
  environment.systemPackages = with pkgs; [
    (chromium.override {
      commandLineArgs = [
        "--enable-features=VaapiVideoDecodeLinuxGL"
        "--ignore-gpu-blocklist"
        "--enable-zero-copy"
      ];
    })
  ];
}

Enabling native Wayland support

You can turn on native Wayland support in all chrome and most electron apps by setting an environment variable: environment.sessionVariables.NIXOS_OZONE_WL = "1".

Enabling DRM (Widevine support)

By default, chromium does not support playing DRM protected media. However, there is a build time flag to include the unfree Widevine blob from nixpkgs:

/etc/nixos/configuration.nix
{
  environment.systemPackages = with pkgs; [
    (chromium.override { enableWideVine = true; })
  ];
}