From 53393cc14c96c6717d2cede00c29a42ecffb4460 Mon Sep 17 00:00:00 2001 From: Paul Meyer <49727155+katexochen@users.noreply.github.com> Date: Fri, 27 Sep 2024 13:49:41 +0200 Subject: [PATCH] vale: cleanup, format, refactor Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com> --- pkgs/tools/text/vale/default.nix | 55 ++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/pkgs/tools/text/vale/default.nix b/pkgs/tools/text/vale/default.nix index fa256b04aca4..3027258e7bd5 100644 --- a/pkgs/tools/text/vale/default.nix +++ b/pkgs/tools/text/vale/default.nix @@ -1,11 +1,11 @@ -{ lib -, buildGoModule -, fetchFromGitHub -, makeBinaryWrapper -, runCommand -, symlinkJoin -, vale -, valeStyles +{ + lib, + buildGoModule, + fetchFromGitHub, + makeBinaryWrapper, + symlinkJoin, + vale, + valeStyles, }: buildGoModule rec { @@ -23,36 +23,43 @@ buildGoModule rec { vendorHash = "sha256-0AeG0/ALU/mkXxVKzqGhxXLqq2XYmnF/ZRaZkJ5eQxU="; - ldflags = [ "-s" "-w" "-X main.version=${version}" ]; + ldflags = [ + "-s" + "-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; + 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; { + meta = { 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 ]) + ```nix + 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 ]; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ pbsds ]; }; }