Add ngrams support to LanguageTool, add git pull alias
This commit is contained in:
parent
ab288d9aee
commit
7452a7b13e
|
@ -237,11 +237,11 @@
|
|||
"nix-secrets": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1718230752,
|
||||
"narHash": "sha256-QL6bfApKuWoJiGve7vxE+PvYTDI+zTN7fxXJ+6XmPjI=",
|
||||
"lastModified": 1718817342,
|
||||
"narHash": "sha256-/NIAbcvPoYs7Hazhcwon6XoArxTY5v8ejJkWjOu2NmA=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "0d1a7e5130a5365964111ad58a2e58e63214d2b2",
|
||||
"revCount": 43,
|
||||
"rev": "ae4795463d47ca89021c059e11dab284a6e1d607",
|
||||
"revCount": 44,
|
||||
"type": "git",
|
||||
"url": "file:./nix-secrets"
|
||||
},
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
# Replace Nix with Lix: https://lix.systems/
|
||||
lix = {
|
||||
url = "git+https://git@git.lix.systems/lix-project/lix?ref=refs/tags/2.90-beta.1";
|
||||
#url = "git+https://git@git.lix.systems/lix-project/lix?ref=release-2.90";
|
||||
flake = false;
|
||||
};
|
||||
lix-module = {
|
||||
|
@ -68,7 +69,7 @@
|
|||
defaultModules = [
|
||||
{
|
||||
_module.args = {
|
||||
inherit inputs self;
|
||||
inherit inputs;
|
||||
};
|
||||
}
|
||||
./modules/autoimport.nix
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
let
|
||||
start-haven = pkgs.writeShellScriptBin "start-haven" (builtins.readFile ./start-haven.sh);
|
||||
|
||||
services-root = "/storage/services";
|
||||
|
||||
subdomains = [
|
||||
config.secrets.services.airsonic.url
|
||||
config.secrets.services.cache.url
|
||||
|
@ -40,6 +42,18 @@ in
|
|||
''}";
|
||||
};
|
||||
};
|
||||
"${config.secrets.networking.blogDomain}" = {
|
||||
dnsProvider = "namecheap";
|
||||
webroot = null; # Required in order to prevent a failed assertion
|
||||
credentialFiles = {
|
||||
"NAMECHEAP_API_USER_FILE" = "${pkgs.writeText "namecheap-api-user" ''
|
||||
${config.secrets.networking.namecheap.api.user}
|
||||
''}";
|
||||
"NAMECHEAP_API_KEY_FILE" = "${pkgs.writeText "namecheap-api-key" ''
|
||||
${config.secrets.networking.namecheap.api.key}
|
||||
''}";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
apcupsd = {
|
||||
|
@ -48,13 +62,13 @@ in
|
|||
};
|
||||
airsonic = {
|
||||
enable = true;
|
||||
home = "/storage/services/airsonic-advanced";
|
||||
home = "${services-root}/airsonic-advanced";
|
||||
};
|
||||
autoUpgrade.pushUpdates = true;
|
||||
boinc.enable = true;
|
||||
cache = {
|
||||
enable = false; # Disable for now
|
||||
secretKeyFile = "/storage/services/nix-cache/cache-priv-key.pem";
|
||||
secretKeyFile = "${services-root}/nix-cache/cache-priv-key.pem";
|
||||
};
|
||||
duplicacy-web = {
|
||||
enable = true;
|
||||
|
@ -63,7 +77,7 @@ in
|
|||
};
|
||||
forgejo = {
|
||||
enable = true;
|
||||
home = "/storage/services/forgejo";
|
||||
home = "${services-root}/forgejo";
|
||||
actions = {
|
||||
enable = true;
|
||||
token = config.secrets.services.forgejo.runner-token;
|
||||
|
@ -82,6 +96,13 @@ in
|
|||
return = "301 https://${config.secrets.services.forgejo.url}";
|
||||
};
|
||||
};
|
||||
"${config.secrets.networking.blogDomain}" = {
|
||||
useACMEHost = config.secrets.networking.blogDomain;
|
||||
forceSSL = true;
|
||||
locations."/" = {
|
||||
root = "${services-root}/nginx/sites/${config.secrets.networking.blogDomain}";
|
||||
};
|
||||
};
|
||||
"${config.secrets.services.gremlin-lab.url}" = {
|
||||
useACMEHost = config.secrets.networking.primaryDomain;
|
||||
forceSSL = true;
|
||||
|
|
|
@ -13,7 +13,10 @@
|
|||
office.enable = true;
|
||||
recording.enable = true;
|
||||
social.enable = true;
|
||||
writing.enable = true;
|
||||
writing = {
|
||||
enable = true;
|
||||
ngrams.enable = false;
|
||||
};
|
||||
};
|
||||
ui = {
|
||||
flatpak.enable = true;
|
||||
|
@ -37,8 +40,8 @@
|
|||
# Enable thermal control
|
||||
services.thermald.enable = true;
|
||||
|
||||
# Limit the number of cores Nix can use so at least one is always free
|
||||
nix.settings.cores = 11;
|
||||
# Limit the number of cores Nix can use
|
||||
nix.settings.cores = 10;
|
||||
|
||||
# Configure the virtual machine created by nixos-rebuild build-vm
|
||||
virtualisation.vmVariant.virtualisation = {
|
||||
|
|
|
@ -38,7 +38,10 @@ in
|
|||
office.enable = true;
|
||||
recording.enable = true;
|
||||
social.enable = true;
|
||||
writing.enable = true;
|
||||
writing = {
|
||||
enable = true;
|
||||
ngrams.enable = true;
|
||||
};
|
||||
};
|
||||
ui = {
|
||||
flatpak.enable = true;
|
||||
|
|
|
@ -8,13 +8,17 @@
|
|||
let
|
||||
cfg = config.host.apps.writing;
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
options = {
|
||||
host.apps.writing.enable = mkEnableOption (mdDoc "Enables writing and editing tools");
|
||||
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)."
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Install packages for building ebooks
|
||||
environment.systemPackages = with pkgs; [
|
||||
haskellPackages.pandoc
|
||||
|
@ -29,6 +33,10 @@ with lib;
|
|||
port = 8090;
|
||||
public = false;
|
||||
allowOrigin = "*";
|
||||
# Enable Ngrams
|
||||
settings.languageModel = lib.mkIf cfg.ngrams.enable "${
|
||||
(pkgs.callPackage ../../packages/languagetool-ngrams.nix { inherit pkgs lib; })
|
||||
}/ngrams";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -85,6 +85,7 @@ with lib;
|
|||
userEmail = config.secrets.users.aires.email;
|
||||
extraConfig = {
|
||||
push.autoSetupRemote = "true";
|
||||
aliases.pull = "!git pull && git submodule foreach --recursive 'git pull origin main'";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 0d1a7e5130a5365964111ad58a2e58e63214d2b2
|
||||
Subproject commit ae4795463d47ca89021c059e11dab284a6e1d607
|
28
packages/languagetool-ngrams.nix
Normal file
28
packages/languagetool-ngrams.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{ pkgs, lib }:
|
||||
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
pname = "languagetool-ngrams";
|
||||
version = "20150817";
|
||||
language = "en";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "https://languagetool.org/download/ngram-data/ngrams-${language}-${version}.zip";
|
||||
sha256 = "10e548731d9f58189fc36a553f7f685703be30da0d9bb42d1f7b5bf5f8bb232c";
|
||||
};
|
||||
|
||||
doCheck = false;
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
installPhase = ''
|
||||
install -D $src $out/ngrams
|
||||
chmod a+x $out/ngrams
|
||||
'';
|
||||
|
||||
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