From d02e21ce1546b037c7cbd9e942090ac6c6f6bc41 Mon Sep 17 00:00:00 2001 From: Andre Date: Sat, 22 Jun 2024 13:20:08 -0400 Subject: [PATCH] Break out Language Tool options, disable on Khanda to save RAM --- flake.lock | 14 +++++++------- hosts/Khanda/default.nix | 2 +- modules/apps/writing.nix | 15 +++++++++------ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/flake.lock b/flake.lock index 3f0e41e..c423bed 100644 --- a/flake.lock +++ b/flake.lock @@ -138,11 +138,11 @@ ] }, "locked": { - "lastModified": 1718788307, - "narHash": "sha256-SqiOz0sljM0GjyQEVinPXQxaGcbOXw5OgpCWGPgh/vo=", + "lastModified": 1719037157, + "narHash": "sha256-aOKd8+mhBsLQChCu1mn/W5ww79ta5cXVE59aJFrifM8=", "owner": "nix-community", "repo": "home-manager", - "rev": "d7830d05421d0ced83a0f007900898bdcaf2a2ca", + "rev": "cd886711998fe5d9ff7979fdd4b4cbd17b1f1511", "type": "github" }, "original": { @@ -252,11 +252,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1718894893, - "narHash": "sha256-hxQBUtDbFOCCW1CsFZTS9Q5Ov1ZKdJgbBZHSez1M6iA=", + "lastModified": 1719069430, + "narHash": "sha256-d9KzCJv3UG6nX9Aur5OSEf4Uj+ywuxojhiCiRKYVzXA=", "ref": "master", - "rev": "083823b7904e43a4fc1c7229781417e875359a42", - "revCount": 1733, + "rev": "e8232c132a95ddc62df9d404120ad4ff53862910", + "revCount": 1741, "type": "git", "url": "https://github.com/NixOS/nixos-hardware" }, diff --git a/hosts/Khanda/default.nix b/hosts/Khanda/default.nix index 43aa545..b42b261 100644 --- a/hosts/Khanda/default.nix +++ b/hosts/Khanda/default.nix @@ -15,7 +15,7 @@ social.enable = true; writing = { enable = true; - ngrams.enable = false; + languagetool.enable = false; }; }; ui = { diff --git a/modules/apps/writing.nix b/modules/apps/writing.nix index 1451ee0..d014295 100644 --- a/modules/apps/writing.nix +++ b/modules/apps/writing.nix @@ -12,10 +12,13 @@ in options = { host.apps.writing = { enable = lib.mkEnableOption (lib.mdDoc "Enables writing and editing tools"); - # 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)." - ); + 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)." + ); + }; }; }; @@ -29,13 +32,13 @@ in ]; # Spelling and grammer checking: hosted on localhost:8081 - services.languagetool = { + services.languagetool = lib.mkIf cfg.languagetool.enable { enable = true; port = 8090; public = false; allowOrigin = "*"; # Enable Ngrams - settings.languageModel = lib.mkIf cfg.ngrams.enable "${ + settings.languageModel = lib.mkIf cfg.languagetool.ngrams.enable "${ (pkgs.callPackage ../../packages/languagetool-ngrams.nix { inherit pkgs lib; }) }/ngrams"; };