1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 11:39:46 +01:00

chromium: add support for dictionaries

this patch adds support for installing hunspell dictionaries in
chromium.
This commit is contained in:
networkException 2023-08-17 18:55:15 +02:00 committed by Robert Helgesson
parent 9706fb8e44
commit f8c5fd7509
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -123,6 +123,20 @@ let
documentation](https://developer.chrome.com/docs/extensions/mv2/external_extensions). 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: browserConfig = cfg:
@ -159,6 +173,11 @@ let
}); });
}; };
dictionary = pkg: {
name = "${configDir}/Dictionaries/${pkg.passthru.dictFileName}";
value.source = pkg;
};
package = if cfg.commandLineArgs != [ ] then package = if cfg.commandLineArgs != [ ] then
cfg.package.override { cfg.package.override {
commandLineArgs = concatStringsSep " " cfg.commandLineArgs; commandLineArgs = concatStringsSep " " cfg.commandLineArgs;
@ -168,8 +187,9 @@ let
in mkIf cfg.enable { in mkIf cfg.enable {
home.packages = [ package ]; home.packages = [ package ];
home.file = optionalAttrs (!isProprietaryChrome) home.file = optionalAttrs (!isProprietaryChrome) (listToAttrs
(listToAttrs (map extensionJson cfg.extensions)); ((map extensionJson cfg.extensions)
++ (map dictionary cfg.dictionaries)));
}; };
in { in {