5e5a40b1ee
Add python diagrams library. Generate nice architecture diagrams with python code, allowing for rapid iteration. The images are rendered using dot from graphviz. This PR is based on the upstream GitHub repo for diagrams, which differs significantly from the tarball published to pypi. Closes #101532
50 lines
1.0 KiB
Nix
50 lines
1.0 KiB
Nix
{ lib
|
|
, buildPythonPackage
|
|
, pythonOlder
|
|
, fetchFromGitHub
|
|
, black
|
|
, jinja2
|
|
, poetry-core
|
|
, round
|
|
, graphviz
|
|
, inkscape
|
|
, imagemagick
|
|
, pytestCheckHook
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "diagrams";
|
|
version = "0.19.1";
|
|
format = "pyproject";
|
|
disabled = pythonOlder "3.6";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "mingrammer";
|
|
repo = pname;
|
|
rev = "v${version}";
|
|
sha256 = "0qvk0cp3026n5jmwp9z7m70b6pws0h6a7slxr23glg18baxr44d4";
|
|
};
|
|
|
|
preConfigure = ''
|
|
patchShebangs autogen.sh
|
|
./autogen.sh
|
|
'';
|
|
|
|
patches = [ ./build_poetry.patch ];
|
|
|
|
checkInputs = [ pytestCheckHook ];
|
|
|
|
# Despite living in 'tool.poetry.dependencies',
|
|
# these are only used at build time to process the image resource files
|
|
nativeBuildInputs = [ black inkscape imagemagick jinja2 poetry-core round ];
|
|
|
|
propagatedBuildInputs = [ graphviz ];
|
|
|
|
meta = with lib; {
|
|
description = "Diagram as Code";
|
|
homepage = "https://diagrams.mingrammer.com/";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ addict3d ];
|
|
};
|
|
}
|