Unverified Commit ddbd789f authored by 7c6f434c's avatar 7c6f434c Committed by GitHub
Browse files

Merge pull request #325290 from theCapypara/fix-hyphen-libreoffice

libreoffice, hyphen: Load hyphen dicts in LibreOffice, modularize hyphen dicts, add german hyphen dict
parents 12a3f8bb f06856ec
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -19952,6 +19952,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";
+7 −3
Original line number Diff line number Diff line
@@ -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
    '')
+12 −0
Original line number Diff line number Diff line
@@ -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";
+91 −0
Original line number Diff line number Diff line
/* 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 maintainers;
      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";
  };
}
+2 −0
Original line number Diff line number Diff line
@@ -8953,6 +8953,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 { };