home-manager
home-manager copied to clipboard
bug: chromium.extensions don't work for brave or ungoogled-chromium
Is there an existing issue for this?
- [X] I have searched the existing issues
Issue description
See #1383
programs.chromium.extensions does not work when programs.chromium.package = brave | ungoogled-chromium
For brave first of all it doesn't install in the correct directory. It installs in .config/brave/ but brave's configs are stored in .config/BraveSoftware/Brave-Browser/, I tried manually moving the files but that doesn't work.
For ungoogled-chromium I just don't see that the extensions are being installed, I assume it should work the same as in chromium
chromium works as expected.
Maintainer CC
@colinxs @berbiche
System information
- system: `"x86_64-linux"`
- host os: `Linux 5.13.4, NixOS, 21.05.1669.973910f5c31 (Okapi)`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.3.14`
- channels(root): `"home-manager-21.05, nixos-21.05.1669.973910f5c31, nixos-unstable-21.11pre304061.dd14e5d78e9"`
- channels(yisraeldov): `"nixos-21.05.1669.973910f5c31"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
Has this ever worked for ungoogled-chromium? I think it doesn't work because "Chrome Webstore interface" is disabled[1] on the ungoogled version. I also cannot install extensions manually from the chrome web store.
Probably not optimal, but I was able to install the extensions by first downloading them and then loading them locally, which only works for Linux:
extensions =
let
createChromiumExtensionFor = browserVersion: { id, sha256, version }:
{
inherit id;
crxPath = builtins.fetchurl {
url = "https://clients2.google.com/service/update2/crx?response=redirect&acceptformat=crx2,crx3&prodversion=${browserVersion}&x=id%3D${id}%26installsource%3Dondemand%26uc";
name = "${id}.crx";
inherit sha256;
};
inherit version;
};
createChromiumExtension = createChromiumExtensionFor (lib.versions.major package.version);
in
[
(createChromiumExtension {
# ublock origin
id = "cjpalhdlnbpafiamejdnhcphjbkeiagm";
sha256 = "sha256-u81DNkZw/LBVyjk5nmrrJEVjdc+GFCay+rQZGpDH3jA=";
version = "1.37.2";
})
(createChromiumExtension {
# dark reader
id = "eimadpbcbfnmbkopoojfekhnkhdbieeh";
sha256 = "sha256-JcM2Ki3cTWdskFEFs2jk6LQUTFOojkBf+6HqO1GPK90=";
version = "4.9.34";
})
];
[1] https://ungoogled-software.github.io/ungoogled-chromium-wiki/faq#can-i-install-extensions-or-themes-from-the-chrome-webstore
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/home-manager-ungoogled-chromium-with-extensions/15214/2
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.
Not stale
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.
Not stale
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.
Not stale, still relevant. Workaround above works, but requires manual updates.
programs.brave.extensions work 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.
Not stale
@ilkecan does this still work for you? For me the extensions download but do not appear in chromium.
Probably not optimal, but I was able to install the extensions by first downloading them and then loading them locally, which only works for Linux:
extensions = let createChromiumExtensionFor = browserVersion: { id, sha256, version }: { inherit id; crxPath = builtins.fetchurl { url = "https://clients2.google.com/service/update2/crx?response=redirect&acceptformat=crx2,crx3&prodversion=${browserVersion}&x=id%3D${id}%26installsource%3Dondemand%26uc"; name = "${id}.crx"; inherit sha256; }; inherit version; }; createChromiumExtension = createChromiumExtensionFor (lib.versions.major package.version); in [ (createChromiumExtension { # ublock origin id = "cjpalhdlnbpafiamejdnhcphjbkeiagm"; sha256 = "sha256-u81DNkZw/LBVyjk5nmrrJEVjdc+GFCay+rQZGpDH3jA="; version = "1.37.2"; }) (createChromiumExtension { # dark reader id = "eimadpbcbfnmbkopoojfekhnkhdbieeh"; sha256 = "sha256-JcM2Ki3cTWdskFEFs2jk6LQUTFOojkBf+6HqO1GPK90="; version = "4.9.34"; }) ];[1] https://ungoogled-software.github.io/ungoogled-chromium-wiki/faq#can-i-install-extensions-or-themes-from-the-chrome-webstore
here is my setup:
{ ...}:
{
home-manager.users.myname = { config, pkgs, lib, ... }:
{
programs.chromium = {
enable = true;
package = pkgs.ungoogled-chromium;
extensions =
let
createChromiumExtensionFor = browserVersion: { id, sha256, version }:
{
inherit id;
crxPath = builtins.fetchurl {
url = "https://clients2.google.com/service/update2/crx?response=redirect&acceptformat=crx2,crx3&prodversion=${browserVersion}&x=id%3D${id}%26installsource%3Dondemand%26uc";
name = "${id}.crx";
inherit sha256;
};
inherit version;
};
createChromiumExtension = createChromiumExtensionFor (lib.versions.major pkgs.ungoogled-chromium.version);
in [
(createChromiumExtension {
# ublock origin
id = "cjpalhdlnbpafiamejdnhcphjbkeiagm";
sha256 = "sha256:0ycnkna72n969crgxfy2lc1qbndjqrj46b9gr5l9b7pgfxi5q0ll";
version = "4.7.0";
})
];
};
I can verify that @ilkecan's workaround still works.
The issue with your setup is that the value for version is incorrect. The current version on the web store is 1.62.0. Your sha256sum is correct for that version, so I presume that you ran nix-prefetch-url on it. To fix the issue, all you need to do is to edit that single line, i.e.,
(createChromiumExtension {
# ublock origin
id = "cjpalhdlnbpafiamejdnhcphjbkeiagm";
sha256 = "sha256:0ycnkna72n969crgxfy2lc1qbndjqrj46b9gr5l9b7pgfxi5q0ll";
version = "4.7.0";
})
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.
Not stale. It seems that the version difference between Brave and Chromium/Ungoogled Chromium can cause issues when you download the crx files to calculate the hash.
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 can confirm that it actually works for Brave if you replace programs.chromium by programs.brave. I.e. both programs.brave.enable=true and programs.brave.extensions = [...]. Of course it doesn't help that there isn't any documentation about this.
No idea about ungoogled-chromium though.