2024-04-21 15:54:59 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeBinaryWrapper
|
|
|
|
, runCommand
|
|
|
|
, symlinkJoin
|
|
|
|
, vale
|
|
|
|
, valeStyles
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
buildGoModule rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "vale";
|
2024-06-20 14:57:18 +00:00
|
|
|
version = "3.6.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
subPackages = [ "cmd/vale" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2021-10-17 02:12:59 +00:00
|
|
|
owner = "errata-ai";
|
|
|
|
repo = "vale";
|
|
|
|
rev = "v${version}";
|
2024-06-20 14:57:18 +00:00
|
|
|
hash = "sha256-Xkea1o0ywRKIg0cMJuxQehHbgVF0SSC9VRa53FQEong=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
vendorHash = "sha256-OLlViQKLTark9yknnjJFiEThFtxNNjue5LUp1P/anKU=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-27 14:25:00 +00:00
|
|
|
ldflags = [ "-s" "-w" "-X main.version=${version}" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
# Tests require network access
|
|
|
|
doCheck = false;
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
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/"
|
|
|
|
'';
|
2024-05-15 15:35:15 +00:00
|
|
|
meta = {
|
|
|
|
inherit (vale.meta) mainProgram;
|
|
|
|
};
|
2024-04-21 15:54:59 +00:00
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Syntax-aware linter for prose built with speed and extensibility in mind";
|
2024-04-21 15:54:59 +00:00
|
|
|
longDescription = ''
|
|
|
|
Vale in Nixpkgs offers the helper `.withStyles` allow you to install it
|
|
|
|
predefined styles:
|
|
|
|
|
|
|
|
vale.withStyles (s: [ s.alex s.google ])
|
|
|
|
'';
|
2023-08-04 22:07:22 +00:00
|
|
|
homepage = "https://vale.sh/";
|
|
|
|
changelog = "https://github.com/errata-ai/vale/releases/tag/v${version}";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "vale";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
2024-05-15 15:35:15 +00:00
|
|
|
maintainers = [ maintainers.pbsds ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|