# Hunspell dictionaries, joined into one directory so anything needing a # dictionary *path* can be pointed at a single store path. # # Two consumers, two mechanisms: # - LibreOffice needs nothing beyond the package being installed: its wrapper # scans `share/hunspell` in every NIX_PROFILES entry. # - Gecko apps (LibreWolf, Thunderbird) need `spellchecker.dictionary_path` # set explicitly — there is no /usr/share/hunspell on NixOS and wrapFirefox # wires up nothing itself. Point that pref at `local.dictionaries.path`. # # Chromium-based browsers are NOT served by this: they ignore hunspell and # fetch their own dictionaries, selected by enterprise policy. # # Which languages is a personal choice, so the default is empty; a consumer sets # `local.dictionaries.packages = [ pkgs.hunspellDicts.de_DE ];`. en-US ships # inside Firefox/Thunderbird already and does not need listing for those. { config, lib, pkgs, ... }: let cfg = config.local.dictionaries; joined = pkgs.symlinkJoin { name = "hunspell-dicts"; paths = cfg.packages; }; in { options.local.dictionaries = { packages = lib.mkOption { type = lib.types.listOf lib.types.package; default = [ ]; example = lib.literalExpression "[ pkgs.hunspellDicts.de_DE ]"; description = '' Hunspell dictionary packages to install and expose via `local.dictionaries.path`. ''; }; path = lib.mkOption { type = lib.types.str; readOnly = true; description = '' Directory holding every `packages` dictionary. Feed this to `spellchecker.dictionary_path` in Gecko apps. ''; }; }; config = { local.dictionaries.path = "${joined}/share/hunspell"; home.packages = lib.optional (cfg.packages != [ ]) joined; }; }