1
0
Fork 0

Services: remove LanguageTool - can't get basic auth working with Obsidian

This commit is contained in:
Aires 2024-07-29 09:39:44 -04:00
parent b4f0dec8a1
commit 66915510d6
5 changed files with 6 additions and 111 deletions

View file

@ -234,10 +234,11 @@
"nix-secrets": { "nix-secrets": {
"flake": false, "flake": false,
"locked": { "locked": {
"dirtyRev": "39cb0b58584e4763879310c779f75e30dd0b778a-dirty", "lastModified": 1722259498,
"dirtyShortRev": "39cb0b5-dirty", "narHash": "sha256-85jL6CvmxPloZDL313Eezu8mcEeGM+YzonlYyshz3w0=",
"lastModified": 1722196383, "ref": "refs/heads/main",
"narHash": "sha256-C9bMw/TNfn1i7JTORFmHObLhCEFUO8djfApw2T663N4=", "rev": "108f2efee01541c9680a8ec38666609e4e3e56cc",
"revCount": 56,
"type": "git", "type": "git",
"url": "file:./nix-secrets" "url": "file:./nix-secrets"
}, },

View file

@ -181,13 +181,6 @@ in
token = config.secrets.services.forgejo.runner-token; token = config.secrets.services.forgejo.runner-token;
}; };
}; };
languagetool = {
enable = true;
ngrams.enable = true;
domain = config.secrets.networking.primaryDomain;
password = config.secrets.services.languagetool.password;
url = config.secrets.services.languagetool.url;
};
msmtp.enable = true; msmtp.enable = true;
nginx = { nginx = {
enable = true; enable = true;

View file

@ -1,66 +0,0 @@
{
pkgs,
config,
lib,
...
}:
let
cfg = config.aux.system.services.languagetool;
in
{
options = {
aux.system.services.languagetool = {
enable = lib.mkEnableOption (lib.mdDoc "Enables LanguageTool server.");
ngrams.enable = lib.mkEnableOption (
lib.mdDoc "Enables n-gram data set. See https://dev.languagetool.org/finding-errors-using-n-gram-data.html"
);
domain = lib.mkOption {
default = "";
type = lib.types.str;
description = "The root domain that LanguageTool will be hosted on.";
example = "example.com";
};
password = lib.mkOption {
default = "";
type = lib.types.str;
description = "The password to use for basic authentication for LanguageTool.";
example = "MySuperSecurePassword123";
};
url = lib.mkOption {
default = "";
type = lib.types.str;
description = "The complete URL where LanguageTool is hosted.";
example = "https://languagetool.example.com";
};
};
};
config = lib.mkIf cfg.enable {
services = {
languagetool = lib.mkIf cfg.enable {
enable = true;
port = 8090;
public = true;
allowOrigin = "*";
# Enable Ngrams
settings.languageModel = lib.mkIf cfg.ngrams.enable "${
(pkgs.callPackage ../../packages/languagetool-ngrams.nix { inherit pkgs lib; })
}/ngrams";
};
# Create Nginx virtualhost
nginx.virtualHosts."${cfg.url}" = {
useACMEHost = cfg.domain;
forceSSL = true;
basicAuth = {
ltuser = cfg.password;
};
locations."/" = {
proxyPass = "http://127.0.0.1:8090";
extraConfig = "proxy_ssl_server_name on;";
};
};
};
systemd.services.nginx.wants = [ config.systemd.services.languagetool.name ];
};
}

@ -1 +1 @@
Subproject commit 39cb0b58584e4763879310c779f75e30dd0b778a Subproject commit 108f2efee01541c9680a8ec38666609e4e3e56cc

View file

@ -1,33 +0,0 @@
{
pkgs,
lib,
fetchzip,
}:
pkgs.stdenv.mkDerivation rec {
pname = "languagetool-ngrams";
version = "20150817";
language = "en";
src = fetchzip {
url = "https://languagetool.org/download/ngram-data/ngrams-${language}-${version}.zip";
sha256 = "10e548731d9f58189fc36a553f7f685703be30da0d9bb42d1f7b5bf5f8bb232c";
};
doCheck = false;
installPhase = ''
runHook preInstall
mv -- * $out/
runHook postInstall
'';
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;
};
}