30 lines
899 B
Nix
30 lines
899 B
Nix
{
|
|
lib,
|
|
vale,
|
|
runCommand,
|
|
makeWrapper,
|
|
callPackage,
|
|
}:
|
|
|
|
# `vale` with the repo's `.vale.ini` and the pinned styles from
|
|
# ./vale-styles.nix baked in, so `vale docs` works from the repo root without
|
|
# any setup step. CI, the devshell and local runs all
|
|
# take this one binary. `.vale.ini` carries no `StylesPath`; the wrapper's
|
|
# generated config prepends the store path to the file's contents.
|
|
let
|
|
styles = callPackage ./vale-styles.nix { };
|
|
config = runCommand "vale.ini" { } ''
|
|
{ echo "StylesPath = ${styles}"; cat ${../../.vale.ini}; } > $out
|
|
'';
|
|
in
|
|
runCommand "vale-${vale.version}-hyperhive"
|
|
{
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
meta = {
|
|
description = "vale preconfigured with the repo's .vale.ini and pinned style packages";
|
|
mainProgram = "vale";
|
|
};
|
|
}
|
|
''
|
|
makeWrapper ${lib.getExe vale} $out/bin/vale --add-flags "--config ${config}"
|
|
''
|