1{ lib
2, buildPythonPackage
3, pythonOlder
4, fetchFromGitHub
5, jinja2
6, poetry-core
7, round
8, graphviz
9, inkscape
10, imagemagick
11, pytestCheckHook
12}:
13
14buildPythonPackage rec {
15 pname = "diagrams";
16 version = "0.22.0";
17 format = "pyproject";
18 disabled = pythonOlder "3.6";
19
20 src = fetchFromGitHub {
21 owner = "mingrammer";
22 repo = pname;
23 rev = "refs/tags/v${version}";
24 sha256 = "sha256-LUuClvBJeOxtrg+S+lYLpP7T1RXCy5dNjFYQO3H54QE=";
25 };
26
27 postPatch = ''
28 substituteInPlace pyproject.toml \
29 --replace 'graphviz = ">=0.13.2,<0.20.0"' 'graphviz = "*"'
30 '';
31
32 preConfigure = ''
33 patchShebangs autogen.sh
34 ./autogen.sh
35 '';
36
37 patches = [
38 # The build-system section is missing
39 ./build_poetry.patch
40 ./remove-black-requirement.patch
41 ];
42
43 checkInputs = [ pytestCheckHook ];
44
45 # Despite living in 'tool.poetry.dependencies',
46 # these are only used at build time to process the image resource files
47 nativeBuildInputs = [ inkscape imagemagick jinja2 poetry-core round ];
48
49 propagatedBuildInputs = [ graphviz ];
50
51 pythonImportsCheck = [ "diagrams" ];
52
53 meta = with lib; {
54 description = "Diagram as Code";
55 homepage = "https://diagrams.mingrammer.com/";
56 license = licenses.mit;
57 maintainers = with maintainers; [ addict3d ];
58 };
59}