Make languageserver service configurable

Do not hard code all values, instead configure them within home.nix.

This is more for learning purposes.
But port and allow might also be changed more frequently in general.
This commit is contained in:
Daniel Siepmann 2022-02-02 20:38:24 +01:00
parent 5b74f60eaf
commit a02f8c3341
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
2 changed files with 6 additions and 4 deletions

View file

@ -47,6 +47,10 @@
services.dunst = import ./home/configurations/dunst.nix;
systemd.user.services.languagetool = import ./home/services/languagetool.nix {
settings = {
port = "8081";
allow-origin = "*";
};
inherit pkgs;
};
}

View file

@ -1,4 +1,4 @@
{ pkgs }:
{ pkgs, settings }:
{
Unit = {
@ -10,10 +10,8 @@
Service = {
Restart = "on-failure";
RestartSec = "2s";
# TODO: Make memory optional and configurable
Environment = "JAVA_TOOL_OPTIONS=-Xmx256m";
# TODO: Make port and allow optional and configurable
ExecStart = "${pkgs.languagetool}/bin/languagetool-http-server --port 8081 --allow-origin \"*\"";
ExecStart = "${pkgs.languagetool}/bin/languagetool-http-server --port ${settings.port} --allow-origin ${settings.allow-origin}";
};
Install = {