From 9500d14459c71c8a9ecffb7e4c65cbee43ca7b69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20=22Capypara=22=20K=C3=B6pcke?= Date: Sun, 7 Jul 2024 17:42:21 +0200 Subject: [PATCH 1/5] libreoffice: Load Hyphen dictionaries --- pkgs/applications/office/libreoffice/wrapper.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/office/libreoffice/wrapper.nix b/pkgs/applications/office/libreoffice/wrapper.nix index 013a2ee5575e..4f86406e5159 100644 --- a/pkgs/applications/office/libreoffice/wrapper.nix +++ b/pkgs/applications/office/libreoffice/wrapper.nix @@ -50,9 +50,13 @@ let # Add dictionaries from all NIX_PROFILES "--run" (lib.escapeShellArg '' for PROFILE in $NIX_PROFILES; do - HDIR="$PROFILE/share/hunspell" - if [ -d "$HDIR" ]; then - export DICPATH=$DICPATH''${DICPATH:+:}$HDIR + HU_DIR="$PROFILE/share/hunspell" + HY_DIR="$PROFILE/share/hyphen" + if [ -d "$HU_DIR" ]; then + export DICPATH=$DICPATH''${DICPATH:+:}$HU_DIR + fi + if [ -d "$HY_DIR" ]; then + export DICPATH=$DICPATH''${DICPATH:+:}$HY_DIR fi done '') From 1b93dc9f9bd7e45bda7cbe89370a85871f0dce17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20=22Capypara=22=20K=C3=B6pcke?= Date: Sun, 7 Jul 2024 17:42:42 +0200 Subject: [PATCH 2/5] hyphen: Add more dictionaries, move en-US out of hyphen package --- pkgs/development/libraries/hyphen/default.nix | 12 +++ .../libraries/hyphen/dictionaries.nix | 91 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 105 insertions(+) create mode 100644 pkgs/development/libraries/hyphen/dictionaries.nix diff --git a/pkgs/development/libraries/hyphen/default.nix b/pkgs/development/libraries/hyphen/default.nix index 2759ad9af737..23e31e41a8c1 100644 --- a/pkgs/development/libraries/hyphen/default.nix +++ b/pkgs/development/libraries/hyphen/default.nix @@ -17,6 +17,18 @@ in stdenv.mkDerivation rec { sha256 = "01ap9pr6zzzbp4ky0vy7i1983fwyqy27pl0ld55s30fdxka3ciih"; }; + # Do not install the en_US dictionary. + installPhase = '' + runHook preInstall + make install-libLTLIBRARIES + make install-binSCRIPTS + make install-includeHEADERS + + # license + install -D -m644 COPYING "$out/share/licenses/${pname}/LICENSE" + runHook postInstall + ''; + meta = with lib; { description = "Text hyphenation library"; mainProgram = "substrings.pl"; diff --git a/pkgs/development/libraries/hyphen/dictionaries.nix b/pkgs/development/libraries/hyphen/dictionaries.nix new file mode 100644 index 000000000000..2273c8056c8f --- /dev/null +++ b/pkgs/development/libraries/hyphen/dictionaries.nix @@ -0,0 +1,91 @@ +/* hyphen dictionaries */ + +{ hyphen, stdenv, lib, fetchgit, fetchurl }: + + +let + libreofficeRepository = "https://anongit.freedesktop.org/git/libreoffice/dictionaries.git"; + libreofficeCommit = "9e27d044d98e65f89af8c86df722a77be827bdc8"; + libreofficeSubdir = "de"; + + mkDictFromLibreofficeGit = + { subdir, shortName, shortDescription, dictFileName, readmeFileName }: + stdenv.mkDerivation rec { + version = "24.8"; + pname = "hyphen-dict-${shortName}-libreoffice"; + src = fetchgit { + url = "https://anongit.freedesktop.org/git/libreoffice/dictionaries.git"; + rev = "a2bf59878dd76685803ec260e15d875746ad6e25"; + sha256 = "sha256-3CvjgNjsrm4obATK6LmtYob8i2ngTbwP6FB4HlJMPCE="; + }; + meta = with lib; { + description = "Hyphen dictionary for ${shortDescription} from LibreOffice"; + homepage = "https://wiki.documentfoundation.org/Development/Dictionaries"; + license = with licenses; [ mpl20 ]; + maintainers = with maintainers; [ theCapypara ]; + platforms = platforms.all; + }; + phases = [ "unpackPhase" "installPhase" ]; + installPhase = '' + runHook preInstall + cd $src/${subdir} + install -dm755 "$out/share/hyphen" + install -m644 "hyph_${dictFileName}.dic" "$out/share/hyphen" + # docs + install -dm755 "$out/share/doc/" + install -m644 "README_hyph_${readmeFileName}.txt" "$out/share/doc/${pname}.txt" + runHook postInstall + ''; + }; + +in +rec { + + /* ENGLISH */ + + en_US = en-us; + en-us = stdenv.mkDerivation rec { + nativeBuildInputs = hyphen.nativeBuildInputs; + version = hyphen.version; + pname = "hyphen-dict-en-us"; + src = hyphen.src; + meta = { + inherit (hyphen.meta) homepage platforms license mainatiners; + description = "Hyphen dictionary for English (United States)"; + }; + installPhase = '' + runHook preInstall + make install-hyphDATA + runHook postInstall + ''; + }; + + /* GERMAN */ + + de_DE = de-de; + de-de = mkDictFromLibreofficeGit { + subdir = "de"; + shortName = "de-de"; + shortDescription = "German (Germany)"; + dictFileName = "de_DE"; + readmeFileName = "de"; + }; + + de_AT = de-at; + de-at = mkDictFromLibreofficeGit { + subdir = "de"; + shortName = "de-at"; + shortDescription = "German (Austria)"; + dictFileName = "de_AT"; + readmeFileName = "de"; + }; + + de_CH = de-ch; + de-ch = mkDictFromLibreofficeGit { + subdir = "de"; + shortName = "de-ch"; + shortDescription = "German (Switzerland)"; + dictFileName = "de_CH"; + readmeFileName = "de"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index eaef47b21020..b94c5df400a2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8951,6 +8951,8 @@ with pkgs; hyphen = callPackage ../development/libraries/hyphen { }; + hyphenDicts = recurseIntoAttrs (callPackages ../development/libraries/hyphen/dictionaries.nix {}); + i2c-tools = callPackage ../os-specific/linux/i2c-tools { }; i2pd = callPackage ../tools/networking/i2pd { }; From 4205c0642c8879bc6f21fd44c277e446c9e2c5fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20=22Capypara=22=20K=C3=B6pcke?= Date: Sun, 7 Jul 2024 17:49:18 +0200 Subject: [PATCH 3/5] hyphen: remove trailing whitespace --- pkgs/development/libraries/hyphen/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/hyphen/default.nix b/pkgs/development/libraries/hyphen/default.nix index 23e31e41a8c1..85bee97a76d5 100644 --- a/pkgs/development/libraries/hyphen/default.nix +++ b/pkgs/development/libraries/hyphen/default.nix @@ -23,7 +23,7 @@ in stdenv.mkDerivation rec { make install-libLTLIBRARIES make install-binSCRIPTS make install-includeHEADERS - + # license install -D -m644 COPYING "$out/share/licenses/${pname}/LICENSE" runHook postInstall From 3d6cb1a5b03b714a8a45241a636ce470312142c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20K=C3=B6pcke?= Date: Mon, 8 Jul 2024 14:57:32 +0200 Subject: [PATCH 4/5] maintainers: add theCapypara --- maintainers/maintainer-list.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 1e3ee0931840..245521bd561e 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -19913,6 +19913,14 @@ githubId = 34945377; name = "John Smith"; }; + theCapypara = { + name = "Marco Köpcke"; + email = "hello@capypara.de"; + matrix = "@capypara:matrix.org"; + github = "theCapypara"; + githubId = 3512122; + keys = [ { fingerprint = "5F29 132D EFA8 5DA0 B598 5BF2 5941 754C 1CDE 33BB"; } ]; + }; thedavidmeister = { email = "thedavidmeister@gmail.com"; github = "thedavidmeister"; From f06856ecfcdb149c968d0c0fcb72c2b344b45356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20K=C3=B6pcke?= Date: Tue, 9 Jul 2024 09:14:51 +0200 Subject: [PATCH 5/5] hyphenDicts: fix typo --- pkgs/development/libraries/hyphen/dictionaries.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/hyphen/dictionaries.nix b/pkgs/development/libraries/hyphen/dictionaries.nix index 2273c8056c8f..39569441bdec 100644 --- a/pkgs/development/libraries/hyphen/dictionaries.nix +++ b/pkgs/development/libraries/hyphen/dictionaries.nix @@ -50,7 +50,7 @@ rec { pname = "hyphen-dict-en-us"; src = hyphen.src; meta = { - inherit (hyphen.meta) homepage platforms license mainatiners; + inherit (hyphen.meta) homepage platforms license maintainers; description = "Hyphen dictionary for English (United States)"; }; installPhase = ''