nix-community / home-manager

Manage a user environment using Nix [maintainer=@rycee]
https://nix-community.github.io/home-manager/
MIT License
7.1k stars 1.83k forks source link

Firefox module handling changed upstream #1641

Open mtreca opened 3 years ago

mtreca commented 3 years ago

Maybe more of a heads up than an issue in itself.

Nixpkgs introduced a way to manage Firefox plugins in a recent PR (see here). Someone already opened an issue about this on the nixpkgs repo (see here). ALso, this breaks my home-manager configuration for Firefox:

  home-manager.users.mtreca.programs.firefox = {
    enable = true;
    package = pkgs.userfox;
    profiles.mtreca = {
      settings = {
        "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
        "browser.urlbar.maxRichResults" = 0;
        "browser.download.folderList" = 2;
        "browser.download.dir" = "/home/mtreca/tmp";
        "browser.urlbar.update1" = false;
      };
      userChrome = builtins.readFile ../../lib/userChrome.css;
      userContent = builtins.readFile ../../lib/userContent.css;
    };
  };

There is an open PR than intends to fix the first issue (not being able to add modules through Firefox); but I don't know if it involves any changes for the Firefox module on the HM side of things.

Also, IIRC, there has been quite a lot of discussions for adding Firefox modules through home-manager. It should be covered upstream now!

mweinelt commented 3 years ago

In fact the latest changes prevent master from rebuilding for me.

/nix/store/zbdjq217kqq86d5qnn8aiqpf200m6j98-stdenv-linux/setup: line 1382: /nix/store/17hkh7fh73rwzbfvdrh9qnai7a9zv4y0-firefox-83.0/nix-support/propagated-user-env-packages: Permission denied
builder for '/nix/store/rrs57ygzbizv0dkph2q9zl3a5dh1hlkb-firefox-83.0.drv' failed with exit code 1
cannot build derivation '/nix/store/9dig0n3sbd0qsykvy45gp3rlkylidi90-home-manager-path.drv': 1 dependencies couldn't be built

And I have probably the simplest of configs

  programs.firefox = {
    enable = true;
    package = pkgs.firefox-wayland;
  };
wiltaylor commented 3 years ago

Can we please roll the whole firefox change back and maybe build it as a seperate package. It is causing a lot of havok.

mweinelt commented 3 years ago

There are no packages in home-manager. You are probably looking for https://github.com/NixOS/nixpkgs/issues/105987.

On Sat, Dec 05, 2020 at 05:15:05PM -0800, Wil Taylor wrote:

Can we please roll the whole firefox change back and maybe build it as a seperate package. It is causing a lot of havok.

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/nix-community/home-manager/issues/1641#issuecomment-739439587

pinpox commented 3 years ago

All my firefox extensions have disappeared! While my home-manager configuration still works, no firefox extensions are present anymore and I can't find a way to enable them. Also it is not possible to install extensions manually, since firefox tells me I can't have a mix of managed and unmanaged extensions.

What is the correct way to handle firefox extensions now? The configuration I'm using for firefox is this: https://github.com/pinpox/nixos-home/blob/master/browsers.nix

pltanton commented 3 years ago

It seems like there is already a PR, that should solve the problem: https://github.com/NixOS/nixpkgs/pull/105796

By the way, I found a quick workaround to solve this issue by using firefox-bin package, until fix will be merged to upstream.

pinpox commented 3 years ago

By the way, I found a quick workaround to solve this issue by using firefox-bin package, until fix will be merged to upstream.

That is great, thank you!

Sciencei commented 3 years ago

For whatever reason changing to firefox-bin didn't do anything for me. A different workaround which is working for me is to use extraPolicies to overwrite the policy which is disallowing installing extensions:

  programs.firefox = {
    enable = true;
    package = pkgs.wrapFirefox pkgs.firefox-unwrapped {
      extraPolicies = {
        ExtensionSettings = {};
      };
    };
  };
mtreca commented 3 years ago

@Sciencei Thanks for the trick. I tried all solutions mentionned above, I am still getting an permission issue (?) when rebuilding:

WARNING: Couldn't set ownership of text file bin/.firefox-old
/nix/store/zbdjq217kqq86d5qnn8aiqpf200m6j98-stdenv-linux/setup: line 1382: /nix/store/vv6nxglvikxqwksi1qy4adckzisq6rs2-firefox-83.0/nix-support/propagated-user-env-packages: Permission denied
builder for '/nix/store/64gg3nvdp0lnnkw5r7ddx05jf1gmkvmj-firefox-83.0.drv' failed with exit code 1
cannot build derivation '/nix/store/460w9bpirrkf147gzn73hnla9qkslkk6-home-manager-path.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/5xqki3kd4if8jqq7dnsj47w0llxypnp6-home-manager-generation.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/zjlywwyyz09qngmlpf9v40r8hcw71wll-activate-mtreca.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/d19dz2blvfa25v99v2k5k2c4bqw61yyf-unit-home-manager-mtreca.service.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/j81dkvvlqgkaqzsxx0nirrfajm8acfsl-system-units.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/ychc1hqli71ifq7qsh655wna04ylvk2j-etc.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/3mqpy9c9h6xfs9sc71f97clhipdx08ay-nixos-system-turing-21.03pre256757.cf7475d2061.drv': 1 dependencies couldn't be built
error: build of '/nix/store/3mqpy9c9h6xfs9sc71f97clhipdx08ay-nixos-system-turing-21.03pre256757.cf7475d2061.drv' failed
lokegustafsson commented 3 years ago

I am getting the same permission issue, but with firefox-bin. Does anyone have any idea what causes it?

tadfisher commented 3 years ago

I believe the issue is due to firefox becoming double-wrapped by both home-manager and the new policies support in nixpkgs. Ideally home-manager should be updated to install add-ons using policies; however, the fact that wrappers aren't composable results in this brokenness and should be fixed upstream.

tadfisher commented 3 years ago

Hmm, I was able to set

home.stateVersion = "21.03";

and I am now able to at least build my configuration. I believe 19.09 is when home-manager started expecting a wrapped Firefox instead of an unwrapped one.

lokegustafsson commented 3 years ago

Ah, thank you! I had read through the home-manager module many times but never noticed that home.stateVersion exists... I had always thought that I had that sorted, since my system.stateVersion was up to date. Now that I no longer have the implicit "18.03" firefox-bin works as it should.

stale[bot] commented 3 years ago

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.

leo60228 commented 3 years ago

This is still an issue.

mainrs commented 2 years ago

I am actually able to install firefox with extensions and custom settings without issues.

programs.firefox = {
        enable = true;
        extensions = with pkgs.nur.repos.rycee.firefox-addons; [
          #...
        ];
        profiles = {
            modifiedProfile = { isDefault = true; ... };
        }
}

It's worth nothing though that I had to manually enable every extension myself. I don't think that it's possible to automatically enable them.

Maybe I am missing the difference between the above config and my :thinking: