summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/md2pdf/default.nix
blob: e3cdf1cfe9b8e80a1b10dde426f579db682a240d (plain)
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
{
  buildPythonPackage,
  click,
  fetchFromGitHub,
  hatchling,
  jinja2,
  lib,
  markdown,
  pygments,
  pymdown-extensions,
  pytest-cov-stub,
  pytestCheckHook,
  python-frontmatter,
  weasyprint,
}:

buildPythonPackage rec {
  pname = "md2pdf";
  version = "2.0.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "jmaupetit";
    repo = "md2pdf";
    tag = "v${version}";
    hash = "sha256-Do4GW3Z1LmcFSOSCQ0ESztJSrtaNp+2gfci2tDH3+E8=";
  };

  build-system = [ hatchling ];

  dependencies = [
    click
    jinja2
    markdown
    pygments
    pymdown-extensions
    python-frontmatter
    weasyprint
  ];

  pythonImportsCheck = [ "md2pdf" ];

  nativeCheckInputs = [
    pytest-cov-stub
    pytestCheckHook
  ];

  preCheck = ''
    export PATH="$out/bin:$PATH"
  '';

  meta = {
    changelog = "https://github.com/jmaupetit/md2pdf/blob/${src.tag}/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 ];
  };
}