Default command line args for the Brave browser

Following up on the same about chromium, I’m struggling to define command line defaults for the Brave browser:

Having

  environment.systemPackages = with pkgs; [ 
    (brave.override {
      commandLineArgs = [
        "--ozone-platform=no-such-thing"  # on purpose to make it break
      ];
    })
  ];

Does nothing at all - the resulting /run/current-system/sw/bin/brave script stays the same.

To my understanding, the override pattern is built-in in nixpkgs so I don’t understand what in Brave’s default.nix causes it being ignored (I’m on 22.05 stable channel of NixOS).

I’ve tried passing non-existing arguments like:

  environment.systemPackages = with pkgs; [ 
    (brave.override {
      foo = "bar"; 
    })
  ];

and the build indeed fails with ...brave/default.nix:1:1 called with unexpected argument 'foo', so my code is being included in the build but still no actual effect.

Any help please?

CC @uskudnik @rht @jefflabonte - you advice will be much appreciated! :pray:

Nowadays you can just export NIXOS_OZONE_WL=1 in your login shell and all of the wrappers of Chromium-like applications (Chromium, Brave, Discord, Slack, etc.) will add the appropriate OZone flags.

That’s true but I want to control other flags as well, for example to enable WebRTCPipeWireCapturer feature

You can add command line arguments with an overlay, like so.

nixpkgs.config.overlays = [
      (self: super: {
        brave = super.brave.override {
          commandLineArgs =
            "--password-store=basic";
        };
      })
    ];

I use this to prevent brave from opening kwallet every time I want to watch netflix.