NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.27k stars 14.25k forks source link

Installing Plasma Browser Integration does not add its native messaging hosts to the ./mozilla/native-messaging-hosts directory #352248

Open fynn-kropp opened 3 weeks ago

fynn-kropp commented 3 weeks ago

Describe the bug

The wiki pages for Firefox and KDE Plasma state that the steps required to install Firefox and enable the Plasma Browser Integration are to

  1. Install KDE Plasma (either 5 or 6, this did not make a difference in testing) via the steps listed here.
  2. Install Firefox by adding programs.firefox.enable = true to either the system config or Home Manager.
  3. Add the Firefox extension to the browser here.

Following these steps, the plugin reports "Failed to connect to the native host", the same way that can be seen in #281710. The fixes in that issue, as well as similar ones, did not resolve the issue. Neither did the instruction on the Firefox wiki page to add programs.firefox.nativeMessagingHosts.packages = [ pkgs.plasma5Packages.plasma-browser-integration ]; since this is already included by default with the Plasma installation and causes the build to fail. Instead, the required fix was to manually copy the org.kde.plasma.browser_integration.json file from the Plasma Browser Integration package in nix/store/{plasma-browser-integration-6.0.5}/lib/mozilla/native-messaging-hosts to {user}/.mozilla/native-messaging-hosts.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Install KDE Plasma 5 or 6 per the wiki instructions.
  2. Install Firefox per the wiki instructions.
  3. Install the Firefox Plasma Browser Integration extension.
  4. Get "Failed to connect to the native host" error since the org.kde.plasma.browser_integration application cannot be found (because there is no org.kde.plasma.browser_integration.json file in the relevant folder).
  5. Copy the org.kde.plasma.browser_integration.json file from the package source into the {user}/.mozilla/native-messaging-hosts directory.
  6. Plasma Browser Integration now works as expected.

Expected behavior

It seems like org.kde.plasma.browser_integration.json should be moved to the above mentioned folder during the installation/build process, as appears to have been the case in the past.

Additional context

The version of KDE Plasma (i.e. 5 or 6) and the way it was installed (system config or Home Manager) did not make a difference in testing. I have not tested any other Firefox extensions that require native hosts, so I can't say if there are more packages that are affected.

Notify maintainers

Qt / KDE Team (as listed here)

@ilya-fedin @k900 @LunNova @mjm @nickcao @SuperSandro2000 @ttuegel

Metadata

[floppy@nixos:~/.mozilla/native-messaging-hosts]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.58, NixOS, 24.05 (Uakari), 24.05.6043.64b80bfb316b`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.8`
 - channels(root): `"home-manager-24.05.tar.gz, nixos-24.05"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Add a :+1: reaction to issues you find important.

K900 commented 3 weeks ago

What Firefox version are you using?

SuperSandro2000 commented 3 weeks ago

You linked the old wiki, the instructions there might be outdated.

Also we have zero integration with home-manager and don't provide any support regarding it's settings.

fynn-kropp commented 3 weeks ago

What Firefox version are you using?

I'm using the most recent "default" Firefox version that you get by setting programs.firefox.enable = true. That should be Version 131.0.3. The Plasma Browser Integration package version is 6.0.5.

You linked the old wiki, the instructions there might be outdated.

Also we have zero integration with home-manager and don't provide any support regarding it's settings.

You're totally right, that's my bad. I've updated the links to the new wiki. The instructions have stayed the same, though, so that should not have made a difference. Regarding Home Manager, I'm not using it for this. As mentioned above, I've installed Firefox via the system config rather than via Home Manager. I just saw people mentioning it as a solution in the issue I linked earlier, so I wanted to pre-empt that by saying that I tested it and it didn't change anything.

K900 commented 3 weeks ago

I believe this should be fixed on unstable, can you test that?

fynn-kropp commented 3 weeks ago

Give me a minute, will do.

fynn-kropp commented 3 weeks ago

Just to clarify, do you mean the nightly Firefox build or on NixOS Unstable?

K900 commented 3 weeks ago

NixOS unstable.

fynn-kropp commented 3 weeks ago

Alright, sorry it took so long. I fully uninstalled Firefox, upgraded to NixOS unstable and reinstalled Firefox. As far as I can tell, it does indeed work. Although interestingly, there is still no org.kde.plasma.browser_integration.json in ~.mozilla/native-messaging-hosts. Since it works anyway, I assume there's some symlinking going on that didn't work in the stable version? Either way, it's definitely fixed on the unstable branch.

K900 commented 3 weeks ago

That is normal, the native messaging hosts are injected through the wrapper.

fynn-kropp commented 3 weeks ago

That is normal, the native messaging hosts are injected through the wrapper.

Makes sense! Thank you for your help :) Does that mean there is something that's not working correctly with the wrapper in the stable version then?

K900 commented 3 weeks ago

The wrapper was refactored pretty heavily in unstable, which fixed many edge cases.

fynn-kropp commented 3 weeks ago

Fair enough. I guess manually copying the .json is at least a workaround for the stable branch until it's updated down the line. Unless there's a better solution I'm not aware of.

SuperSandro2000 commented 3 weeks ago

While we are talking about wrappers, it is still broken when using firefox-bin. Can we merge https://github.com/NixOS/nixpkgs/pull/303562 to fix that?