1
0
Fork 0

Tidy Vale configuration

This commit is contained in:
Ethan Reece 2025-07-14 00:37:48 -05:00
parent ba4b6882cf
commit fd987fc50a
Signed by: me
GPG key ID: DD8CE04D5D8FF832
3 changed files with 41 additions and 28 deletions

1
.gitignore vendored
View file

@ -1,4 +1,3 @@
.direnv
.helix
.pre-commit-config.yaml
.vale/.vale.ini

View file

@ -43,8 +43,8 @@ in
helix = {
languages = {
name = "languages.toml";
content = config.helix.languages;
path = tomlFormatter.generate "languages.toml" helix.languages.content;
text = config.helix.languages;
path = tomlFormatter.generate "languages.toml" helix.languages.text;
};
directory = {
name = ".helix";

View file

@ -16,21 +16,32 @@ in
let
tomlFormatter = pkgs.formats.toml { };
vale = {
valeDirectory = ".vale";
stylesDirectory = "styles";
dictionary = {
directory = "config/vocabularies/General";
filename = "accept.txt";
content = builtins.concatStringsSep "\n" dictionary;
file = pkgs.writeTextFile {
name = vale.dictionary.filename;
text = vale.dictionary.content;
styles = {
directory = {
name = "styles";
base = .vale/styles;
};
dictionary = {
directory = {
name = "config/vocabularies/General";
};
name = "accept.txt";
text = builtins.concatStringsSep "\n" dictionary;
path = pkgs.writeTextFile {
name = vale.styles.dictionary.name;
text = vale.styles.dictionary.text;
};
};
path = pkgs.runCommand vale.styles.directory.name { } ''
${pkgs.uutils-coreutils-noprefix}/bin/mkdir -p $out/${vale.styles.dictionary.directory.name}
${pkgs.uutils-coreutils-noprefix}/bin/cp -r ${vale.styles.directory.base}/* $out
${pkgs.uutils-coreutils-noprefix}/bin/ln -fs ${vale.styles.dictionary.path} $out/${vale.styles.dictionary.directory.name}/${vale.styles.dictionary.name}
'';
};
config = {
filename = ".vale.ini";
content = ''
StylesPath = styles
name = ".vale.ini";
text = ''
StylesPath = ${vale.styles.directory.name}
MinAlertLevel = suggestion
@ -42,20 +53,23 @@ in
[*.{md}]
BasedOnStyles = Vale, RedHat, proselint, write-good, alex
'';
file = pkgs.writeTextFile {
name = vale.config.filename;
text = vale.config.content;
path = pkgs.writeTextFile {
name = vale.config.name;
text = vale.config.text;
};
};
directory = {
base = .vale/styles;
full = pkgs.runCommand vale.valeDirectory { } ''
${pkgs.uutils-coreutils-noprefix}/bin/mkdir -p $out/${vale.stylesDirectory}/${vale.dictionary.directory}
${pkgs.uutils-coreutils-noprefix}/bin/cp -r ${vale.directory.base}/* $out/${vale.stylesDirectory}
${pkgs.uutils-coreutils-noprefix}/bin/ln -fs ${vale.dictionary.file} $out/${vale.stylesDirectory}/${vale.dictionary.directory}/${vale.dictionary.filename}
${pkgs.uutils-coreutils-noprefix}/bin/ln -fs ${vale.config.file} $out/${vale.config.filename};
'';
configFile = "${vale.directory.full}/${vale.config.filename}";
name = ".vale";
path = pkgs.linkFarm vale.directory.name [
{
name = vale.config.name;
path = vale.config.path;
}
{
name = vale.styles.directory.name;
path = vale.styles.path;
}
];
};
};
typos = {
@ -84,7 +98,7 @@ in
# https://vale.sh/docs/formats/code
vale-ls = {
command = "${pkgs.vale-ls}/bin/vale-ls";
config.configPath = vale.directory.configFile;
config.configPath = "${vale.directory.path}/${vale.config.name}";
};
# https://writewithharper.com/docs/integrations/language-server#Supported-Languages
harper-ls.command = "${pkgs.harper}/bin/harper-ls";
@ -104,7 +118,7 @@ in
};
vale = {
enable = true;
settings.configPath = vale.directory.configFile;
settings.configPath = "${vale.directory.path}/${vale.config.name}";
};
};
excludes = [ "base/languages/en-us/.vale" ];