From 76a01ad9d15e798fcf8e55adaa659c389a4c3fdf Mon Sep 17 00:00:00 2001 From: timor Date: Wed, 28 Feb 2018 14:32:52 +0100 Subject: [PATCH] hunspell-dicts: add support for german dictionary Note that this relies on ispell as a dependency. Also, perl and hunspell itself are used during building the dictionary. --- .../libraries/hunspell/dictionaries.nix | 58 ++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/hunspell/dictionaries.nix b/pkgs/development/libraries/hunspell/dictionaries.nix index 37c00f3e2aa..f30ec1872ba 100644 --- a/pkgs/development/libraries/hunspell/dictionaries.nix +++ b/pkgs/development/libraries/hunspell/dictionaries.nix @@ -1,6 +1,6 @@ /* hunspell dictionaries */ -{ stdenv, fetchurl, fetchFromGitHub, unzip, coreutils, bash, which, zip }: +{ stdenv, fetchurl, fetchFromGitHub, unzip, coreutils, bash, which, zip, ispell, perl, hunspell }: let @@ -168,6 +168,42 @@ let }; }; + mkDictFromJ3e = + { shortName, shortDescription, dictFileName }: + stdenv.mkDerivation rec { + name = "hunspell-dict-${shortName}-j3e-${version}"; + version = "20161207"; + + src = fetchurl { + url = "https://j3e.de/ispell/igerman98/dict/igerman98-${version}.tar.bz2"; + sha256 = "1a3055hp2bc4q4nlg3gmg0147p3a1zlfnc65xiv2v9pyql1nya8p"; + }; + + buildInputs = [ ispell perl hunspell ]; + + phases = ["unpackPhase" "installPhase"]; + installPhase = '' + patchShebangs bin + make hunspell/${dictFileName}.aff hunspell/${dictFileName}.dic + # hunspell dicts + install -dm755 "$out/share/hunspell" + install -m644 hunspell/${dictFileName}.dic "$out/share/hunspell/" + install -m644 hunspell/${dictFileName}.aff "$out/share/hunspell/" + # myspell dicts symlinks + install -dm755 "$out/share/myspell/dicts" + ln -sv "$out/share/hunspell/${dictFileName}.dic" "$out/share/myspell/dicts/" + ln -sv "$out/share/hunspell/${dictFileName}.aff" "$out/share/myspell/dicts/" + ''; + + meta = with stdenv.lib; { + homepage = https://www.j3e.de/ispell/igerman98/index_en.html; + description = shortDescription; + license = with licenses; [ gpl2 gpl3 ]; + maintainers = with maintainers; [ timor ]; + platforms = platforms.all; + }; + }; + in { /* ENGLISH */ @@ -427,4 +463,24 @@ in { }) ]; }; + + /* GERMAN */ + + de-de = mkDictFromJ3e { + shortName = "de-de"; + shortDescription = "German (Germany)"; + dictFileName = "de_DE"; + }; + + de-at = mkDictFromJ3e { + shortName = "de-at"; + shortDescription = "German (Austria)"; + dictFileName = "de_AT"; + }; + + de-ch = mkDictFromJ3e { + shortName = "de-ch"; + shortDescription = "German (Switzerland)"; + dictFileName = "de_CH"; + }; }