diff --git a/pkgs/development/python-modules/md2pdf/default.nix b/pkgs/development/python-modules/md2pdf/default.nix new file mode 100644 index 000000000000..abcb118aa818 --- /dev/null +++ b/pkgs/development/python-modules/md2pdf/default.nix @@ -0,0 +1,57 @@ +{ + buildPythonPackage, + docopt, + fetchFromGitHub, + lib, + markdown2, + pytest-cov-stub, + pytestCheckHook, + setuptools, + weasyprint, +}: + +buildPythonPackage rec { + pname = "md2pdf"; + version = "1.0.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "jmaupetit"; + repo = "md2pdf"; + rev = "refs/tags/${version}"; + hash = "sha256-9B1vVfcBHk+xdE2Xouu95j3Hp4xm9d5DgPv2zKwCvHY="; + }; + + postPatch = '' + substituteInPlace setup.py \ + --replace-fail '"pytest-runner",' "" + ''; + + build-system = [ setuptools ]; + + dependencies = [ + docopt + markdown2 + weasyprint + ]; + + pythonImportsCheck = [ "md2pdf" ]; + + nativeCheckInputs = [ + pytest-cov-stub + pytestCheckHook + ]; + + preCheck = '' + export PATH="$out/bin:$PATH" + ''; + + meta = { + changelog = "https://github.com/jmaupetit/md2pdf/blob/${src.rev}/CHANGELOG.md"; + description = "Markdown to PDF conversion tool"; + homepage = "https://github.com/jmaupetit/md2pdf"; + license = lib.licenses.mit; + mainProgram = "md2pdf"; + maintainers = with lib.maintainers; [ dotlambda ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6be52d733b49..e4c668a5aa18 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9616,6 +9616,8 @@ with pkgs; md2gemini = with python3.pkgs; toPythonApplication md2gemini; + md2pdf = with python3Packages; toPythonApplication md2pdf; + mdbook-emojicodes = callPackage ../tools/text/mdbook-emojicodes { }; mdbook-epub = callPackage ../tools/text/mdbook-epub { diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 5034a3407499..d28a3dcb4c18 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7566,6 +7566,8 @@ self: super: with self; { md2gemini = callPackage ../development/python-modules/md2gemini { }; + md2pdf = callPackage ../development/python-modules/md2pdf { }; + mdformat = callPackage ../development/python-modules/mdformat { }; mdformat-admon = callPackage ../development/python-modules/mdformat-admon { }; mdformat-beautysh = callPackage ../development/python-modules/mdformat-beautysh { };