1
0
Fork 0

Add ngrams support to LanguageTool, add git pull alias

This commit is contained in:
Aires 2024-06-19 14:00:17 -04:00
parent ab288d9aee
commit 7452a7b13e
9 changed files with 81 additions and 16 deletions

View file

@ -237,11 +237,11 @@
"nix-secrets": { "nix-secrets": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1718230752, "lastModified": 1718817342,
"narHash": "sha256-QL6bfApKuWoJiGve7vxE+PvYTDI+zTN7fxXJ+6XmPjI=", "narHash": "sha256-/NIAbcvPoYs7Hazhcwon6XoArxTY5v8ejJkWjOu2NmA=",
"ref": "refs/heads/main", "ref": "refs/heads/main",
"rev": "0d1a7e5130a5365964111ad58a2e58e63214d2b2", "rev": "ae4795463d47ca89021c059e11dab284a6e1d607",
"revCount": 43, "revCount": 44,
"type": "git", "type": "git",
"url": "file:./nix-secrets" "url": "file:./nix-secrets"
}, },

View file

@ -10,6 +10,7 @@
# Replace Nix with Lix: https://lix.systems/ # Replace Nix with Lix: https://lix.systems/
lix = { 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=refs/tags/2.90-beta.1";
#url = "git+https://git@git.lix.systems/lix-project/lix?ref=release-2.90";
flake = false; flake = false;
}; };
lix-module = { lix-module = {
@ -68,7 +69,7 @@
defaultModules = [ defaultModules = [
{ {
_module.args = { _module.args = {
inherit inputs self; inherit inputs;
}; };
} }
./modules/autoimport.nix ./modules/autoimport.nix

View file

@ -8,6 +8,8 @@
let let
start-haven = pkgs.writeShellScriptBin "start-haven" (builtins.readFile ./start-haven.sh); start-haven = pkgs.writeShellScriptBin "start-haven" (builtins.readFile ./start-haven.sh);
services-root = "/storage/services";
subdomains = [ subdomains = [
config.secrets.services.airsonic.url config.secrets.services.airsonic.url
config.secrets.services.cache.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 = { apcupsd = {
@ -48,13 +62,13 @@ in
}; };
airsonic = { airsonic = {
enable = true; enable = true;
home = "/storage/services/airsonic-advanced"; home = "${services-root}/airsonic-advanced";
}; };
autoUpgrade.pushUpdates = true; autoUpgrade.pushUpdates = true;
boinc.enable = true; boinc.enable = true;
cache = { cache = {
enable = false; # Disable for now 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 = { duplicacy-web = {
enable = true; enable = true;
@ -63,7 +77,7 @@ in
}; };
forgejo = { forgejo = {
enable = true; enable = true;
home = "/storage/services/forgejo"; home = "${services-root}/forgejo";
actions = { actions = {
enable = true; enable = true;
token = config.secrets.services.forgejo.runner-token; token = config.secrets.services.forgejo.runner-token;
@ -82,6 +96,13 @@ in
return = "301 https://${config.secrets.services.forgejo.url}"; 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}" = { "${config.secrets.services.gremlin-lab.url}" = {
useACMEHost = config.secrets.networking.primaryDomain; useACMEHost = config.secrets.networking.primaryDomain;
forceSSL = true; forceSSL = true;

View file

@ -13,7 +13,10 @@
office.enable = true; office.enable = true;
recording.enable = true; recording.enable = true;
social.enable = true; social.enable = true;
writing.enable = true; writing = {
enable = true;
ngrams.enable = false;
};
}; };
ui = { ui = {
flatpak.enable = true; flatpak.enable = true;
@ -37,8 +40,8 @@
# Enable thermal control # Enable thermal control
services.thermald.enable = true; services.thermald.enable = true;
# Limit the number of cores Nix can use so at least one is always free # Limit the number of cores Nix can use
nix.settings.cores = 11; nix.settings.cores = 10;
# Configure the virtual machine created by nixos-rebuild build-vm # Configure the virtual machine created by nixos-rebuild build-vm
virtualisation.vmVariant.virtualisation = { virtualisation.vmVariant.virtualisation = {

View file

@ -38,7 +38,10 @@ 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;
ngrams.enable = true;
};
}; };
ui = { ui = {
flatpak.enable = true; flatpak.enable = true;

View file

@ -8,13 +8,17 @@
let let
cfg = config.host.apps.writing; cfg = config.host.apps.writing;
in in
with lib;
{ {
options = { 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 # Install packages for building ebooks
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
haskellPackages.pandoc haskellPackages.pandoc
@ -29,6 +33,10 @@ with lib;
port = 8090; port = 8090;
public = false; public = false;
allowOrigin = "*"; allowOrigin = "*";
# Enable Ngrams
settings.languageModel = lib.mkIf cfg.ngrams.enable "${
(pkgs.callPackage ../../packages/languagetool-ngrams.nix { inherit pkgs lib; })
}/ngrams";
}; };
}; };
} }

View file

@ -85,6 +85,7 @@ with lib;
userEmail = config.secrets.users.aires.email; userEmail = config.secrets.users.aires.email;
extraConfig = { extraConfig = {
push.autoSetupRemote = "true"; push.autoSetupRemote = "true";
aliases.pull = "!git pull && git submodule foreach --recursive 'git pull origin main'";
}; };
}; };

@ -1 +1 @@
Subproject commit 0d1a7e5130a5365964111ad58a2e58e63214d2b2 Subproject commit ae4795463d47ca89021c059e11dab284a6e1d607

View 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;
};
}