Chromium: Difference between revisions

From NixOS Wiki
imported>Fadenb
Created page with "'''Note''': Firefox requires the Google Hangouts Video plugin but Chromium (37+) doesn't require any plugin to use Google Hangouts. == Per User == It is possible to configur..."
 
imported>Fadenb
m Syntaxhighlight
Line 8: Line 8:


~/.nixpkgs/config.nix:
~/.nixpkgs/config.nix:
<pre>
<syntaxhighlight lang="nix">
{
{
     allowUnfree = true;
     allowUnfree = true;
Line 23: Line 23:


}
}
</pre>
</syntaxhighlight>


After these options have been set you need to install the "Wrapper" versions of Firefox:
After these options have been set you need to install the "Wrapper" versions of Firefox:


<pre>
<syntaxhighlight lang="console">
$ nix-env -i firefox-with-plugins chromium
$ nix-env -i firefox-with-plugins chromium
</pre>
</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`):
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`):
<pre>
<syntaxhighlight lang="nix">
   packageOverrides = pkgs: with pkgs; rec {
   packageOverrides = pkgs: with pkgs; rec {
     # FF bin with plugins
     # FF bin with plugins
     firefox-bin-wrapper = wrapFirefox { browser = firefox-bin; };
     firefox-bin-wrapper = wrapFirefox { browser = firefox-bin; };
   };
   };
</pre>
</syntaxhighlight>


== For NixOS ==
== For NixOS ==
Line 48: Line 48:


/etc/nixos/configuration.nix:
/etc/nixos/configuration.nix:
<pre>
<syntaxhighlight lang="nix">
...
...


Line 69: Line 69:
environment.systemPackages = [ pkgs.firefoxWrapper pkgs.chromium ];
environment.systemPackages = [ pkgs.firefoxWrapper pkgs.chromium ];
...
...
</pre>
</syntaxhighlight>


then run <pre>nixos-rebuild switch</pre>
then run <pre>nixos-rebuild switch</pre>
Line 83: Line 83:
For intel:
For intel:


<pre>
<syntaxhighlight lang="nix">
services.xserver.vaapiDrivers = [ pkgs.vaapiIntel ];
services.xserver.vaapiDrivers = [ pkgs.vaapiIntel ];
</pre>
</syntaxhighlight>


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

Revision as of 08:57, 27 August 2017

Note: Firefox requires the Google Hangouts Video plugin but Chromium (37+) doesn't require any plugin to use Google Hangouts.

Per User

It is possible to configure certain features in nixpkgs by creating ~/.nixpkgs/config.nix and setting the options. See below for details on how to set the equivalent options for the system profile when running NixOS.

To install Firefox and Chromium for a user profile you need to create ~/.nixpkgs/config.nix and add the following options:

~/.nixpkgs/config.nix:

{
    allowUnfree = true;

    firefox = {
     enableGoogleTalkPlugin = true;
     enableAdobeFlash = true;
    };

    chromium = {
     enablePepperFlash = true; # Chromium's non-NSAPI alternative to Adobe Flash
     enablePepperPDF = true;
    };

}

After these options have been set you need to install the "Wrapper" versions of Firefox:

$ nix-env -i firefox-with-plugins chromium

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`):

  packageOverrides = pkgs: with pkgs; rec {
    # FF bin with plugins
    firefox-bin-wrapper = wrapFirefox { browser = firefox-bin; };
  };

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:

...

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 
     enablePepperPDF = true;
    };

  };

environment.systemPackages = [ pkgs.firefoxWrapper pkgs.chromium ];
...

then run

nixos-rebuild switch

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 IcedTea/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:

services.xserver.vaapiDrivers = [ pkgs.vaapiIntel ];

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.