From f8c5fd75092448ac134d7fb823556b37d3c821f5 Mon Sep 17 00:00:00 2001 From: networkException Date: Thu, 17 Aug 2023 18:55:15 +0200 Subject: [PATCH] chromium: add support for dictionaries this patch adds support for installing hunspell dictionaries in chromium. --- modules/programs/chromium.nix | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/modules/programs/chromium.nix b/modules/programs/chromium.nix index 11a10547..0a02311b 100644 --- a/modules/programs/chromium.nix +++ b/modules/programs/chromium.nix @@ -123,6 +123,20 @@ let documentation](https://developer.chrome.com/docs/extensions/mv2/external_extensions). ''; }; + + dictionaries = mkOption { + inherit visible; + type = types.listOf types.package; + default = [ ]; + example = literalExpression '' + [ + pkgs.hunspellDictsChromium.en_US + ] + ''; + description = '' + List of ${name} dictionaries to install. + ''; + }; }; browserConfig = cfg: @@ -159,6 +173,11 @@ let }); }; + dictionary = pkg: { + name = "${configDir}/Dictionaries/${pkg.passthru.dictFileName}"; + value.source = pkg; + }; + package = if cfg.commandLineArgs != [ ] then cfg.package.override { commandLineArgs = concatStringsSep " " cfg.commandLineArgs; @@ -168,8 +187,9 @@ let in mkIf cfg.enable { home.packages = [ package ]; - home.file = optionalAttrs (!isProprietaryChrome) - (listToAttrs (map extensionJson cfg.extensions)); + home.file = optionalAttrs (!isProprietaryChrome) (listToAttrs + ((map extensionJson cfg.extensions) + ++ (map dictionary cfg.dictionaries))); }; in {