2024-09-27 12:49:41 +01:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildGoModule,
|
|
|
|
fetchFromGitHub,
|
|
|
|
makeBinaryWrapper,
|
|
|
|
symlinkJoin,
|
|
|
|
vale,
|
|
|
|
valeStyles,
|
2024-03-30 04:20:00 +00:00
|
|
|
}:
|
2018-03-10 22:28:02 +00:00
|
|
|
|
2020-02-26 01:23:38 +00:00
|
|
|
buildGoModule rec {
|
2019-08-20 13:54:18 +01:00
|
|
|
pname = "vale";
|
2024-11-08 09:10:46 +00:00
|
|
|
version = "3.9.0";
|
2018-03-10 22:28:02 +00:00
|
|
|
|
2021-01-20 04:20:00 +00:00
|
|
|
subPackages = [ "cmd/vale" ];
|
2019-02-24 01:25:21 +00:00
|
|
|
|
2018-03-10 22:28:02 +00:00
|
|
|
src = fetchFromGitHub {
|
2021-10-16 07:56:04 +01:00
|
|
|
owner = "errata-ai";
|
|
|
|
repo = "vale";
|
|
|
|
rev = "v${version}";
|
2024-11-08 09:10:46 +00:00
|
|
|
hash = "sha256-4zDngF2K6Fsn/Ml4rhHQxDXOD7meXePoqZ9+XPrHO0g=";
|
2018-03-10 22:28:02 +00:00
|
|
|
};
|
|
|
|
|
2024-10-22 17:12:12 +01:00
|
|
|
vendorHash = "sha256-EWAgzb3ruxYqaP+owcyGDzNnkPDYp0ttHwCgNXuuTbk=";
|
2020-02-26 01:23:38 +00:00
|
|
|
|
2024-09-27 12:49:41 +01:00
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-X main.version=${version}"
|
|
|
|
];
|
2020-02-18 23:00:00 +00:00
|
|
|
|
2022-10-06 05:20:00 +01:00
|
|
|
# Tests require network access
|
|
|
|
doCheck = false;
|
|
|
|
|
2024-09-27 12:49:41 +01: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/"
|
|
|
|
'';
|
|
|
|
meta = {
|
|
|
|
inherit (vale.meta) mainProgram;
|
|
|
|
};
|
2024-04-23 15:57:37 +01:00
|
|
|
};
|
2024-03-30 04:20:00 +00:00
|
|
|
|
2024-09-27 12:49:41 +01:00
|
|
|
meta = {
|
2019-01-18 12:05:24 +00:00
|
|
|
description = "Syntax-aware linter for prose built with speed and extensibility in mind";
|
2024-03-30 04:20:00 +00:00
|
|
|
longDescription = ''
|
|
|
|
Vale in Nixpkgs offers the helper `.withStyles` allow you to install it
|
|
|
|
predefined styles:
|
|
|
|
|
2024-09-27 12:49:41 +01:00
|
|
|
```nix
|
|
|
|
vale.withStyles (s: [ s.alex s.google ])
|
|
|
|
```
|
2024-03-30 04:20:00 +00:00
|
|
|
'';
|
2023-07-26 05:20:00 +01:00
|
|
|
homepage = "https://vale.sh/";
|
|
|
|
changelog = "https://github.com/errata-ai/vale/releases/tag/v${version}";
|
2024-03-16 17:07:58 +00:00
|
|
|
mainProgram = "vale";
|
2024-09-27 12:49:41 +01:00
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = with lib.maintainers; [ pbsds ];
|
2018-03-10 22:28:02 +00:00
|
|
|
};
|
|
|
|
}
|