From 1caf98c3a73313707d64150cfe5f81a64112f534 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Mon, 12 Jun 2023 04:20:00 +0000 Subject: [PATCH] readability-cli: repackage using buildNpmPackage --- pkgs/development/node-packages/aliases.nix | 1 + .../node-packages/node-packages.json | 1 - .../node-packages/node-packages.nix | 181 ------------------ pkgs/development/node-packages/overrides.nix | 20 -- pkgs/tools/text/readability-cli/default.nix | 40 ++++ pkgs/top-level/all-packages.nix | 2 + 6 files changed, 43 insertions(+), 202 deletions(-) create mode 100644 pkgs/tools/text/readability-cli/default.nix diff --git a/pkgs/development/node-packages/aliases.nix b/pkgs/development/node-packages/aliases.nix index 7e13ee15364e2..830fc2d956cce 100644 --- a/pkgs/development/node-packages/aliases.nix +++ b/pkgs/development/node-packages/aliases.nix @@ -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 } diff --git a/pkgs/development/node-packages/node-packages.json b/pkgs/development/node-packages/node-packages.json index 635677feb6a1d..8270ebf8665b0 100644 --- a/pkgs/development/node-packages/node-packages.json +++ b/pkgs/development/node-packages/node-packages.json @@ -271,7 +271,6 @@ , "react-native-cli" , "react-static" , "react-tools" -, "readability-cli" , "redoc-cli" , "remod-cli" , "reveal.js" diff --git a/pkgs/development/node-packages/node-packages.nix b/pkgs/development/node-packages/node-packages.nix index a4110da48ed1a..e784b8159fb65 100644 --- a/pkgs/development/node-packages/node-packages.nix +++ b/pkgs/development/node-packages/node-packages.nix @@ -131037,187 +131037,6 @@ in bypassCache = true; reconstructLock = true; }; - readability-cli = nodeEnv.buildNodePackage { - name = "readability-cli"; - packageName = "readability-cli"; - version = "2.4.4"; - src = fetchurl { - url = "https://registry.npmjs.org/readability-cli/-/readability-cli-2.4.4.tgz"; - sha512 = "KNVRUT4JKrnNCkD4IuMm9zU5bkFc699lue7xT66lIhjXTARwKlBRwiSZYgx7mCKC/Zj40dw89UULFAyihnXLXQ=="; - }; - dependencies = [ - sources."@mapbox/node-pre-gyp-1.0.10" - sources."@mozilla/readability-0.4.4" - sources."@tootallnate/once-2.0.0" - sources."abab-2.0.6" - sources."abbrev-1.1.1" - sources."acorn-8.8.2" - (sources."acorn-globals-6.0.0" // { - dependencies = [ - sources."acorn-7.4.1" - ]; - }) - sources."acorn-walk-7.2.0" - sources."agent-base-6.0.2" - sources."ansi-regex-5.0.1" - sources."ansi-styles-4.3.0" - sources."aproba-2.0.0" - sources."are-we-there-yet-2.0.0" - sources."asynckit-0.4.0" - sources."balanced-match-1.0.2" - sources."brace-expansion-1.1.11" - sources."browser-process-hrtime-1.0.0" - sources."bufferutil-4.0.7" - sources."canvas-2.11.2" - sources."chownr-2.0.0" - sources."cliui-8.0.1" - sources."color-convert-2.0.1" - sources."color-name-1.1.4" - sources."color-support-1.1.3" - sources."combined-stream-1.0.8" - sources."concat-map-0.0.1" - sources."console-control-strings-1.1.0" - sources."cssom-0.5.0" - (sources."cssstyle-2.3.0" // { - dependencies = [ - sources."cssom-0.3.8" - ]; - }) - (sources."data-urls-3.0.2" // { - dependencies = [ - sources."whatwg-url-11.0.0" - ]; - }) - sources."debug-4.3.4" - sources."decimal.js-10.4.3" - sources."decompress-response-4.2.1" - sources."deep-is-0.1.4" - sources."delayed-stream-1.0.0" - sources."delegates-1.0.0" - sources."detect-libc-2.0.1" - sources."domexception-4.0.0" - sources."dompurify-2.4.5" - sources."emoji-regex-8.0.0" - sources."encoding-0.1.13" - sources."escalade-3.1.1" - sources."escodegen-2.0.0" - sources."esprima-4.0.1" - sources."estraverse-5.3.0" - sources."esutils-2.0.3" - sources."fast-levenshtein-2.0.6" - sources."form-data-4.0.0" - (sources."fs-minipass-2.1.0" // { - dependencies = [ - sources."minipass-3.3.6" - ]; - }) - sources."fs.realpath-1.0.0" - sources."gauge-3.0.2" - sources."get-caller-file-2.0.5" - sources."glob-7.2.3" - sources."has-unicode-2.0.1" - sources."html-encoding-sniffer-3.0.0" - sources."http-proxy-agent-5.0.0" - sources."https-proxy-agent-5.0.1" - sources."iconv-lite-0.6.3" - sources."inflight-1.0.6" - sources."inherits-2.0.4" - sources."is-fullwidth-code-point-3.0.0" - sources."is-potential-custom-element-name-1.0.1" - sources."jsdom-19.0.0" - sources."levn-0.3.0" - sources."lru-cache-6.0.0" - (sources."make-dir-3.1.0" // { - dependencies = [ - sources."semver-6.3.0" - ]; - }) - sources."mime-db-1.52.0" - sources."mime-types-2.1.35" - sources."mimic-response-2.1.0" - sources."minimatch-3.1.2" - sources."minipass-5.0.0" - (sources."minizlib-2.1.2" // { - dependencies = [ - sources."minipass-3.3.6" - ]; - }) - sources."mkdirp-1.0.4" - sources."ms-2.1.2" - sources."nan-2.17.0" - (sources."node-fetch-2.6.11" // { - dependencies = [ - sources."tr46-0.0.3" - sources."webidl-conversions-3.0.1" - sources."whatwg-url-5.0.0" - ]; - }) - sources."node-gyp-build-4.6.0" - sources."nopt-5.0.0" - sources."npmlog-5.0.1" - sources."nwsapi-2.2.5" - sources."object-assign-4.1.1" - sources."once-1.4.0" - sources."optionator-0.8.3" - sources."parse5-6.0.1" - sources."path-is-absolute-1.0.1" - sources."prelude-ls-1.1.2" - sources."psl-1.9.0" - sources."punycode-2.3.0" - sources."querystringify-2.2.0" - sources."readable-stream-3.6.2" - sources."require-directory-2.1.1" - sources."requires-port-1.0.0" - sources."rimraf-3.0.2" - sources."safe-buffer-5.2.1" - sources."safer-buffer-2.1.2" - sources."saxes-5.0.1" - sources."semver-7.5.1" - sources."set-blocking-2.0.0" - sources."signal-exit-3.0.7" - sources."simple-concat-1.0.1" - sources."simple-get-3.1.1" - sources."source-map-0.6.1" - sources."string-width-4.2.3" - sources."string_decoder-1.3.0" - sources."strip-ansi-6.0.1" - sources."symbol-tree-3.2.4" - sources."tar-6.1.15" - sources."tough-cookie-4.1.3" - sources."tr46-3.0.0" - sources."type-check-0.3.2" - sources."universalify-0.2.0" - sources."url-parse-1.5.10" - sources."utf-8-validate-6.0.3" - sources."util-deprecate-1.0.2" - sources."w3c-hr-time-1.0.2" - sources."w3c-xmlserializer-3.0.0" - sources."webidl-conversions-7.0.0" - sources."whatwg-encoding-2.0.0" - sources."whatwg-mimetype-3.0.0" - sources."whatwg-url-10.0.0" - sources."wide-align-1.1.5" - sources."word-wrap-1.2.3" - sources."wrap-ansi-7.0.0" - sources."wrappy-1.0.2" - sources."ws-8.13.0" - sources."xml-name-validator-4.0.0" - sources."xmlchars-2.2.0" - sources."y18n-5.0.8" - sources."yallist-4.0.0" - sources."yargs-17.7.2" - sources."yargs-parser-21.1.1" - ]; - buildInputs = globalBuildInputs; - meta = { - 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#readme"; - license = "GPL-3.0-only"; - }; - production = true; - bypassCache = true; - reconstructLock = true; - }; redoc-cli = nodeEnv.buildNodePackage { name = "redoc-cli"; packageName = "redoc-cli"; diff --git a/pkgs/development/node-packages/overrides.nix b/pkgs/development/node-packages/overrides.nix index 27665af01e4c8..11bb7a0da5991 100644 --- a/pkgs/development/node-packages/overrides.nix +++ b/pkgs/development/node-packages/overrides.nix @@ -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 ]; diff --git a/pkgs/tools/text/readability-cli/default.nix b/pkgs/tools/text/readability-cli/default.nix new file mode 100644 index 0000000000000..5c0fedd752c35 --- /dev/null +++ b/pkgs/tools/text/readability-cli/default.nix @@ -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"; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e26435ed865e4..d70cb8570a471 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { };