nixpkgs/pkgs/by-name/pe/percollate/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

45 lines
1.2 KiB
Nix

{ lib, buildNpmPackage, fetchFromGitHub, chromium, makeWrapper }:
buildNpmPackage rec {
pname = "percollate";
version = "4.2.3";
src = fetchFromGitHub {
owner = "danburzo";
repo = pname;
rev = "v${version}";
hash = "sha256-JpdSEockALXtuuMMi5mgD5AXcayojyK0qMMWF+XFfZE=";
};
npmDepsHash = "sha256-qWu1YYi4ddpAUtbDxF4YA8OO6BLZ6gfeb4pw0n9BaZw=";
dontNpmBuild = true;
# Dev dependencies include an unnecessary Java dependency (epubchecker)
# https://github.com/danburzo/percollate/blob/v4.2.3/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";
};
}