summary refs log tree commit diff
path: root/pkgs/misc/rich-cli/default.nix
blob: a7fb03e11ad452712b5ba54fc6a20b6fd52297dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{ lib
, fetchFromGitHub
, python3
}:

let
  py = python3.override {
    packageOverrides = final: prev: {
      rich = prev.rich.overridePythonAttrs (old: rec {
        version = "12.4.0";
        src = fetchFromGitHub {
          owner = "Textualize";
          repo = "rich";
          rev = "refs/tags/v12.4.0";
          hash = "sha256-ryJTusUNpvNF2031ICJWK8ScxHIh+LrXYg7nd0ph4aQ=";
        };
        propagatedBuildInputs = with py.pkgs; [
          commonmark
          pygments
        ];
        doCheck = false;
      });

      textual = prev.textual.overridePythonAttrs (old: rec {
        version = "0.1.18";
        src = fetchFromGitHub {
          owner = "Textualize";
          repo = "textual";
          rev = "refs/tags/v0.1.18";
          hash = "sha256-XVmbt8r5HL8r64ISdJozmM+9HuyvqbpdejWICzFnfiw=";
        };
        doCheck = false;
      });
    };
  };
in

python3.pkgs.buildPythonApplication rec {
  pname = "rich-cli";
  version = "1.8.0";
  format = "pyproject";

  src = fetchFromGitHub {
    owner = "Textualize";
    repo = pname;
    rev = "refs/tags/v${version}";
    hash = "sha256-mV5b/J9wX9niiYtlmAUouaAm9mY2zTtDmex7FNWcezQ=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace 'rich = "^12.4.0"' 'rich = "*"' \
      --replace 'textual = "^0.1.18"' 'textual = "*"'
  '';

  nativeBuildInputs = with py.pkgs; [
    poetry-core
  ];

  propagatedBuildInputs = with py.pkgs; [
    rich
    click
    requests
    textual
    rich-rst
  ];

  pythonImportsCheck = [
    "rich_cli"
  ];

  meta = with lib; {
    description = "Command Line Interface to Rich";
    homepage = "https://github.com/Textualize/rich-cli";
    changelog = "https://github.com/Textualize/rich-cli/releases/tag/v${version}";
    license = licenses.mit;
    maintainers = with maintainers; [ joelkoen ];
  };
}