2024-05-07 18:02:59 -04:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
2024-05-01 21:10:26 -04:00
|
|
|
|
|
|
|
let
|
2024-05-07 18:02:59 -04:00
|
|
|
cfg = config.host.apps.writing;
|
2024-05-01 21:10:26 -04:00
|
|
|
in
|
|
|
|
{
|
2024-05-07 18:02:59 -04:00
|
|
|
options = {
|
2024-06-19 14:00:17 -04:00
|
|
|
host.apps.writing = {
|
|
|
|
enable = lib.mkEnableOption (lib.mdDoc "Enables writing and editing tools");
|
2024-06-22 13:20:08 -04:00
|
|
|
languagetool = {
|
|
|
|
enable = lib.mkEnableOption (lib.mdDoc "Enables local Language Tool server.");
|
|
|
|
# WARNING: Ngrams package requires an excessive amount of memory. Troubleshoot before re-enabling
|
|
|
|
ngrams.enable = lib.mkEnableOption (
|
|
|
|
lib.mdDoc "Enables ngrams for improved grammar detection (warning: results in an 8GB+ download)."
|
|
|
|
);
|
|
|
|
};
|
2024-06-19 14:00:17 -04:00
|
|
|
};
|
2024-05-07 18:02:59 -04:00
|
|
|
};
|
2024-05-01 21:10:26 -04:00
|
|
|
|
2024-06-19 14:00:17 -04:00
|
|
|
config = lib.mkIf cfg.enable {
|
2024-05-07 18:02:59 -04:00
|
|
|
# Install packages for building ebooks
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
haskellPackages.pandoc
|
|
|
|
haskellPackages.pandoc-cli
|
|
|
|
haskellPackages.pandoc-crossref
|
|
|
|
texliveSmall
|
|
|
|
];
|
2024-05-01 21:10:26 -04:00
|
|
|
|
2024-05-07 18:02:59 -04:00
|
|
|
# Spelling and grammer checking: hosted on localhost:8081
|
2024-06-22 13:20:08 -04:00
|
|
|
services.languagetool = lib.mkIf cfg.languagetool.enable {
|
2024-05-07 18:02:59 -04:00
|
|
|
enable = true;
|
|
|
|
port = 8090;
|
|
|
|
public = false;
|
|
|
|
allowOrigin = "*";
|
2024-06-19 14:00:17 -04:00
|
|
|
# Enable Ngrams
|
2024-06-22 13:20:08 -04:00
|
|
|
settings.languageModel = lib.mkIf cfg.languagetool.ngrams.enable "${
|
2024-06-19 14:00:17 -04:00
|
|
|
(pkgs.callPackage ../../packages/languagetool-ngrams.nix { inherit pkgs lib; })
|
|
|
|
}/ngrams";
|
2024-05-07 18:02:59 -04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|