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 .direnv
.helix .helix
.pre-commit-config.yaml .pre-commit-config.yaml
.vale/.vale.ini

View file

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

View file

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