Skip to content

Commit

Permalink
Merge pull request #312471 from natsukium/textlint/repackage
Browse files Browse the repository at this point in the history
textlint: repackage with buildNpmPackage
  • Loading branch information
natsukium authored May 26, 2024
2 parents b45ff4a + 5f58c6a commit 2e7b251
Show file tree
Hide file tree
Showing 33 changed files with 1,127 additions and 1,229 deletions.
37 changes: 37 additions & 0 deletions pkgs/by-name/te/textlint-plugin-latex2e/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
lib,
fetchFromGitHub,
buildNpmPackage,
textlint,
textlint-plugin-latex2e,
textlint-rule-max-comma,
}:

buildNpmPackage rec {
pname = "textlint-plugin-latex2e";
version = "1.2.1-unstable-2024-02-05";

src = fetchFromGitHub {
owner = "textlint";
repo = "textlint-plugin-latex2e";
rev = "d3ba1be14543aaaf8e52f87d103fafb3ebb7c4b0";
hash = "sha256-sCDpyhnznMAkIPWK0BawWZwuR9UO/ipIG2o5hyBkJQ0=";
};

npmDepsHash = "sha256-u2cMZC3s4iGCWG6iVMDYfb6XbxfjCdwpzl7opkwtrU8=";

passthru.tests = textlint.testPackages {
inherit (textlint-plugin-latex2e) pname;
rule = textlint-rule-max-comma;
plugin = textlint-plugin-latex2e;
testFile = ./test.tex;
};

meta = {
description = "Textlint Plugin LaTeX2ε";
homepage = "https://github.com/textlint/textlint-plugin-latex2e";
changelog = "https://github.com/textlint/textlint-plugin-latex2e/blob/${src.rev}/CHANGELOG.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ natsukium ];
};
}
4 changes: 4 additions & 0 deletions pkgs/by-name/te/textlint-plugin-latex2e/test.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
\documentclass{article}
\begin{document}
Nix, is a tool, that takes a unique approach to package management and system configuration, Learn how to make reproducible, declarative, and reliable systems.
\end{document}
79 changes: 79 additions & 0 deletions pkgs/by-name/te/textlint-rule-abbr-within-parentheses/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
lib,
stdenv,
fetchFromGitHub,
fetchYarnDeps,
fixup-yarn-lock,
nodejs,
yarn,
textlint,
textlint-rule-abbr-within-parentheses,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "textlint-rule-abbr-within-parentheses";
version = "1.0.2";

src = fetchFromGitHub {
owner = "azu";
repo = "textlint-rule-abbr-within-parentheses";
rev = "refs/tags/${finalAttrs.version}";
hash = "sha256-CBrf7WtvywDmtuSyxkDtAyjmrj7KS3TQLSsNfMxeWXw=";
};

offlineCache = fetchYarnDeps {
yarnLock = "${finalAttrs.src}/yarn.lock";
hash = "sha256-N4tnja6qTo7jtn7Dh4TwBUCUKfbIbHvdZ7aeJcE+NlU=";
};

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-abbr-within-parentheses
cp -r . $out/lib/node_modules/textlint-rule-abbr-within-parentheses/
runHook postInstall
'';

passthru.tests = textlint.testPackages {
rule = textlint-rule-abbr-within-parentheses;
testFile = ./test.md;
};

meta = {
description = "Textlint rule check if write abbreviations within parentheses";
homepage = "https://github.com/azu/textlint-rule-abbr-within-parentheses";
changelog = "https://github.com/azu/textlint-rule-abbr-within-parentheses/releases/tag/${finalAttrs.src.rev}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ natsukium ];
platforms = textlint.meta.platforms;
};
})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Passing an expression `expr` that evaluates to a store path to any built-in function which reads from the filesystem constitutes IFD(Import From Derivation).
34 changes: 34 additions & 0 deletions pkgs/by-name/te/textlint-rule-alex/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
lib,
fetchFromGitHub,
buildNpmPackage,
textlint,
textlint-rule-alex,
}:

buildNpmPackage rec {
pname = "textlint-rule-alex";
version = "5.0.0";

src = fetchFromGitHub {
owner = "textlint-rule";
repo = "textlint-rule-alex";
rev = "refs/tags/v${version}";
hash = "sha256-1JoiUhiRXZWIyLAJXp5ZzFAa/NBCN79jYh5kMNbO0jI=";
};

npmDepsHash = "sha256-ovDDiOZ415ubyDqbLNggzoVuqUWsRlG3zlhRW6xU3SQ=";

passthru.tests = textlint.testPackages {
rule = textlint-rule-alex;
testFile = ./test.md;
};

meta = {
description = "Textlint rule for alex";
homepage = "https://github.com/textlint-rule/textlint-rule-alex";
changelog = "https://github.com/textlint-rule/textlint-rule-alex/releases/tag/${src.rev}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ natsukium ];
};
}
1 change: 1 addition & 0 deletions pkgs/by-name/te/textlint-rule-alex/test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A message for this sentence will pop up.
135 changes: 135 additions & 0 deletions pkgs/by-name/te/textlint-rule-common-misspellings/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{
lib,
stdenvNoCC,
fetchurl,
fetchFromGitHub,
fetchYarnDeps,
fixup-yarn-lock,
nodejs,
yarn,
textlint,
textlint-rule-common-misspellings,
}:

# there is no lock file in this package, but it is old and stable enough
# so that we handle dependencies manually
let
misspellings = stdenvNoCC.mkDerivation (finalAttrs: {
pname = "misspellings";
version = "1.1.0";

src = fetchurl {
url = "https://registry.npmjs.org/misspellings/-/misspellings-${finalAttrs.version}.tgz";
hash = "sha256-+4QxmGjoF0mBldN4XQMvoK8YDS4PBV9/c+/BPf4FbkM=";
};

dontBuild = true;

installPhase = ''
runHook preInstall
mkdir -p $out/lib/node_modules/misspellings
cp -r . $out/lib/node_modules/misspellings/
runHook postInstall
'';
});

textlint-rule-helper = stdenvNoCC.mkDerivation (finalAttrs: {
pname = "textlint-rule-helper";
version = "2.3.1";

src = fetchFromGitHub {
owner = "textlint";
repo = "textlint-rule-helper";
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-SVeL/3KC/yazSGsmn5We8fJAuVqfcspzN7i2a4+EOlI=";
};

offlineCache = fetchYarnDeps {
yarnLock = "${finalAttrs.src}/yarn.lock";
hash = "sha256-UN56VuUHl7aS+QLON8ZROTSCGKKCn/8xuIkR46LyY+U=";
};

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-helper
cp -r . $out/lib/node_modules/textlint-rule-helper/
runHook postInstall
'';
});
in
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "textlint-rule-common-misspellings";
version = "1.0.1";

src = fetchurl {
url = "https://registry.npmjs.org/textlint-rule-common-misspellings/-/textlint-rule-common-misspellings-${finalAttrs.version}.tgz";
hash = "sha256-5QVb5T2yGuunNhRQG5brJQyicRRbO8XewzjO2RzN0bI=";
};

dontBuild = true;

buildInputs = [
misspellings
textlint-rule-helper
];

installPhase = ''
runHook preInstall
mkdir -p $out/lib/node_modules/textlint-rule-common-misspellings/node_modules/textlint-rule-helper
cp -r ${misspellings}/lib/node_modules/misspellings $out/lib/node_modules/textlint-rule-common-misspellings/node_modules/misspellings
cp -r ${textlint-rule-helper}/lib/node_modules/textlint-rule-helper/node_modules/* $out/lib/node_modules/textlint-rule-common-misspellings/node_modules
cp -r ${textlint-rule-helper}/lib/node_modules/textlint-rule-helper/lib $out/lib/node_modules/textlint-rule-common-misspellings/node_modules/textlint-rule-helper/lib
cp -r ${textlint-rule-helper}/lib/node_modules/textlint-rule-helper/package.json $out/lib/node_modules/textlint-rule-common-misspellings/node_modules/textlint-rule-helper/package.json
cp -r . $out/lib/node_modules/textlint-rule-common-misspellings/
runHook postInstall
'';

passthru.tests = textlint.testPackages {
rule = textlint-rule-common-misspellings;
testFile = ./test.md;
};

meta = {
description = "Textlint rule to check common misspellings";
homepage = "https://github.com/io-monad/textlint-rule-common-misspellings";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ natsukium ];
mainProgram = "textlint-rule-common-misspellings";
platforms = textlint.meta.platforms;
};
})
1 change: 1 addition & 0 deletions pkgs/by-name/te/textlint-rule-common-misspellings/test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`textlint-rule-common-misspellings` is an old and mature libary.
36 changes: 36 additions & 0 deletions pkgs/by-name/te/textlint-rule-diacritics/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
lib,
fetchFromGitHub,
buildNpmPackage,
textlint,
textlint-rule-diacritics,
}:

buildNpmPackage rec {
pname = "textlint-rule-diacritics";
version = "1.0.0-unstable-2023-01-05";

src = fetchFromGitHub {
owner = "sapegin";
repo = "textlint-rule-diacritics";
rev = "07977d866aa6ce514bc6ed3a1087b2bb5869bfb4";
hash = "sha256-Zr+qWvgpLq3pzO4A7c+x4rTKkaSNO4t1gCiyJL3lkws=";
};

npmDepsHash = "sha256-bKA8aPVBYdzRPwCyFdEs3eWStJwswCZPVpsqGWwc42E=";

dontNpmBuild = true;

passthru.tests = textlint.testPackages {
rule = textlint-rule-diacritics;
testFile = ./test.md;
};

meta = {
description = "Textlint rule to check correct usage of diacritics";
homepage = "https://github.com/sapegin/textlint-rule-diacritics?tab=readme-ov-file";
changelog = "https://github.com/sapegin/textlint-rule-diacritics/releases/tag/${src.rev}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ natsukium ];
};
}
1 change: 1 addition & 0 deletions pkgs/by-name/te/textlint-rule-diacritics/test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
creme brulee
Loading

0 comments on commit 2e7b251

Please sign in to comment.