forgejo-lts: 7.0.10 -> 7.0.11
[NixPkgs.git] / pkgs / by-name / re / readability-cli / package.nix
blobaea915c73ef4e04ea0e3d231a6f8ea2ed55b21dc
1 { lib, buildNpmPackage, fetchFromGitLab, installShellFiles }:
3 buildNpmPackage rec {
4   pname = "readability-cli";
5   version = "2.4.4";
7   src = fetchFromGitLab {
8     owner = "gardenappl";
9     repo = pname;
10     rev = "v${version}";
11     hash = "sha256-pvAp3ZJ8/FPhrSMC8B4U1m5zuBNRP/HcsXkrW6QYgSQ=";
12   };
14   postPatch = ''
15     # Set a script name to avoid yargs using index.js as $0
16     substituteInPlace common.mjs \
17       --replace '.version(false)' '.version(false).scriptName("readable")'
18   '';
20   npmDepsHash = "sha256-X1pcgDm8C4G+hIsgx3sAVFQPadWsULvXrdLAIHnpjmE=";
22   nativeBuildInputs = [ installShellFiles ];
24   dontNpmBuild = true;
26   postInstall = ''
27     installManPage readability-cli.1
28     installShellCompletion --cmd readable \
29       --bash <(SHELL=bash $out/bin/readable --completion) \
30       --zsh <(SHELL=zsh $out/bin/readable --completion)
31   '';
33   meta = with lib; {
34     description = "Firefox Reader Mode in your terminal - get useful text from a web page using Mozilla's Readability library";
35     homepage = "https://gitlab.com/gardenappl/readability-cli";
36     license = licenses.gpl3Only;
37     maintainers = [ ];
38     mainProgram = "readable";
39   };