1{
2 lib,
3 buildNpmPackage,
4 fetchFromGitLab,
5 installShellFiles,
6 nix-update-script,
7}:
8
9buildNpmPackage (finalAttrs: {
10 pname = "readability-cli";
11 version = "2.4.5";
12
13 src = fetchFromGitLab {
14 owner = "gardenappl";
15 repo = "readability-cli";
16 rev = "v${finalAttrs.version}";
17 hash = "sha256-fkXhAXbvCj5eRkPcv0Q7ryZeGdERI/lHHg64EDyK2F4=";
18 };
19
20 patches = [
21 ./lockfile.patch
22 ];
23
24 postPatch = ''
25 # Set a script name to avoid yargs using index.js as $0
26 substituteInPlace common.mjs \
27 --replace-fail '.version(false)' '.version(false).scriptName("readable")'
28 '';
29
30 npmDepsHash = "sha256-9sN1TgyOjgGLQsAlnI/fVbez7Oy2r6QwfaUTKyLQRVc=";
31
32 nativeBuildInputs = [ installShellFiles ];
33
34 dontNpmBuild = true;
35
36 postInstall = ''
37 installManPage readability-cli.1
38 installShellCompletion --cmd readable \
39 --bash <(SHELL=bash $out/bin/readable --completion) \
40 --zsh <(SHELL=zsh $out/bin/readable --completion)
41 '';
42
43 passthru.updateScript = nix-update-script { };
44
45 meta = {
46 description = "Firefox Reader Mode in your terminal - get useful text from a web page using Mozilla's Readability library";
47 homepage = "https://gitlab.com/gardenappl/readability-cli";
48 license = lib.licenses.gpl3Only;
49 maintainers = with lib.maintainers; [ juliusfreudenberger ];
50 mainProgram = "readable";
51 };
52})