depot/third_party/nixpkgs/pkgs/tools/text/vale/default.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

58 lines
1.4 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, makeBinaryWrapper
, runCommand
, symlinkJoin
, vale
, valeStyles
}:
buildGoModule rec {
pname = "vale";
version = "3.6.0";
subPackages = [ "cmd/vale" ];
src = fetchFromGitHub {
owner = "errata-ai";
repo = "vale";
rev = "v${version}";
hash = "sha256-Xkea1o0ywRKIg0cMJuxQehHbgVF0SSC9VRa53FQEong=";
};
vendorHash = "sha256-OLlViQKLTark9yknnjJFiEThFtxNNjue5LUp1P/anKU=";
ldflags = [ "-s" "-w" "-X main.version=${version}" ];
# Tests require network access
doCheck = false;
passthru.withStyles = selector: symlinkJoin {
name = "vale-with-styles-${vale.version}";
paths = [ vale ] ++ selector valeStyles;
nativeBuildInputs = [ makeBinaryWrapper ];
postBuild = ''
wrapProgram "$out/bin/vale" \
--set VALE_STYLES_PATH "$out/share/vale/styles/"
'';
meta = {
inherit (vale.meta) mainProgram;
};
};
meta = with lib; {
description = "Syntax-aware linter for prose built with speed and extensibility in mind";
longDescription = ''
Vale in Nixpkgs offers the helper `.withStyles` allow you to install it
predefined styles:
vale.withStyles (s: [ s.alex s.google ])
'';
homepage = "https://vale.sh/";
changelog = "https://github.com/errata-ai/vale/releases/tag/v${version}";
mainProgram = "vale";
license = licenses.mit;
maintainers = [ maintainers.pbsds ];
};
}