How to wrap all my electron apps with args?

Total noob question, in derivations with an executable in them, how can I wrap an executable with command line arguments, also maybe add the arguments to the .desktop file (if needed)?

My specific scenario I am trying to work threw is that I want to try to wrap all my electron apps with --enable-features=UseOzonePlatform --platform=wayland to see what would happen if I force them to run using Wayland. A few specifically are discord, spotify, and slack.

I know most (if not all) of my electron apps are now built using a common electron derivation, and just pulled from other sources, so I know I might have to specify each derivation to override.

I just need help on how to override specific derivations to add the args.

If it matters, I include the derivations in my home-manager config in the end.

First time posting, hope this stops my lurking spree :grin:.

https://nixos.org/manual/nixpkgs/stable/#fun-makeWrapper

may help you.

The magic for this function happens here

nixpkgs/make-wrapper.sh at 2d3dd64808ab2d1a631c1f05556fbe59a7143d86 · NixOS/nixpkgs · GitHub

and has lots of good info in there

https://sourcegraph.com/search?q=context:global+lang:nix+makeWrapper&patternType=literal

https://sourcegraph.com/search?q=context:global+lang:nix+wrapProgram&patternType=literal

for examples on how it’s used.

Hosted by Flying Circus.