about summary refs log tree commit diff
path: root/pkgs/by-name/te
diff options
context:
space:
mode:
authornatsukium <tomoya.otabi@gmail.com>2024-05-17 10:12:42 +0900
committernatsukium <tomoya.otabi@gmail.com>2024-05-18 01:04:51 +0900
commit8fc1968cb284d6d824a468a617de3ff5946f811d (patch)
tree862c81cf0a4bea1e8c274fab3d78a43499305b55 /pkgs/by-name/te
parent3109179f68472dccb1fa5200eeb4c30010035156 (diff)
textlint-rule-en-max-word-count: repackage with fetchYarnDeps
Diffstat (limited to 'pkgs/by-name/te')
-rw-r--r--pkgs/by-name/te/textlint-rule-en-max-word-count/package.nix79
-rw-r--r--pkgs/by-name/te/textlint-rule-en-max-word-count/test.md1
-rw-r--r--pkgs/by-name/te/textlint/package.nix2
3 files changed, 82 insertions, 0 deletions
diff --git a/pkgs/by-name/te/textlint-rule-en-max-word-count/package.nix b/pkgs/by-name/te/textlint-rule-en-max-word-count/package.nix
new file mode 100644
index 0000000000000..893ed385dabb2
--- /dev/null
+++ b/pkgs/by-name/te/textlint-rule-en-max-word-count/package.nix
@@ -0,0 +1,79 @@
+{
+  lib,
+  stdenv,
+  fetchFromGitHub,
+  fetchYarnDeps,
+  fixup-yarn-lock,
+  nodejs,
+  yarn,
+  textlint,
+  textlint-rule-en-max-word-count,
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "textlint-rule-en-max-word-count";
+  version = "2.0.1";
+
+  src = fetchFromGitHub {
+    owner = "textlint-rule";
+    repo = "textlint-rule-en-max-word-count";
+    rev = "refs/tags/v${finalAttrs.version}";
+    hash = "sha256-ZZWN0PVHQBHcvJ53jDtD/6wLxBYmSHO7OXb5UQQAmyc=";
+  };
+
+  offlineCache = fetchYarnDeps {
+    yarnLock = "${finalAttrs.src}/yarn.lock";
+    hash = "sha256-3sEbvIfSaMz9pJalEKs7y05OVh+cKDg9jfLYmVyS53M=";
+  };
+
+  nativeBuildInputs = [
+    fixup-yarn-lock
+    nodejs
+    yarn
+  ];
+
+  configurePhase = ''
+    runHook preConfigure
+
+    export HOME=$(mktemp -d)
+    yarn config --offline set yarn-offline-mirror "$offlineCache"
+    fixup-yarn-lock yarn.lock
+    yarn --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive install
+    patchShebangs node_modules
+
+    runHook postConfigure
+  '';
+
+  buildPhase = ''
+    runHook preBuild
+
+    yarn --offline build
+
+    runHook postBuild
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    yarn --offline --production install
+    rm -r test
+    mkdir -p $out/lib/node_modules/textlint-rule-en-max-word-count
+    cp -r . $out/lib/node_modules/textlint-rule-en-max-word-count/
+
+    runHook postInstall
+  '';
+
+  passthru.tests = textlint.testPackages {
+    rule = textlint-rule-en-max-word-count;
+    testFile = ./test.md;
+  };
+
+  meta = {
+    description = "Textlint rule that specify the maximum word count of a sentence";
+    homepage = "https://github.com/textlint-rule/textlint-rule-en-max-word-count";
+    changelog = "https://github.com/textlint-rule/textlint-rule-en-max-word-count/releases/tag/${finalAttrs.src.rev}";
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ natsukium ];
+    platforms = textlint.meta.platforms;
+  };
+})
diff --git a/pkgs/by-name/te/textlint-rule-en-max-word-count/test.md b/pkgs/by-name/te/textlint-rule-en-max-word-count/test.md
new file mode 100644
index 0000000000000..717096b6f3335
--- /dev/null
+++ b/pkgs/by-name/te/textlint-rule-en-max-word-count/test.md
@@ -0,0 +1 @@
+Nix is a tool that takes a unique approach to package management and system configuration, learn how to make reproducible declarative and reliable systems, Nix builds packages in isolation from each other, this ensures that they are reproducible and don’t have undeclared dependencies, so if a package works on one machine, it will also work on another.
diff --git a/pkgs/by-name/te/textlint/package.nix b/pkgs/by-name/te/textlint/package.nix
index 892976116f65f..a389b5fd4e3fe 100644
--- a/pkgs/by-name/te/textlint/package.nix
+++ b/pkgs/by-name/te/textlint/package.nix
@@ -10,6 +10,7 @@
   textlint-plugin-latex2e,
   textlint-rule-alex,
   textlint-rule-diacritics,
+  textlint-rule-en-max-word-count,
   textlint-rule-max-comma,
   textlint-rule-preset-ja-technical-writing,
   textlint-rule-stop-words,
@@ -104,6 +105,7 @@ buildNpmPackage rec {
         textlint-plugin-latex2e
         textlint-rule-alex
         textlint-rule-diacritics
+        textlint-rule-en-max-word-count
         textlint-rule-max-comma
         textlint-rule-preset-ja-technical-writing
         textlint-rule-stop-words