nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 makeBinaryWrapper,
6 symlinkJoin,
7 versionCheckHook,
8 vale,
9 valeStyles,
10}:
11
12buildGoModule rec {
13 pname = "vale";
14 version = "3.12.0";
15
16 subPackages = [ "cmd/vale" ];
17
18 src = fetchFromGitHub {
19 owner = "errata-ai";
20 repo = "vale";
21 tag = "v${version}";
22 hash = "sha256-j228Gt2cHkO1XZv+KqH6U8EjttQzDZiOMLppdJUJwvA=";
23 };
24
25 vendorHash = "sha256-3gmgKcpCEeFjHpm+iKQvm4Cv5UfzFrcDDNIAnlY/a5s=";
26
27 ldflags = [
28 "-s"
29 "-X main.version=${version}"
30 ];
31
32 # Tests require network access
33 doCheck = false;
34 doInstallCheck = true;
35
36 nativeInstallCheckInputs = [ versionCheckHook ];
37
38 passthru.withStyles =
39 selector:
40 symlinkJoin {
41 name = "vale-with-styles-${vale.version}";
42 paths = [ vale ] ++ selector valeStyles;
43 nativeBuildInputs = [ makeBinaryWrapper ];
44 postBuild = ''
45 wrapProgram "$out/bin/vale" \
46 --set VALE_STYLES_PATH "$out/share/vale/styles/"
47 '';
48 meta = {
49 inherit (vale.meta) mainProgram;
50 };
51 };
52
53 meta = {
54 description = "Syntax-aware linter for prose built with speed and extensibility in mind";
55 longDescription = ''
56 Vale in Nixpkgs offers the helper `.withStyles` allow you to install it
57 predefined styles:
58
59 ```nix
60 vale.withStyles (s: [ s.alex s.google ])
61 ```
62 '';
63 homepage = "https://vale.sh/";
64 changelog = "https://github.com/errata-ai/vale/releases/tag/v${version}";
65 mainProgram = "vale";
66 license = lib.licenses.mit;
67 maintainers = with lib.maintainers; [ pbsds ];
68 };
69}