Chromium: Difference between revisions

From NixOS Wiki
Sdht0 (talk | contribs)
→‎Installation: use manual template, make it NixOS specific
Sdht0 (talk | contribs)
→‎Enable GPU accelerated video decoding (VA-API): Copy edit, add working configuration
Line 3: Line 3:
Add {{nixos:package|chromium}} to {{NixOS Manual|name=systemPackages|anchor=#sec-package-management}}.
Add {{nixos:package|chromium}} to {{NixOS Manual|name=systemPackages|anchor=#sec-package-management}}.


== Enable GPU accelerated video decoding (VA-API) ==  
== Accelerated video playback ==  


VA-API is enabled by default now in Chromium. Check chrome://gpu if it is working and if VA is detected. You may need to enable Hardware-accelerated video decode in chrome://flags.  
Make sure [[Accelerated Video Playback]] is setup on the system properly. Check {{ic|chrome://gpu}} to see if Chromium has enabled hardware acceleration.


Make sure the required VA-API drivers are installed: [[Accelerated Video Playback]]
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>
Make sure your driver works by running: <code>nix-shell -p libva-utils --run vainfo</code>
{
  environment.systemPackages = with pkgs; [
    (chromium.override {
      commandLineArgs = [
        "--enable-features=VaapiVideoDecodeLinuxGL"
        "--ignore-gpu-blocklist"
        "--enable-zero-copy"
      ];
    })
  ];
}
</nowiki>}}


== Gnome Shell extensions ==
== Gnome Shell extensions ==

Revision as of 04:31, 8 April 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"
      ];
    })
  ];
}

Gnome Shell extensions

Gnome Shell extensions can be enabled with enableGnomeExtensions = true. It is a mozilla plugin, therefore it does not work currently with Chromium.

Enabling native Wayland support

Since Nixos 22.05 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" (see notable changes)

In earlier versions you can enable wayland support by setting the appropriate command-line flags:

nixpkgs.config.chromium.commandLineArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland";

Overriding Chromium

Note: This section was never properly tested. Please update it accordingly if you notice issues with the examples and feel free to extend it.

To create a customized Chromium the following approach can be used:

chromium.mkDerivation (base: { name = "my-chromium"; gnFlags = { test_flag = 42; }; })

It should also be possible to override a Chromium attribute using

chromium.browser.overrideAttrs ...

.