Watch
0
0
Fork
You've already forked hyperhive
0
hyperhive/nix/packages/vale-styles.nix

40 lines
1.1 KiB
Nix

{
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)}
''