Apps: re-enable LanguageTool
This commit is contained in:
parent
9e37678202
commit
95d2282ceb
|
@ -25,7 +25,13 @@ in
|
||||||
office.enable = true;
|
office.enable = true;
|
||||||
recording.enable = true;
|
recording.enable = true;
|
||||||
social.enable = true;
|
social.enable = true;
|
||||||
writing.enable = true;
|
writing = {
|
||||||
|
enable = true;
|
||||||
|
languagetool = {
|
||||||
|
enable = true;
|
||||||
|
ngrams.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Enable Secure Boot support.
|
# Enable Secure Boot support.
|
||||||
|
|
|
@ -10,7 +10,17 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
aux.system.apps.writing.enable = lib.mkEnableOption "Enables writing and editing tools";
|
aux.system.apps.writing = {
|
||||||
|
enable = lib.mkEnableOption "Enables writing and editing tools";
|
||||||
|
|
||||||
|
languagetool = {
|
||||||
|
enable = lib.mkEnableOption (lib.mdDoc "Enables local Language Tool server.");
|
||||||
|
# WARNING: Ngrams package requires a lot of RAM
|
||||||
|
ngrams.enable = lib.mkEnableOption (
|
||||||
|
lib.mdDoc "Enables ngrams for improved grammar detection (warning: results in an 8GB+ download)."
|
||||||
|
);
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
@ -21,5 +31,17 @@ in
|
||||||
haskellPackages.pandoc-crossref
|
haskellPackages.pandoc-crossref
|
||||||
texliveSmall
|
texliveSmall
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Spelling and grammer checking: hosted on localhost:8081
|
||||||
|
services.languagetool = lib.mkIf cfg.languagetool.enable {
|
||||||
|
enable = true;
|
||||||
|
port = 8090;
|
||||||
|
public = false;
|
||||||
|
allowOrigin = "*";
|
||||||
|
# Enable Ngrams
|
||||||
|
settings.languageModel = lib.mkIf cfg.languagetool.ngrams.enable "${
|
||||||
|
(pkgs.callPackage ../../packages/languagetool-ngrams.nix { inherit pkgs lib; })
|
||||||
|
}/ngrams";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ in
|
||||||
theme = "gentoo";
|
theme = "gentoo";
|
||||||
};
|
};
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
nos = lib.mkIf config.aux.system.nixos-upgrade-script.enable "nixos-upgrade-script";
|
nos = "nixos-upgrade-script";
|
||||||
z = "zellij";
|
z = "zellij";
|
||||||
update = "upgrade";
|
update = "upgrade";
|
||||||
upgrade = "nh os boot --update --ask";
|
upgrade = "nh os boot --update --ask";
|
||||||
|
|
33
packages/languagetool-ngrams.nix
Normal file
33
packages/languagetool-ngrams.nix
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# For a packaging example, see https://github.com/Janik-Haag/nix-languagetool-ngram/blob/main/ngram-template.nix
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
fetchzip,
|
||||||
|
}:
|
||||||
|
|
||||||
|
pkgs.stdenv.mkDerivation rec {
|
||||||
|
pname = "languagetool-ngram-en";
|
||||||
|
version = "20150817";
|
||||||
|
language = "en";
|
||||||
|
|
||||||
|
src = fetchzip {
|
||||||
|
url = "https://languagetool.org/download/ngram-data/ngrams-${language}-${version}.zip";
|
||||||
|
sha256 = "v3Ym6CBJftQCY5FuY6s5ziFvHKAyYD3fTHr99i6N8sE=";
|
||||||
|
};
|
||||||
|
|
||||||
|
dontBuild = true;
|
||||||
|
dontConfigure = true;
|
||||||
|
dontFixup = true;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/share/languagetool/ngrams
|
||||||
|
ln -s $src $out/share/languagetool/ngrams/${language}
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
homepage = "https://dev.languagetool.org/finding-errors-using-n-gram-data.html";
|
||||||
|
description = "LanguageTool can make use of large n-gram data sets to detect errors with words that are often confused, like their and there.";
|
||||||
|
platforms = platforms.linux;
|
||||||
|
license = licenses.cc-by-sa-40;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue