1{ lib
2, fetchFromGitHub
3, python3
4}:
5
6let
7 py = python3.override {
8 packageOverrides = final: prev: {
9 rich = prev.rich.overridePythonAttrs (old: rec {
10 version = "12.4.0";
11 src = fetchFromGitHub {
12 owner = "Textualize";
13 repo = "rich";
14 rev = "refs/tags/v12.4.0";
15 hash = "sha256-ryJTusUNpvNF2031ICJWK8ScxHIh+LrXYg7nd0ph4aQ=";
16 };
17 propagatedBuildInputs = with py.pkgs; [
18 commonmark
19 pygments
20 ];
21 doCheck = false;
22 });
23
24 textual = prev.textual.overridePythonAttrs (old: rec {
25 version = "0.1.18";
26 src = fetchFromGitHub {
27 owner = "Textualize";
28 repo = "textual";
29 rev = "refs/tags/v0.1.18";
30 hash = "sha256-XVmbt8r5HL8r64ISdJozmM+9HuyvqbpdejWICzFnfiw=";
31 };
32 doCheck = false;
33 });
34 };
35 };
36in
37
38python3.pkgs.buildPythonApplication rec {
39 pname = "rich-cli";
40 version = "1.8.0";
41 format = "pyproject";
42
43 src = fetchFromGitHub {
44 owner = "Textualize";
45 repo = pname;
46 rev = "refs/tags/v${version}";
47 hash = "sha256-mV5b/J9wX9niiYtlmAUouaAm9mY2zTtDmex7FNWcezQ=";
48 };
49
50 postPatch = ''
51 substituteInPlace pyproject.toml \
52 --replace 'rich = "^12.4.0"' 'rich = "*"' \
53 --replace 'textual = "^0.1.18"' 'textual = "*"'
54 '';
55
56 nativeBuildInputs = with py.pkgs; [
57 poetry-core
58 ];
59
60 propagatedBuildInputs = with py.pkgs; [
61 rich
62 click
63 requests
64 textual
65 rich-rst
66 ];
67
68 pythonImportsCheck = [
69 "rich_cli"
70 ];
71
72 meta = with lib; {
73 description = "Command Line Interface to Rich";
74 homepage = "https://github.com/Textualize/rich-cli";
75 changelog = "https://github.com/Textualize/rich-cli/releases/tag/v${version}";
76 license = licenses.mit;
77 maintainers = with maintainers; [ joelkoen ];
78 };
79}