fetch vale styles in nix, pinned, and drop vale sync
This commit is contained in:
parent
1971c6773a
commit
9ed7ebab91
1 changed files with 90 additions and 20 deletions
40
nix/packages/vale-styles.nix
Normal file
40
nix/packages/vale-styles.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
lib,
|
||||
fetchzip,
|
||||
runCommand,
|
||||
}:
|
||||
|
||||
# The Vale style packages named in `.vale.ini`, fetched at build time and
|
||||
# laid out as Vale expects a `StylesPath`: `<out>/<Package>/<rule>.yml`.
|
||||
# Each is the release asset `vale sync` would download, pinned to a tag and
|
||||
# hash so a lint run makes no network request and every caller sees the
|
||||
# same rules. Bumping a style means changing its `tag` and `hash` here.
|
||||
let
|
||||
styles = {
|
||||
Microsoft = {
|
||||
tag = "v0.15.1";
|
||||
hash = "sha256-NqH69LL8aKMqyoo5qWi/hFAkYA4WL7OCfTpPwR907vU=";
|
||||
};
|
||||
alex = {
|
||||
tag = "v0.2.3";
|
||||
hash = "sha256-YvNfhjCg437wDMxnOqu9xTKq82KZfQt9HvCpoDfwsL4=";
|
||||
};
|
||||
write-good = {
|
||||
tag = "v0.4.1";
|
||||
hash = "sha256-XhvZtirGg9Vl/i73HMyZpK2iSoQoXv8OS7ckryveIdU=";
|
||||
};
|
||||
};
|
||||
|
||||
fetch =
|
||||
name:
|
||||
{ tag, hash }:
|
||||
fetchzip {
|
||||
url = "https://github.com/vale-cli/${name}/releases/download/${tag}/${name}.zip";
|
||||
inherit hash;
|
||||
stripRoot = false;
|
||||
};
|
||||
in
|
||||
runCommand "vale-styles" { } ''
|
||||
mkdir -p $out
|
||||
${lib.concatStrings (lib.mapAttrsToList (name: s: "ln -s ${fetch name s} $out/${name}\n") styles)}
|
||||
''
|
||||
Loading…
Reference in a new issue