1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-30 06:59:45 +01:00

chromium: remove 'extensions' option for proprietary Chrome versions (#1867)

Fixes #1383 by removing the `extensions` option for
- `programs.google-chrome`
- `programs.google-chrome-beta`
- `programs.google-chrome-dev`
This commit is contained in:
Nicolas Berbiche 2021-03-17 20:47:00 -04:00 committed by GitHub
parent ffbc3819e4
commit 6245dd11cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,7 +5,9 @@ with lib;
let let
browserModule = defaultPkg: name: visible: browserModule = defaultPkg: name: visible:
let browser = (builtins.parseDrvName defaultPkg.name).name; let
browser = (builtins.parseDrvName defaultPkg.name).name;
isProprietaryChrome = hasPrefix "Google Chrome" name;
in { in {
enable = mkOption { enable = mkOption {
inherit visible; inherit visible;
@ -22,7 +24,9 @@ let
defaultText = literalExample "pkgs.${browser}"; defaultText = literalExample "pkgs.${browser}";
description = "The ${name} package to use."; description = "The ${name} package to use.";
}; };
} // optionalAttrs (!isProprietaryChrome) {
# Extensions do not work with Google Chrome
# see https://github.com/nix-community/home-manager/issues/1383
extensions = mkOption { extensions = mkOption {
inherit visible; inherit visible;
type = with types; type = with types;
@ -129,10 +133,19 @@ let
in mkIf cfg.enable { in mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
home.file = listToAttrs (map extensionJson cfg.extensions); home.file = listToAttrs (map extensionJson (cfg.extensions or [ ]));
}; };
in { in {
# Extensions do not work with the proprietary Google Chrome version
# see https://github.com/nix-community/home-manager/issues/1383
imports = map (flip mkRemovedOptionModule
"The `extensions` option does not work on Google Chrome anymore.") [
[ "programs" "google-chrome" "extensions" ]
[ "programs" "google-chrome-beta" "extensions" ]
[ "programs" "google-chrome-dev" "extensions" ]
];
options.programs = { options.programs = {
chromium = browserModule pkgs.chromium "Chromium" true; chromium = browserModule pkgs.chromium "Chromium" true;
google-chrome = browserModule pkgs.google-chrome "Google Chrome" false; google-chrome = browserModule pkgs.google-chrome "Google Chrome" false;