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