Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Firefox module ready to work with Gnome extension #31

Open
wants to merge 1 commit into
base: calamares
Choose a base branch
from

Conversation

Thatoo
Copy link

@Thatoo Thatoo commented Apr 2, 2024

As a newcomer installing the Gnome ISO, one would expect gnome extension to work right away with the "by default" installed firefox.

This PR comes after this discussion : NixOS/nixpkgs#300577

As a newcomer installing the Gnome ISO, one would expect gnome extension to work right away with the "by default" installed firefox.
@Thatoo
Copy link
Author

Thatoo commented Apr 2, 2024

Gnome user would expect to be able to use https://addons.mozilla.org/fr/firefox/addon/gnome-shell-integration right after installation time.

I even wonder if this firefox extension should not be installed by default during installation time thanks to icicle. If I understand what is written here, https://support.mozilla.org/en-US/kb/deploying-firefox-with-extensions , it would require to download the last version from https://addons.mozilla.org/firefox/downloads/latest/gnome-shell-integration/latest.xpi, rename it to [email protected] (the add-on ID found in here https://gitlab.gnome.org/GNOME/gnome-browser-extension/-/blob/master/extension/manifest.firefox.json) and place it into the <firefox installation folder>/distribution/extensions/ folder.

I'd be glad to add that to this PR too but I'm not sure how to do so. I don't know where would be this <firefox installation folder> in nixos.

@Thatoo
Copy link
Author

Thatoo commented Apr 2, 2024

One more advantage is that if a user wants, for example, to install some "special" firefox extension such as
https://addons.mozilla.org/fr/firefox/addon/gsconnect/
or
https://addons.mozilla.org/fr/firefox/addon/pwas-for-firefox/
the user would only need to learn to add it to both
PATH and nativeMessagingHosts to make it possible for the extension to detect and use it.
such as

  programs.firefox = {
    enable = true;
    package = pkgs.firefox;
    nativeMessagingHosts.packages = with pkgs; [
      browserpass
      gnomeExtensions.gsconnect
      unstable.firefoxpwa
    ];
  };

  programs.kdeconnect = {
    enable = true;
    package = pkgs.gnomeExtensions.gsconnect;
  };

  environment.systemPackages = with pkgs; [
    firefoxpwa
  ];

@Thatoo
Copy link
Author

Thatoo commented Apr 2, 2024

if

  programs.firefox = {
    enable = true;
    package = pkgs.firefox;
    nativeMessagingHosts.packages = with pkgs; [
      browserpass
    ];
  };

is not already present in the configuration.nix file after install, it will require much more work (dig in forums, ask and disturb again on matrix room..) for the new comers to reach to his/her goal.

@Thatoo
Copy link
Author

Thatoo commented Apr 2, 2024

Finally, I would offer to use this PR to solve some comment issue in the code :

    if gs.value("packagechooser_packagechooser") != "":
        cfg += cfgfirefox

    # Check if unfree packages are allowed
    free = True
    if gs.value("packagechooser_unfree") is not None:
        if gs.value("packagechooser_unfree") == "unfree":
            free = False
            cfg += cfgunfree

    cfg += cfgpkgs
    # Use firefox as default as a graphical web browser, and add kate to plasma desktop
    if gs.value("packagechooser_packagechooser") == "plasma":
        catenate(variables, "pkgs", "\n      kate\n    #  thunderbird\n    ")
    elif gs.value("packagechooser_packagechooser") != "":
        catenate(variables, "pkgs", "\n    #  thunderbird\n    ")
    else:
        catenate(variables, "pkgs", "")

I guess the comment line
# Use firefox as default as a graphical web browser, and add kate to plasma desktop
is a heritage and is not related to the today code.
What do you think of

    # Use firefox as default as a graphical web browser
    if gs.value("packagechooser_packagechooser") != "":
        cfg += cfgfirefox

    # Check if unfree packages are allowed
    free = True
    if gs.value("packagechooser_unfree") is not None:
        if gs.value("packagechooser_unfree") == "unfree":
            free = False
            cfg += cfgunfree

    cfg += cfgpkgs
    # Add kate to plasma desktop and suggest Thunderbird as mail client
    if gs.value("packagechooser_packagechooser") == "plasma":
        catenate(variables, "pkgs", "\n      kate\n    #  thunderbird\n    ")
    elif gs.value("packagechooser_packagechooser") != "":
        catenate(variables, "pkgs", "\n    #  thunderbird\n    ")
    else:
        catenate(variables, "pkgs", "")

enable = true;
package = pkgs.firefox;
nativeMessagingHosts.packages = with pkgs; [
browserpass
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If installing it is a too big change, we could do the same than for Thunderbird, just suggesting it by writting it but commenting it like

    nativeMessagingHosts.packages = with pkgs; [
      # browserpass

This way, it won't change installation process at all but it will make it very much easier for new comers to find out how to activate it and make Firefox work with Gnome extension and also.

It would also give indication where the user should add thing like
gnomeExtensions.gsconnect or firefoxpwa :

    nativeMessagingHosts.packages = with pkgs; [
      browserpass
      gnomeExtensions.gsconnect
      firefoxpwa
    ];
  };

@jtojnar
Copy link
Member

jtojnar commented Apr 13, 2024

It has already been fixed by 972e34b.

The messaging host does not need to be enabled manually since it is done by the connector module enabled in GNOME by default:

https://github.com/NixOS/nixpkgs/blob/aab82e1d8b862d0267e8863bb5c971fb1c17a81d/nixos/modules/services/x11/desktop-managers/gnome.nix#L389

I even wonder if this firefox extension should not be installed by default during installation time thanks to icicle.

I would not recommend installing GNOME Shell extensions from extension.gnome.org since some extensions require patching, which is only available in Nixpkgs.

@Thatoo
Copy link
Author

Thatoo commented Apr 14, 2024

It has already been fixed by 972e34b.

partly only

The messaging host does not need to be enabled manually since it is done by the connector module enabled in GNOME by default:

https://github.com/NixOS/nixpkgs/blob/aab82e1d8b862d0267e8863bb5c971fb1c17a81d/nixos/modules/services/x11/desktop-managers/gnome.nix#L389

If I understand well here NixOS/nixpkgs@50c6895 , it has not been enable in 23.11 but will be in 24.05, isn't it? That would explain why I faced the issue and opened this PR.
Because currently, if I install nixos Gnome ISO and install firefox thanks to
programs.firefox.enable = true; only, it doesn't work. I need to install it like that in 23;11 to have it working properly :

  programs.firefox = {
    enable = true;
    package = pkgs.firefox;
    nativeMessagingHosts.packages = with pkgs; [
      browserpass
    ];
  };

If it will be done in 24.05, I would recommend to keep the issue opened till 24.05 get released then.

I would not recommend installing GNOME Shell extensions from extension.gnome.org since some extensions require patching, which is only available in Nixpkgs.

OK

@ElvishJerricco
Copy link
Contributor

Can we close this? If programs.firefox.enable = true doesn't result in a working firefox install, that's a nixos bug. This repo really does not need to package even more bespoke, opinionated configurations. This repo is supposed to just be the installer, and it should rely on NixOS to implement all the OS's features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants