In previous distros, I would copy the .desktop file to ~/.local/share/applications and then edit it to add things like –enable-features=TouchpadOverscrollHistoryNavigation to my chrome startup command on the Exec line.
How do I go about this? I found the desktop file in a specific location in the store. Is there a way to add these sorts of things to the config file declaratively?
j-k
November 23, 2022, 9:16am
2
well you can still do the manual method but to have things declarative you can modify the desktop file with an overlay
Looks like chromium browsers have an argument for commandLineArgs
https://nixos.wiki/wiki/Overlays#Examples_of_overlays
If you’re using home-manager it has an option already to provide extra arguments to chromium based browsers
https://nix-community.github.io/home-manager/options.html#opt-programs.chromium.commandLineArgs
Interesting. I applied this overlay with two different package names (different chromium browsers). Vivaldi worked, and Brave did not. Meaning, it built, but Brave did not add the commandlinearg while Vivaldi did.
Any ideas why that would be? Just substituted the word brave for the word vivaldi .
nixpkgs.overlays = [
(self: super: {
brave = super.brave.override {
commandLineArgs =
"--enable-features=TouchpadOverscrollHistoryNavigation";
};
})
];
Edit: Also doesn’t work with google-chrome. Which I would have thought would be the main one working.
j-k
November 23, 2022, 4:53pm
4
It looks like someone accidentally put the commandLineArgs
part in with the vulkanSupport
optional string part
--suffix PATH : ${lib.makeBinPath [ xdg-utils ]}
${optionalString (enableFeatures != []) ''
--add-flags "--enable-features=${strings.concatStringsSep "," enableFeatures}"
''}
${optionalString (disableFeatures != []) ''
--add-flags "--disable-features=${strings.concatStringsSep "," disableFeatures}"
''}
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"
${optionalString vulkanSupport ''
--prefix XDG_DATA_DIRS : "${addOpenGLRunpath.driverLink}/share"
--add-flags ${escapeShellArg commandLineArgs}
''}
)
'';
installCheckPhase = ''
# Bypass upstream wrapper which suppresses errors
$out/opt/brave.com/brave/brave --version
'';
passthru.updateScript = ./update.sh;
Resolved here: brave: fix commandLineArgs option also requiring vulkanSupport by 06kellyjac · Pull Request #202555 · NixOS/nixpkgs · GitHub
Another approach is to create a Nix function to wrap the package and replace the .desktop file. I do something similar with an nvidia offload rendering script; I wrap the executables. https://github.com/emmanuelrosa/erosanix/blob/b1aa1916f22b53ae24ffcb96a7a7d4f85e1337c9/lib/nvidia-offload-wrapper.nix