Skip to content

Commit

Permalink
tldr: 1.6.1 -> 3.3.0; switch to tldr-python-client (#372718)
Browse files Browse the repository at this point in the history
  • Loading branch information
FliegendeWurst authored Jan 13, 2025
2 parents 71b9cbe + ffd5592 commit 1a685a9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 27 deletions.
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2505.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@

- `sm64ex-coop` has been removed as it was archived upstream. Consider migrating to `sm64coopdx`.

- `tldr` now uses [`tldr-python-client`](https://github.com/tldr-pages/tldr-python-client) instead of [`tldr-c-client`](https://github.com/tldr-pages/tldr-c-client) which is unmaintained.

- `renovate` was updated to v39. See the [upstream release notes](https://docs.renovatebot.com/release-notes-for-major-versions/#version-39) for breaking changes.
Like upstream's docker images, renovate now runs on NodeJS 22.

Expand Down
62 changes: 35 additions & 27 deletions pkgs/by-name/tl/tldr/package.nix
Original file line number Diff line number Diff line change
@@ -1,60 +1,68 @@
{
lib,
stdenv,
lib,
fetchFromGitHub,
curl,
libzip,
pkg-config,
installShellFiles,
python3Packages,
}:

stdenv.mkDerivation rec {
python3Packages.buildPythonApplication rec {
pname = "tldr";
version = "1.6.1";
version = "3.3.0";
pyproject = true;

src = fetchFromGitHub {
owner = "tldr-pages";
repo = "tldr-c-client";
rev = "v${version}";
sha256 = "sha256-1L9frURnzfq0XvPBs8D+hBikybAw8qkb0DyZZtkZleY=";
repo = "tldr-python-client";
tag = version;
hash = "sha256-lc0Jen8vW4BNg784td1AZa2GTYvXC1d83FnAe5RZqpY=";
};

buildInputs = [
curl
libzip
build-system = with python3Packages; [
setuptools
wheel
];
nativeBuildInputs = [
pkg-config
installShellFiles

dependencies = with python3Packages; [
termcolor
colorama
shtab
];

makeFlags = [
"CC=${stdenv.cc.targetPrefix}cc"
"LD=${stdenv.cc.targetPrefix}cc"
"CFLAGS="
nativeBuildInputs = [ installShellFiles ];

nativeCheckInputs = with python3Packages; [
pytest
];

installFlags = [ "PREFIX=$(out)" ];
checkPhase = ''
runHook preCheck
pytest -k 'not test_error_message'
runHook postCheck
'';

doCheck = true;

postInstall = ''
installShellCompletion --cmd tldr autocomplete/complete.{bash,fish,zsh}
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd tldr \
--bash <($out/bin/tldr --print-completion bash) \
--zsh <($out/bin/tldr --print-completion zsh)
'';

meta = with lib; {
meta = {
description = "Simplified and community-driven man pages";
longDescription = ''
tldr pages gives common use cases for commands, so you don't need to hunt
through a man page for the correct flags.
'';
homepage = "https://tldr.sh";
changelog = "https://github.com/tldr-pages/tldr-c-client/blob/v${version}/CHANGELOG.md";
license = licenses.mit;
maintainers = with maintainers; [
changelog = "https://github.com/tldr-pages/tldr-python-client/blob/${version}/CHANGELOG.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
taeer
carlosdagos
kbdharun
];
platforms = platforms.all;
mainProgram = "tldr";
};
}

0 comments on commit 1a685a9

Please sign in to comment.