depot/third_party/nixpkgs/pkgs/tools/text/percollate/default.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

44 lines
1.2 KiB
Nix

{ lib, buildNpmPackage, fetchFromGitHub, chromium, makeWrapper }:
buildNpmPackage rec {
pname = "percollate";
version = "4.2.1";
src = fetchFromGitHub {
owner = "danburzo";
repo = pname;
rev = "v${version}";
hash = "sha256-vGBGw9dUOSvSqM4WN53bb2LRduLjR6fW99C0ScdMVXk=";
};
npmDepsHash = "sha256-Qne4XjUmJS5e6x380CFY3Kd7/5coXHMxniMfqYIHQcQ=";
dontNpmBuild = true;
# Dev dependencies include an unnecessary Java dependency (epubchecker)
# https://github.com/danburzo/percollate/blob/v4.2.1/package.json#L40
npmInstallFlags = [ "--omit=dev" ];
nativeBuildInputs = [ makeWrapper ];
env = {
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD = true;
};
postPatch = ''
substituteInPlace package.json --replace "git config core.hooksPath .git-hooks" ""
'';
postInstall = ''
wrapProgram $out/bin/percollate \
--set PUPPETEER_EXECUTABLE_PATH ${chromium}/bin/chromium
'';
meta = with lib; {
description = "Command-line tool to turn web pages into readable PDF, EPUB, HTML, or Markdown docs";
homepage = "https://github.com/danburzo/percollate";
license = licenses.mit;
maintainers = [ maintainers.austinbutler ];
mainProgram = "percollate";
};
}