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