diff options
Diffstat (limited to 'modules/web/chromium/default.nix')
| -rw-r--r-- | modules/web/chromium/default.nix | 141 |
1 files changed, 80 insertions, 61 deletions
diff --git a/modules/web/chromium/default.nix b/modules/web/chromium/default.nix index f867e3b..8cf0bea 100644 --- a/modules/web/chromium/default.nix +++ b/modules/web/chromium/default.nix @@ -1,7 +1,7 @@ -# Chromium - Web browser configuration { config, lib, + pkgs, ... }: { @@ -17,77 +17,96 @@ defaultText = lib.literalExpression "config.programs.chromium.finalPackage"; description = "Package to use for chromium. Defaults to the wrapped finalPackage from programs.chromium."; }; + checkForUpdates = lib.mkOption { + type = lib.types.bool; + default = true; + description = '' + Check GitHub for newer extension releases before building, and abort + with upgrade instructions if the pinned version is stale. Requires + network access during evaluation (pass --impure to nix/home-manager). + ''; + }; }; - config = lib.mkIf config.web.chromium.enable { - programs.chromium = { - enable = true; + config = lib.mkIf config.web.chromium.enable ( + let + exts = import ./extensions { + inherit lib pkgs; + checkForUpdates = config.web.chromium.checkForUpdates; + }; - commandLineArgs = [ - "--force-device-scale-factor=1.15" + extensionDirs = [ + exts.ublockOrigin.drv + exts.darkMode.drv + exts.browserpass.drv + exts.aria2Explorer.drv ]; - extensions = [ - { id = "ddkjiahejlhfcafbddmgiahcphecmpfh"; } # uBlock Origin Lite - { id = "naepdomgkenhinolocfifgehidddafch"; } # Browserpass - { id = "faeadnfmdfamenfhaipofoffijhlnkif"; } # True Amoled Black Theme - { id = "eimadpbcbfnmbkopoojfekhnkhdbieeh"; } # Dark Reader - { id = "mpkodccbngfoacfalldjimigbofkhgjn"; } # Aria2 Explorer + pinnedIds = lib.filter (id: id != null) [ + exts.browserpass.id + exts.darkMode.id + exts.ublockOrigin.id ]; - }; + in + { + programs.chromium = { + enable = true; + package = pkgs.ungoogled-chromium; + commandLineArgs = [ + "--force-device-scale-factor=1.15" + "--load-extension=${lib.concatStringsSep "," extensionDirs}" + ]; + }; - xdg.mimeApps.defaultApplications = { - "x-scheme-handler/http" = "chromium-browser.desktop"; - "x-scheme-handler/https" = "chromium-browser.desktop"; - "x-scheme-handler/chrome" = "chromium-browser.desktop"; - "text/html" = "chromium-browser.desktop"; - "application/xhtml+xml" = "chromium-browser.desktop"; - }; + xdg.mimeApps.defaultApplications = { + "x-scheme-handler/http" = "chromium-browser.desktop"; + "x-scheme-handler/https" = "chromium-browser.desktop"; + "x-scheme-handler/chrome" = "chromium-browser.desktop"; + "text/html" = "chromium-browser.desktop"; + "application/xhtml+xml" = "chromium-browser.desktop"; + }; - xdg.configFile."chromium/Default/Preferences" = { - force = true; - text = builtins.toJSON { - browser = { - show_full_urls = true; - theme = { - follows_system_colors = true; + xdg.configFile."chromium/Default/Preferences" = { + force = true; + text = builtins.toJSON { + browser = { + show_full_urls = true; + theme = { + follows_system_colors = true; + }; }; - }; - search = { - suggest_enabled = false; - }; - url_handling = { - show_full_urls = true; - }; - autofill = { - profile_enabled = false; - credit_card_enabled = false; - }; - vertical_tabs = { - collapsed_state = true; - enabled = true; - enabled_first_time = true; - uncollapsed_width = 240; - }; - credentials_enable_service = false; - credentials_enable_autosignin = false; - extensions = { - pinned_extensions = [ - "ddkjiahejlhfcafbddmgiahcphecmpfh" - "naepdomgkenhinolocfifgehidddafch" - "eimadpbcbfnmbkopoojfekhnkhdbieeh" - ]; - ui = { - developer_mode = true; + search = { + suggest_enabled = false; }; - }; - profile = { - default_content_setting_values = { - notifications = 2; + url_handling = { + show_full_urls = true; + }; + autofill = { + profile_enabled = false; + credit_card_enabled = false; + }; + vertical_tabs = { + collapsed_state = true; + enabled = true; + enabled_first_time = true; + uncollapsed_width = 240; }; + credentials_enable_service = false; + credentials_enable_autosignin = false; + extensions = { + pinned_extensions = pinnedIds; + ui = { + developer_mode = true; + }; + }; + profile = { + default_content_setting_values = { + notifications = 2; + }; + }; + high_efficiency_mode_enabled = true; }; - high_efficiency_mode_enabled = true; }; - }; - }; + } + ); } |
