Nixos-help doesn't launch my default browser

It launches firefox, even though in KDE my default browser is brave. Just an irritation at this point, is it because ~/.local/share/applications doesn’t have a .desktop file for Brave?

Based on this, it’s because one of the following is true:

  • You have the BROWSER environment variable set to something that includes Firefox
  • The result of xdg-mime query default application/xhtml+xml is firefox.desktop

If the former, find and fix. If the latter, use xdg.mime.defaultApplications to change declaratively, or xdg-mime default (xdg-settings set default-web-browser is probably better) to change imperatively.

1 Like

Looks like File Associations were all set to Firefox, is that because I have programs.firefox.enable=true; in my configuration.nix and pkgs.brave in my home.nix?

Cool, thanks for the advice. Wonder if the installation order matters, in other distros I normally expect “last browser installed” to greedily set their file association to themselves, but Nixos is declarative and I guess can’t manage order of installation?"

xdg-mime query default application/xhtml+xml
brave-browser.desktop

Strange to me that “Default Applications” in Plasma 6.6 are considered distinct from “File Associations” but coming from many years in the Microsoft world, it is the same with all modern Windows distros also. Again, I think installation sequence matters here.

There’s no such thing as installing in NixOS, so there’s double no such thing as installation order.

Might help to look at /run/current-system/sw/share/applications/mimeinfo.cache, which should hold the MIME associations generated by all of the desktop files included in packages in your system profile; and ~/.config/mimeapps.list, which should hold any overrides you’ve set in Plasma apps.

If you want to see where xdg-mime is looking, you can use the environment variable XDG_UTILS_DEBUG_LEVEL=2.

There’s a lot to learn about NixOS, for sure! I’m making life harder too by sharing my home directory with other Linux distros, when I’m using Flatpak versions of browser, it seems to work more smoothly, I may revert to that approach until I figure these head-scratchers out. This is my first foray into home-manager as well.

Thank you for the tips!

My browser was installed via flatpak install com.brave.Browser however, under nixos. And seems to me it just might keep configuration data in the same places as anything “installed” via programs.enable or pkgs.add in my configuration.nix?

Flatpak is its own thing. So yeah, you can install programs imperatively with Flatpak, and they might have any effect at all on any files not in the Nix store.