Skip to content

Commit

Permalink
Add Serbian hunspell dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
alapshin committed Dec 7, 2023
1 parent 0836212 commit af2f1eb
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
final.recurseIntoAttrs
(final.callPackage ./android-studio { });

customHunspellDicts = prev.recurseIntoAttrs (prev.callPackages ./hunspell/dictionaries.nix { });

keepassxc-autostart = prev.makeAutostartItem {
name = "KeePassXC";
package = prev.keepassxc;
Expand Down
76 changes: 76 additions & 0 deletions packages/hunspell/dictionaries.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{ lib
, stdenv
, fetchurl
, fetchzip
, fetchFromGitHub
, bash
, unzip
, coreutils
, which
, zip
, ispell
, perl
, python3
, hunspell
}:
let
mkDict =
{ pname, readmeFile, dictFileName, ... }@args:
stdenv.mkDerivation ({
inherit pname;
installPhase = ''
runHook preInstall
# hunspell dicts
install -dm755 "$out/share/hunspell"
install -m644 ${dictFileName}.dic "$out/share/hunspell/"
install -m644 ${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/"
# docs
install -dm755 "$out/share/doc"
install -m644 ${readmeFile} $out/share/doc/${pname}.txt
runHook postInstall
'';
} // args);
mkDictFromLibreOffice =
{ shortName
, shortDescription
, dictFileName
, license
, readmeFile ? "README_${dictFileName}.txt"
, sourceRoot ? dictFileName
}:
mkDict rec {
pname = "hunspell-dict-${shortName}-libreoffice";
version = "6.3.0.4";
inherit dictFileName readmeFile;
src = fetchFromGitHub {
owner = "LibreOffice";
repo = "dictionaries";
rev = "libreoffice-${version}";
sha256 = "14z4b0grn7cw8l9s7sl6cgapbpwhn1b3gwc3kn6b0k4zl3dq7y63";
};
buildPhase = ''
cp -a ${sourceRoot}/* .
'';
meta = with lib; {
homepage = "https://wiki.documentfoundation.org/Development/Dictionaries";
description = "Hunspell dictionary for ${shortDescription} from LibreOffice";
license = license;
maintainers = with maintainers; [ vlaci ];
platforms = platforms.all;
};
};
in
rec {
sr = mkDictFromLibreOffice {
shortName = "sr";
dictFileName = "sr";
shortDescription = "Serbian";
readmeFile = "README.txt";
license = with lib.licenses; [ gpl2 lgpl21 mpl11 ];
};
}

1 change: 1 addition & 0 deletions users/alapshin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ let
hunspell
hunspellDicts.en-us
hunspellDicts.ru-ru
customHunspellDicts.sr
];

guiDevTools = with pkgs; [
Expand Down

0 comments on commit af2f1eb

Please sign in to comment.