Electron applications on Wayland (VScode and Obsidian) do not start

Hi everyone,

Electron applications have been broken for me for a few weeks now. In particular VScodium and Obsidian do not launch. I noticed there had been a few issues related to Electron and VScode posted on Git so I decided to wait a while and see if it resolved itself. These issues now seem to have been fixed, merged and closed, but these apps are still broken for me so I’m posting here.

When running vscodium this is the output:

Warning: 'ozone-platform-hint' is not in the list of known options, but still passed to Electron/Chromium.
Warning: 'enable-features' is not in the list of known options, but still passed to Electron/Chromium.
Warning: 'ozone-platform' is not in the list of known options, but still passed to Electron/Chromium.

Nothing else and no window appears. The process ends.

For Obsidian:

[21252:0116/031906.595304:ERROR:wayland_connection.cc(154)] Failed to load libwayland-cursor.so.0.
[21252:0116/031906.595329:ERROR:ozone_platform_wayland.cc(226)] Failed to initialize Wayland platform
[21252:0116/031906.595332:ERROR:env.cc(225)] The platform failed to initialize.  Exiting.
  • Same results when running in nix-shell.
  • I am on unstable.
  • Obsidian is version 1.1.9
  • VScodium is version 1.74.2.22355
  • Flatpak versions launch as expected.

Any ideas on how to resolve or further troubleshoot this?

Odd, are you sure you’re using vscodium from the unstable channel/flake? It looks like it’s compiled without the ozone platform.

What do you get if you run nix-shell -p nix-info --run "nix-info -m"?

I thought I was; I have nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; set in my flake.nix. I was originally using nix-env -qa to check versioning, but I think I misunderstood its purpose. Using readlink -f $ ( which codium ) shows 1.74.1.22349 which is ahead of the stable branch but also behind unstable. Running nixos-rebuild switch --flake .# does not update it.

 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.0, NixOS, 23.05 (Stoat), 23.05.20221218.04f574a`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.12.0`

Yeah! nix-env should not be touched when using flakes, and avoided in general.

It’s quite likely that you’re using an ancient version of a lot of packages if you’re still using nix-env, and that this is broken because of that. See the “non obvious shadowing” and “implicit package pinning” headings in the link.

Make sure to delete all packages installed with nix-env, and install them with environment.systemPackages or similar instead. To remove everything installed with nix-env:

nix-env -e '.*'

This should also probably go without saying, but you’re supposed to use nix flake update to update your nixos configuration now, instead of updating your profiles. Profiles are not used for flakes, and are best deleted as well so you can’t accidentally use nix-env or similar.