1
0
Fork 0
nix-homemanager-laptop/languages/en-us.nix

73 lines
1.9 KiB
Nix

{ pkgs, treefmt }:
let
dictionary = [
"Asahi"
"LLMs"
"LTeX"
"NixOS"
];
tomlFormatter = pkgs.formats.toml { };
valeDictionary = {
directory = "./.vale/styles/config/vocabularies/General";
filename = "accept.txt";
content = builtins.concatStringsSep "\n" dictionary;
file = builtins.toFile valeDictionary.filename valeDictionary.content;
};
typosConfig = {
default.extendWords = builtins.listToAttrs (
builtins.map (x: {
name = x;
value = x;
}) dictionary
);
};
typosConfigFile = tomlFormatter.generate "_typos.toml" typosConfig;
in
{
helix.language-server = {
# https://ltex-plus.github.io/ltex-plus/supported-languages.html
ltex-ls-plus = {
command = "${pkgs.ltex-ls-plus}/bin/ltex-ls-plus";
config.ltex.dictionary.en-US = dictionary;
};
# https://vale.sh/docs/formats/code
vale-ls.command = "${pkgs.vale-ls}/bin/vale-ls";
# https://writewithharper.com/docs/integrations/language-server#Supported-Languages
harper-ls.command = "${pkgs.harper}/bin/harper-ls";
};
pre-commit = {
typos = {
enable = true;
settings = {
configPath = typosConfigFile.outPath;
locale = "en-us";
};
excludes = [
".vale/*"
"home/vencord.nix"
];
};
vale.enable = true;
};
treefmt.programs.typos = {
enable = true;
configFile = typosConfigFile.outPath;
locale = "en-us";
};
devshell = {
commands = [
{
help = "sync vale configuration";
name = "vale-sync";
command = "${pkgs.vale}/bin/vale sync";
}
];
packages = [ pkgs.vale ];
devshellStartup = {
vale_config.text = ''
mkdir -p ${valeDictionary.directory}
${pkgs.uutils-coreutils-noprefix}/bin/ln -fs ${valeDictionary.file} ${valeDictionary.directory}/${valeDictionary.filename}
'';
};
};
}