Skip to content

Commit

Permalink
Merge pull request #237463 from marsam/add-readabilty-cli
Browse files Browse the repository at this point in the history
readability-cli: repackage using buildNpmPackage
  • Loading branch information
Mic92 authored Jun 13, 2023
2 parents 53268c2 + 1caf98c commit 21fc574
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 202 deletions.
1 change: 1 addition & 0 deletions pkgs/development/node-packages/aliases.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ mapAliases {
"@nestjs/cli" = pkgs.nest-cli; # Added 2023-05-06
eslint_d = pkgs.eslint_d; # Added 2023-05-26
manta = pkgs.node-manta; # Added 2023-05-06
readability-cli = pkgs.readability-cli; # Added 2023-06-12
thelounge = pkgs.thelounge; # Added 2023-05-22
triton = pkgs.triton; # Added 2023-05-06
}
1 change: 0 additions & 1 deletion pkgs/development/node-packages/node-packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@
, "react-native-cli"
, "react-static"
, "react-tools"
, "readability-cli"
, "redoc-cli"
, "remod-cli"
, "reveal.js"
Expand Down
181 changes: 0 additions & 181 deletions pkgs/development/node-packages/node-packages.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 0 additions & 20 deletions pkgs/development/node-packages/overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -433,26 +433,6 @@ final: prev: {
'';
};

readability-cli = prev.readability-cli.override (oldAttrs: {
# Wrap src to fix this build error:
# > readability-cli/readable.ts: unsupported interpreter directive "#!/usr/bin/env -S deno..."
#
# Need to wrap the source, instead of patching in patchPhase, because
# buildNodePackage only unpacks sources in the installPhase.
src = pkgs.srcOnly {
src = oldAttrs.src;
name = oldAttrs.name;
patchPhase = "chmod a-x readable.ts";
};

nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs = with pkgs; [
pixman
cairo
pango
];
});

reveal-md = prev.reveal-md.override (
lib.optionalAttrs (!stdenv.isDarwin) {
nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ];
Expand Down
40 changes: 40 additions & 0 deletions pkgs/tools/text/readability-cli/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{ lib, buildNpmPackage, fetchFromGitLab, installShellFiles }:

buildNpmPackage rec {
pname = "readability-cli";
version = "2.4.4";

src = fetchFromGitLab {
owner = "gardenappl";
repo = pname;
rev = "v${version}";
hash = "sha256-pvAp3ZJ8/FPhrSMC8B4U1m5zuBNRP/HcsXkrW6QYgSQ=";
};

postPatch = ''
# Set a script name to avoid yargs using index.js as $0
substituteInPlace common.mjs \
--replace '.version(false)' '.version(false).scriptName("readable")'
'';

npmDepsHash = "sha256-X1pcgDm8C4G+hIsgx3sAVFQPadWsULvXrdLAIHnpjmE=";

nativeBuildInputs = [ installShellFiles ];

dontNpmBuild = true;

postInstall = ''
installManPage readability-cli.1
installShellCompletion --cmd readable \
--bash <(SHELL=bash $out/bin/readable --completion) \
--zsh <(SHELL=zsh $out/bin/readable --completion)
'';

meta = with lib; {
description = "Firefox Reader Mode in your terminal - get useful text from a web page using Mozilla's Readability library";
homepage = "https://gitlab.com/gardenappl/readability-cli";
license = licenses.gpl3Only;
maintainers = [ maintainers.marsam ];
mainProgram = "readable";
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11940,6 +11940,8 @@ with pkgs;

qt-box-editor = libsForQt5.callPackage ../applications/misc/qt-box-editor { };

readability-cli = callPackage ../tools/text/readability-cli { };

recutils = callPackage ../tools/misc/recutils { };

recoll = libsForQt5.callPackage ../applications/search/recoll { };
Expand Down

0 comments on commit 21fc574

Please sign in to comment.