From 6245dd11cf59698aacdf8b153e3e7070abbef36f Mon Sep 17 00:00:00 2001 From: Nicolas Berbiche Date: Wed, 17 Mar 2021 20:47:00 -0400 Subject: [PATCH] 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` --- modules/programs/chromium.nix | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/modules/programs/chromium.nix b/modules/programs/chromium.nix index a38602578..c866c0999 100644 --- a/modules/programs/chromium.nix +++ b/modules/programs/chromium.nix @@ -5,7 +5,9 @@ with lib; let browserModule = defaultPkg: name: visible: - let browser = (builtins.parseDrvName defaultPkg.name).name; + let + browser = (builtins.parseDrvName defaultPkg.name).name; + isProprietaryChrome = hasPrefix "Google Chrome" name; in { enable = mkOption { inherit visible; @@ -22,7 +24,9 @@ let defaultText = literalExample "pkgs.${browser}"; 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 { inherit visible; type = with types; @@ -129,10 +133,19 @@ let in mkIf cfg.enable { home.packages = [ cfg.package ]; - home.file = listToAttrs (map extensionJson cfg.extensions); + home.file = listToAttrs (map extensionJson (cfg.extensions or [ ])); }; 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 = { chromium = browserModule pkgs.chromium "Chromium" true; google-chrome = browserModule pkgs.google-chrome "Google Chrome" false;