nixpkgs/pkgs/development/libraries/hunspell/dictionaries-chromium.nix
networkException 65a8090215
hunspellDictsChromium: init at 115.0.5790.170
chromium requires a custom format for hunspell dictionaries which
they provide as blobs in an upstream repository.

building from source (using convert_dict from the chromium monorepo
and applying it to already packaged dictionaries) would not yield
the same results (chromium packages adjustments to the dictionaries
themselves) and would increase the maintainance cost.

this patch adds a new hunspellDictsChromium attribute which includes
dictionaries from chromium.
2023-08-09 15:39:24 +02:00

71 lines
2 KiB
Nix

{ lib, stdenv, fetchgit }:
let
mkDictFromChromium = { shortName, dictFileName, shortDescription }:
stdenv.mkDerivation {
pname = "hunspell-dict-${shortName}-chromium";
version = "115.0.5790.170";
src = fetchgit {
url = "https://chromium.googlesource.com/chromium/deps/hunspell_dictionaries";
rev = "41cdffd71c9948f63c7ad36e1fb0ff519aa7a37e";
hash = "sha256-67mvpJRFFa9eMfyqFMURlbxOaTJBICnk+gl0b0mEHl8=";
};
dontBuild = true;
installPhase = ''
cp ${dictFileName} $out
'';
passthru = {
# As chromium needs the exact filename in ~/.config/chromium/Dictionaries,
# this value needs to be known to tools using the package if they want to
# link the file correctly.
inherit dictFileName;
updateScript = ./update-chromium-dictionaries.py;
};
meta = {
homepage = "https://chromium.googlesource.com/chromium/deps/hunspell_dictionaries/";
description = "Chromium compatible hunspell dictionary for ${shortDescription}";
longDescription = ''
Humspell directories in Chromium's custom bdic format
See https://www.chromium.org/developers/how-tos/editing-the-spell-checking-dictionaries/
'';
license = with lib.licenses; [ gpl2 lgpl21 mpl11 lgpl3 ];
maintainers = with lib.maintainers; [ networkexception ];
platforms = lib.platforms.all;
};
};
in
rec {
/* ENGLISH */
en_US = en-us;
en-us = mkDictFromChromium {
shortName = "en-us";
dictFileName = "en-US-10-1.bdic";
shortDescription = "English (United States)";
};
en_GB = en-us;
en-gb = mkDictFromChromium {
shortName = "en-gb";
dictFileName = "en-GB-10-1.bdic";
shortDescription = "English (United Kingdom)";
};
/* GERMAN */
de_DE = de-de;
de-de = mkDictFromChromium {
shortName = "de-de";
dictFileName = "de-DE-3-0.bdic";
shortDescription = "German (Germany)";
};
}