home-manager
home-manager copied to clipboard
Plasma browser integration extension does not work with the firefox installed by home-manager
Issue description
The extension plasma-browser-integration does not work with firefox installed by home-manager but does work with the system's firefox (/run/current-system/sw/bin/firefox
)(they are using the same package pkg.firefox
)
Meta
Maintainer CC
Technical details
Temporary workaround: cp /run/current-system/sw/lib/mozilla/native-messaging-hosts/org.kde.plasma.browser_integration.json ~/.mozilla/native-messaging-hosts
That workaround works for me. I implemented it by adding this option, pulling org.kde.plasma.browser_integration.json
from the integration host package:
home.file.".mozilla/native-messaging-hosts/org.kde.plasma.browser_integration.json".source = "${pkgs.plasma-browser-integration}/lib/mozilla/native-messaging-hosts/org.kde.plasma.browser_integration.json";
In my opinion, it would be reasonable to add an option to enablePlasmaIntegration
, similar to enableGnomeExtensions
, as the firefox wrapper in nixpkgs already supports it (but I do not know if that would already solve the problem).
I solved this by copying the firefox module from home-manager and adding an option for an extraConfig, which gets passed to the package directly. This is what is already being done for the AdobeFlash and gnome extension options, they are just listed explicitly. You can ignore my changes involving program-name
, that was just so that this module wouldn't conflict with the existing firefox module.
diff --git a/modules/programs/firefox.nix b/../dotfiles/program/firefox/module.nix
index eafeef4..91d6532 100644
--- a/modules/programs/firefox.nix
+++ b/../dotfiles/program/firefox/module.nix
@@ -3,6 +3,7 @@
with lib;
let
+ program-name = "firefox-custom";
inherit (pkgs.stdenv.hostPlatform) isDarwin;
@@ -67,14 +66,14 @@ in
meta.maintainers = [ maintainers.rycee ];
imports = [
- (mkRemovedOptionModule ["programs" "firefox" "enableGoogleTalk"]
+ (mkRemovedOptionModule ["programs" program-name "enableGoogleTalk"]
"Support for this option has been removed.")
- (mkRemovedOptionModule ["programs" "firefox" "enableIcedTea"]
+ (mkRemovedOptionModule ["programs" program-name "enableIcedTea"]
"Support for this option has been removed.")
];
options = {
- programs.firefox = {
+ programs.${program-name} = {
enable = mkEnableOption "Firefox";
package = mkOption {
@@ -215,20 +207,11 @@ in
description = "Attribute set of Firefox profiles.";
};
- enableAdobeFlash = mkOption {
- type = types.bool;
- default = false;
- description = "Whether to enable the unfree Adobe Flash plugin.";
- };
-
- enableGnomeExtensions = mkOption {
- type = types.bool;
- default = false;
+ extraPackageConfig = mkOption {
+ type = types.attrsOf types.anything;
+ default = {};
description = ''
- Whether to enable the GNOME Shell native host connector. Note, you
- also need to set the NixOS option
- <literal>services.gnome3.chrome-gnome-shell.enable</literal> to
- <literal>true</literal>.
+ Additional config options expected by the Firefox package
'';
};
};
@@ -271,10 +254,7 @@ in
home.packages =
let
# The configuration expected by the Firefox wrapper.
- fcfg = {
- enableAdobeFlash = cfg.enableAdobeFlash;
- enableGnomeExtensions = cfg.enableGnomeExtensions;
- };
+ fcfg = cfg.extraPackageConfig;
# A bit of hackery to force a config into the wrapper.
browserName = cfg.package.browserName
Use it by importing the new module, and setting programs.firefox-custom = { enable = true; extraPackageConfig.enablePlasmaIntegration = true; };
Ideally we should open a pull request to make this a supported option. Rather than adding new options that get passed to the package wrapper, we should allow the user to pass in their own config, which allows for changes to the package without home-manager needing to be updated.
This also allowed me to add the tridactyl native messenger, which is another option that's supported in the nixpkgs firefox, but not here.
I personally pass arguments like so:
{
programs.firefox.package = pkgs.firefox.override {
cfg = {
enableFXCastBridge = true;
# other stuff
};
};
}
Note, the override does not trigger a rebuild of firefox-unwrapped
, it only affects the wrapper.
Edit: supported configuration options can be found when grepping for cfg
in https://github.com/NixOS/nixpkgs/blob/c8a7e4da0aac942485aad983a806840660fc9660/pkgs/applications/networking/browsers/firefox/wrapper.nix
{
programs.firefox.package = pkgs.firefox.override {
cfg = {
enablePlasmaBrowserIntegration = true;
};
};
}
Ah, I didn't know that was an option, I'll see if that works for me
— Abe White
On Dec 1, 2020, at 12:18, Nicolas Berbiche [email protected] wrote:
I personally pass arguments like so:
{ programs.firefox.package = pkgs.firefox.override { cfg = { enableFXCastBridge = true; # other stuff }; }; } Note, the override does not trigger a rebuild of firefox-unwrapped, it only affects the wrapper.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
@berbiche I am trying to make tridactyl-native
work on my home-manager
configuration using your technique, however it does not seem to be working (asking tridactyl
with the :native
command tells me that it is not installed).
Is this an actual fully declarative setup, or is there something that I am missing?
@berbiche I am trying to make
tridactyl-native
work on myhome-manager
configuration using your technique, however it does not seem to be working (askingtridactyl
with the:native
command tells me that it is not installed).Is this an actual fully declarative setup, or is there something that I am missing?
Sorry, I don't know. I would suggest opening an issue on nixpkgs since the issue seems to be with the firefok package.
Thank you for your contribution! I marked this issue as stale due to inactivity. If this remains inactive for another 7 days, I will close this issue. Please read the relevant sections below before commenting.
If you are the original author of the issue
- If this is resolved, please consider closing it so that the maintainers know not to focus on this.
- If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
- If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
If you are not the original author of the issue
- If you are also experiencing this issue, please add details of your situation to help with the debugging process.
- If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Memorandum on closing issues
If you have nothing of substance to add, please refrain from commenting and allow the bot close the issue. Also, don't be afraid to manually close an issue, even if it holds valuable information.
Closed issues stay in the system for people to search, read, cross-reference, or even reopen--nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.
this issue still exists
Thank you for your contribution! I marked this issue as stale due to inactivity. If this remains inactive for another 7 days, I will close this issue. Please read the relevant sections below before commenting.
If you are the original author of the issue
- If this is resolved, please consider closing it so that the maintainers know not to focus on this.
- If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
- If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
If you are not the original author of the issue
- If you are also experiencing this issue, please add details of your situation to help with the debugging process.
- If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Memorandum on closing issues
If you have nothing of substance to add, please refrain from commenting and allow the bot close the issue. Also, don't be afraid to manually close an issue, even if it holds valuable information.
Closed issues stay in the system for people to search, read, cross-reference, or even reopen--nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.
Still exists
@berbiche 's solution works for me !
Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.
If you are the original author of the issue
- If this is resolved, please consider closing it so that the maintainers know not to focus on this.
- If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
- If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
If you are not the original author of the issue
- If you are also experiencing this issue, please add details of your situation to help with the debugging process.
- If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Memorandum on closing issues
Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.
I think the issue can be closed, I do not experience this issue with trydactyl-native
, when using the cfg.package
override method.
Edit: supported configuration options can be found when grepping for
cfg
in NixOS/nixpkgs@c8a7e4d
/pkgs/applications/networking/browsers/firefox/wrapper.nix{ programs.firefox.package = pkgs.firefox.override { cfg = { enablePlasmaBrowserIntegration = true; }; }; }
This still needs to be implemented.
@SuperSandro2000 what do you mean?
A home manager option to just enable this like there is for gnome.
I'm of the opinion that we can document it, point out how to find all options in nixpkgs (as package overrides are not documented in any meaningful way), but we should not write an option for each of the possible overrides, which are painful to keep in sync with nixpkgs.
When adding:
Then trying to nixos-rebuild
, I get:
$ sudo nixos-rebuild switch --upgrade-all --flake path:///home/pol/Code/drupol/nixos-x260/ -v
$ nix --extra-experimental-features nix-command flakes build --out-link /tmp/nixos-rebuild.iCufm5/nixos-rebuild path:///home/pol/Code/drupol/nixos-x260/#nixosConfigurations."x260".config.system.build.nixos-rebuild -v
$ exec /nix/store/kl66mgvpiqnffql0ypsxll310zczinsf-nixos-rebuild/bin/nixos-rebuild switch --upgrade-all --flake path:///home/pol/Code/drupol/nixos-x260/ -v
building the system configuration...
Building in flake mode.
$ nix --extra-experimental-features nix-command flakes build path:///home/pol/Code/drupol/nixos-x260/#nixosConfigurations."x260".config.system.build.toplevel -v --out-link /tmp/nixos-rebuild.BtNQ90/result
error: attribute 'gtk3' missing
at /nix/store/ny7x54058ki7k1d3ny0jx5h6kw926mxv-source/pkgs/applications/networking/browsers/firefox/wrapper.nix:186:23:
185| nativeBuildInputs = [ makeWrapper lndir jq ];
186| buildInputs = [ browser.gtk3 ];
| ^
187|
(use '--show-trace' to show detailed location information)
Adding
home.file.".mozilla/native-messaging-hosts/org.kde.plasma.browser_integration.json".source = "${pkgs.plasma-browser-integration}/lib/mozilla/native-messaging-hosts/org.kde.plasma.browser_integration.json";
Made it work ! Thanks @CRTified !
Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.
If you are the original author of the issue
- If this is resolved, please consider closing it so that the maintainers know not to focus on this.
- If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
- If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
If you are not the original author of the issue
- If you are also experiencing this issue, please add details of your situation to help with the debugging process.
- If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Memorandum on closing issues
Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.
For posterity. and those looking for a "complete" and "purely HM" soution:
Code paste
{config, pkgs, ...}:
{
programs.firefox = {
enable = true;
package = pkgs.firefox.override {
cfg = {
# Set nixkgs.legacyPackages.$system.pkgs.firefox.* options:
# Enable pass-ff extension native messaging
extraNativeMessagingHosts = [pkgs.passff-host];
};
};
};
# Install pass-ff extension required file:
home.file.".mozilla/native-messaging-hosts/passff.json".source = "${pkgs.passff-host}/share/passff-host/passff.json";
}
For posterity. and those looking for a "complete" and "purely HM" soution:
Oops - wrong GH issue thread /embarassed. Tangentially related though.
Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.
If you are the original author of the issue
- If this is resolved, please consider closing it so that the maintainers know not to focus on this.
- If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
- If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
If you are not the original author of the issue
- If you are also experiencing this issue, please add details of your situation to help with the debugging process.
- If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Memorandum on closing issues
Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.
Just for reference — since nixpkgs commit 60421a1
, the enablePlasmaBrowserIntegration
option has been deprecated. You should now do:
{pkgs, ...}: {
programs.firefox.package = pkgs.firefox.override {
cfg.nativeMessagingHosts.packages = [pkgs.plasma5Packages.plasma-browser-integration];
};
# ...
}