Chromium with wayland switches

Good day,

I’m running Chromium on GNOME Wayland. By default the magical --enable-features=UseOzonePlatform --ozone-platform=wayland flags are not enabled which causes issues when moving between different DPI displays.

Is there a way to add these flags as default ones without creating my own derivations of Chromium (and Google Chrome for that matter)? - I wish we had “chromium-wayland” packages similar to ‘firefox-wayland’.

I tried to creating my own desktop file in ~/.local/share/applications which gnome discovers and launches successfully but still somehow confuses it with the nix-provided desktop item - e.g. when I add it to favorites on the launcher, close the current windows and fire it through the launcher favorite then the nix-provded (stock) desktop icon is used instead.

Thank you in advance.

1 Like
(chromium.override {
  commandLineArgs = [

EDIT 2022-05-12: Recent versions of Chromium have added auto-detection for Wayland:

(chromium.override {
  commandLineArgs = [

I think this triggers a rebuild. haizaar specifically asked for a way that doesn’t result in a new Chromium derivation, possibly to avoid a rebuild.

No, this only rebuilds the wrapper script.


Thank you! That’s exactly what I was after. Apologies for if my requirements were ambiguous - still a Nix noob. I only mean that I’d like to change default args without forking chromium nixpkg and this suggestion achieves exactly that. It’s also a good reason to read the relevant section of the nix manual again.


It may seem like chromium.override solution is not working anymore but it’s most-likely a side effect of a bug that caused your own --enable-features flag to actually be overridden.

It was fixed on Sep 2 so hopefully lands in stable branch soon:

P.S. I know we can now simply set

environment.sessionVariables { NIXOS_OZONE_WL = "1"; };

but I want pass in more default flags so I need this overriding feature anyway.

chromium.override doesn’t work anymore actually.
I think it’s because they have removed eval in makeWrapper so commandLineArgs is actually not evaluated any more during build.

Does anyone know if this intentional or bug? (Same situation with brave btw)

One solution I’ve found is to use:

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