feat(dictionaries): add hunspell dictionary module
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
# 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;
|
||||
};
|
||||
}
|
||||
+1
-1
@@ -125,7 +125,7 @@ let
|
||||
'';
|
||||
in
|
||||
{
|
||||
imports = [ ./gpg.nix ./media.nix ./texlive.nix ./librewolf.nix ./mc.nix ./mime.nix ./hyprland-workspaces.nix ./nvim.nix ];
|
||||
imports = [ ./gpg.nix ./media.nix ./texlive.nix ./librewolf.nix ./mc.nix ./mime.nix ./hyprland-workspaces.nix ./nvim.nix ./dictionaries.nix ];
|
||||
|
||||
# Put ~/.local/bin (the XDG user-bin dir) on PATH so hand-dropped scripts run
|
||||
# by name without wiring each through nix.
|
||||
|
||||
Reference in New Issue
Block a user