Skip to content

Opening URLs from menu bar app and notifications sometimes does not work on NixOS #2430

@RebeccaMahany

Description

@RebeccaMahany

We've received a report that opening URLs from the menu bar app and notifications is not working on at least one NixOS device. For this device, Firefox is the default browser (confirmed by xdg-open, xdg-settings get default-web-browser, xdg-mime query default x-scheme-handler/https). The OS version is NixOS 25.05 (Warbler).

For the affected device, /etc/NIXOS does exist, so when we open a link from the menu bar (here), the allowedcmd pkg's validatedCommand should perform a path lookup instead of using the hardcoded path (since the hardcoded path won't exist on nix).

The affected device has xdg-open at /run/current-system/sw/bin/xdg-open, which is in the path we specify in the Nix module here. I also took a look at a flare for this device, and confirmed that PATH for the desktop process includes /run/current-system/sw/bin. So, we should be able to find xdg-open when doing the path lookup.

If we couldn't find the executable during path lookup, we should return and log an error -- but I don't see any in the logs. At this time, my best guess is that we are finding and executing xdg-open, but that it's silently not working. We saw this issue early on when we were first working on opening URLs on Linux; the culprit was a variety of small issues (e.g. this one) where we were missing important display-related env vars when launching the desktop process. (This conclusion is based on the fact that I don't see any failed to perform action error-level logs, which I would expect to see if we can't find xdg-open, or if we attempt to execute xdg-open at a path that doesn't exist. It is worth confirming that the slogger for that area of the desktop process is definitely shipping logs back to the parent process.)

From the user report, it looks like we are not setting XDG_DATA_DIRS correctly for NixOS -- so I would start there. I see that some of the XDG_DATA_DIRS we could calculate easily (/home/<username>/.nix-profile/share:/nix/profile/share:/home/<username>/.local/state/nix/profile/share:/etc/profiles/per-user/<username>/share:/ with the username, plus /nix/var/nix/profiles/default/share:/run/current-system/sw/share), but that will be incomplete -- I see nix store paths in there as well. If possible, we should determine full and correct value for XDG_DATA_DIRS and set it.

  • Set XDG_DATA_DIRS correctly on NixOS
  • Add is_nixos to a log somewhere (in runner_linux.go? in the desktop? as a value always added when logshipping?) so we know when we've identified that a device is NixOS -- allowedcmd.IsNixOS() only performs the calculation once, so it should be cheap to call repeatedly

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions