Merge pull request #301204 from marsam/vale-styles

valeStyles: init

authored by Paul Meyer and committed by GitHub 96fbb517 1114b274

+171 -7
+25 -7
pkgs/tools/text/vale/default.nix
··· 1 - { lib, buildGoModule, fetchFromGitHub }: 2 3 buildGoModule rec { 4 pname = "vale"; 5 version = "3.4.1"; 6 7 subPackages = [ "cmd/vale" ]; 8 - outputs = [ "out" "data" ]; 9 10 src = fetchFromGitHub { 11 owner = "errata-ai"; ··· 15 }; 16 17 vendorHash = "sha256-HMzFLSmO6sBDNU89UoIvHcPPd3ubpti2ii4sFMKUDmI="; 18 - 19 - postInstall = '' 20 - mkdir -p $data/share/vale 21 - cp -r testdata/styles $data/share/vale 22 - ''; 23 24 ldflags = [ "-s" "-w" "-X main.version=${version}" ]; 25 26 # Tests require network access 27 doCheck = false; 28 29 meta = with lib; { 30 description = "A syntax-aware linter for prose built with speed and extensibility in mind"; 31 homepage = "https://vale.sh/"; 32 changelog = "https://github.com/errata-ai/vale/releases/tag/v${version}"; 33 mainProgram = "vale";
··· 1 + { lib 2 + , buildGoModule 3 + , fetchFromGitHub 4 + , makeBinaryWrapper 5 + , runCommand 6 + , symlinkJoin 7 + , vale 8 + , valeStyles 9 + }: 10 11 buildGoModule rec { 12 pname = "vale"; 13 version = "3.4.1"; 14 15 subPackages = [ "cmd/vale" ]; 16 17 src = fetchFromGitHub { 18 owner = "errata-ai"; ··· 22 }; 23 24 vendorHash = "sha256-HMzFLSmO6sBDNU89UoIvHcPPd3ubpti2ii4sFMKUDmI="; 25 26 ldflags = [ "-s" "-w" "-X main.version=${version}" ]; 27 28 # Tests require network access 29 doCheck = false; 30 31 + passthru.withStyles = selector: symlinkJoin { 32 + name = "vale-with-styles-${vale.version}"; 33 + paths = [ vale ] ++ selector valeStyles; 34 + nativeBuildInputs = [ makeBinaryWrapper ]; 35 + postBuild = '' 36 + wrapProgram "$out/bin/vale" \ 37 + --set VALE_STYLES_PATH "$out/share/vale/styles/" 38 + ''; 39 + }; 40 + 41 meta = with lib; { 42 description = "A syntax-aware linter for prose built with speed and extensibility in mind"; 43 + longDescription = '' 44 + Vale in Nixpkgs offers the helper `.withStyles` allow you to install it 45 + predefined styles: 46 + 47 + vale.withStyles (s: [ s.alex s.google ]) 48 + ''; 49 homepage = "https://vale.sh/"; 50 changelog = "https://github.com/errata-ai/vale/releases/tag/v${version}"; 51 mainProgram = "vale";
+144
pkgs/tools/text/vale/styles.nix
···
··· 1 + { lib, stdenvNoCC, fetchFromGitHub, fetchzip, nix-update-script }: 2 + 3 + let 4 + buildStyle = 5 + { name 6 + , stylePath ? name 7 + , ... 8 + }@args: 9 + stdenvNoCC.mkDerivation ({ 10 + pname = "vale-style-${lib.toLower name}"; 11 + 12 + dontConfigure = true; 13 + dontBuild = true; 14 + doCheck = false; 15 + dontFixup = true; 16 + 17 + installPhase = '' 18 + runHook preInstall 19 + mkdir -p $out/share/vale/styles 20 + cp -R ${stylePath} "$out/share/vale/styles/${name}" 21 + runHook postInstall 22 + ''; 23 + 24 + passthru.updateScript = nix-update-script { }; 25 + 26 + meta = { 27 + platforms = lib.platforms.all; 28 + maintainers = with lib.maintainers; [ katexochen ]; 29 + } // (args.meta or { }); 30 + } // removeAttrs args [ "meta" "name" ]); 31 + in 32 + { 33 + alex = buildStyle rec { 34 + name = "alex"; 35 + version = "0.2.1"; 36 + src = fetchFromGitHub { 37 + owner = "errata-ai"; 38 + repo = "alex"; 39 + rev = "v${version}"; 40 + hash = "sha256-xNF7se2FwKgNe5KYx/zvGWpIwBsBADYGH4JV1lUww+Q="; 41 + }; 42 + meta = { 43 + description = "A Vale-compatible implementation of the guidelines enforced by the alex linter"; 44 + homepage = "https://github.com/errata-ai/alex"; 45 + license = lib.licenses.mit; 46 + }; 47 + }; 48 + 49 + google = buildStyle rec { 50 + name = "Google"; 51 + version = "0.6.0"; 52 + src = fetchFromGitHub { 53 + owner = "errata-ai"; 54 + repo = "Google"; 55 + rev = "v${version}"; 56 + hash = "sha256-TQS/hgS6tEWPSuZpEbX65MdYSE/+HJVcnzIuQbhIG2M="; 57 + }; 58 + meta = { 59 + description = "A Vale-compatible implementation of the Google Developer Documentation Style Guide"; 60 + homepage = "https://github.com/errata-ai/Google"; 61 + license = lib.licenses.mit; 62 + }; 63 + }; 64 + 65 + joblint = buildStyle rec { 66 + name = "Joblint"; 67 + version = "0.4.1"; 68 + src = fetchFromGitHub { 69 + owner = "errata-ai"; 70 + repo = "Joblint"; 71 + rev = "v${version}"; 72 + hash = "sha256-zRz5ThOg5RLTZj3dYPe0PDvOF5DjO31lduSpi2Us87U="; 73 + }; 74 + meta = { 75 + description = "A Vale-compatible implementation of the Joblint linter"; 76 + homepage = "https://github.com/errata-ai/Joblint"; 77 + license = lib.licenses.mit; 78 + }; 79 + }; 80 + 81 + microsoft = buildStyle rec { 82 + name = "Microsoft"; 83 + version = "0.14.0"; 84 + src = fetchFromGitHub { 85 + owner = "errata-ai"; 86 + repo = "Microsoft"; 87 + rev = "v${version}"; 88 + hash = "sha256-22rGNLZOsWYQ+H3CcM2b1zOXV3kNPcgYqDpaCg1iv9o="; 89 + }; 90 + meta = { 91 + description = "A Vale-compatible implementation of the Microsoft Writing Style Guide"; 92 + homepage = "https://github.com/errata-ai/Microsoft"; 93 + license = lib.licenses.mit; 94 + }; 95 + }; 96 + 97 + proselint = buildStyle rec { 98 + name = "proselint"; 99 + version = "0.3.3"; 100 + src = fetchFromGitHub { 101 + owner = "errata-ai"; 102 + repo = "proselint"; 103 + rev = "v${version}"; 104 + hash = "sha256-faeWr1bRhnKsycJY89WqnRv8qIowUmz3EQvDyjtl63w="; 105 + }; 106 + meta = { 107 + description = "A Vale-compatible implementation of Python's proselint linter"; 108 + homepage = "https://github.com/errata-ai/proselint"; 109 + license = lib.licenses.bsd3; 110 + }; 111 + }; 112 + 113 + readability = buildStyle rec { 114 + name = "Readability"; 115 + version = "0.1.1"; 116 + src = fetchFromGitHub { 117 + owner = "errata-ai"; 118 + repo = "readability"; 119 + rev = "v${version}"; 120 + hash = "sha256-5Y9v8QsZjC2w3/pGIcL5nBdhpogyJznO5IFa0s8VOOI="; 121 + }; 122 + meta = { 123 + description = "Vale-compatible implementations of many popular \"readability\" metrics"; 124 + homepage = "https://github.com/errata-ai/readability"; 125 + license = lib.licenses.mit; 126 + }; 127 + }; 128 + 129 + write-good = buildStyle rec { 130 + name = "write-good"; 131 + version = "0.4.0"; 132 + src = fetchFromGitHub { 133 + owner = "errata-ai"; 134 + repo = "write-good"; 135 + rev = "v${version}"; 136 + hash = "sha256-KQzY6MeHV/owPVmUAfzGUO0HmFPkD7wdQqOvBkipwP8="; 137 + }; 138 + meta = { 139 + description = "A Vale-compatible implementation of the write-good linter"; 140 + homepage = "https://github.com/errata-ai/write-good"; 141 + license = lib.licenses.mit; 142 + }; 143 + }; 144 + }
+2
pkgs/top-level/all-packages.nix
··· 24917 24918 vale = callPackage ../tools/text/vale { }; 24919 24920 valhalla = callPackage ../development/libraries/valhalla { 24921 boost = boost.override { enablePython = true; python = python3; }; 24922 protobuf = protobuf_21.override {
··· 24917 24918 vale = callPackage ../tools/text/vale { }; 24919 24920 + valeStyles = recurseIntoAttrs (callPackages ../tools/text/vale/styles.nix { }); 24921 + 24922 valhalla = callPackage ../development/libraries/valhalla { 24923 boost = boost.override { enablePython = true; python = python3; }; 24924 protobuf = protobuf_21.override {