nixpkgs/pkgs/by-name/ma/markdownlint-cli2/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

58 lines
1.7 KiB
Nix

{
lib,
stdenvNoCC,
fetchurl,
makeWrapper,
markdownlint-cli2,
nodejs,
runCommand,
zstd,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "markdownlint-cli2";
version = "0.14.0";
# upstream is not interested in including package-lock.json in the source
# https://github.com/DavidAnson/markdownlint-cli2/issues/198#issuecomment-1690529976
# see also https://github.com/DavidAnson/markdownlint-cli2/issues/186
# so use the tarball from the archlinux mirror
src = fetchurl {
url = "https://us.mirrors.cicku.me/archlinux/extra/os/x86_64/markdownlint-cli2-${finalAttrs.version}-1-any.pkg.tar.zst";
hash = "sha256-yzKIH1RxFXlUoj/83lVEBb3Y4asuh/frPxmX5EV98f0=";
};
nativeBuildInputs = [
makeWrapper
zstd
];
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp -r lib share $out
makeWrapper "${lib.getExe nodejs}" "$out/bin/markdownlint-cli2" \
--add-flags "$out/lib/node_modules/markdownlint-cli2/markdownlint-cli2.js"
runHook postInstall
'';
passthru.tests = {
smoke = runCommand "${finalAttrs.pname}-test" { nativeBuildInputs = [ markdownlint-cli2 ]; } ''
markdownlint-cli2 ${markdownlint-cli2}/share/doc/markdownlint-cli2/README.md > $out
'';
};
meta = {
changelog = "https://github.com/DavidAnson/markdownlint-cli2/blob/v${finalAttrs.version}/CHANGELOG.md";
description = "Fast, flexible, configuration-based command-line interface for linting Markdown/CommonMark files with the markdownlint library";
homepage = "https://github.com/DavidAnson/markdownlint-cli2";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ natsukium ];
mainProgram = "markdownlint-cli2";
};
})