1{
2 lib,
3 buildPythonPackage,
4 python,
5 runCommand,
6 fetchFromGitHub,
7 configargparse,
8 acme,
9 configobj,
10 cryptography,
11 distro,
12 josepy,
13 parsedatetime,
14 pyrfc3339,
15 pytz,
16 setuptools,
17 dialog,
18 gnureadline,
19 pytest-xdist,
20 pytestCheckHook,
21 python-dateutil,
22}:
23
24buildPythonPackage rec {
25 pname = "certbot";
26 version = "4.0.0";
27 pyproject = true;
28
29 src = fetchFromGitHub {
30 owner = "certbot";
31 repo = "certbot";
32 tag = "v${version}";
33 hash = "sha256-GS4JLLXrX4+BQ4S6ySbOHUaUthCFYTCHWnOaMpfnIj8=";
34 };
35
36 postPatch = "cd certbot"; # using sourceRoot would interfere with patches
37
38 build-system = [ setuptools ];
39
40 dependencies = [
41 configargparse
42 acme
43 configobj
44 cryptography
45 distro
46 josepy
47 parsedatetime
48 pyrfc3339
49 pytz
50 setuptools # for pkg_resources
51 ];
52
53 buildInputs = [
54 dialog
55 gnureadline
56 ];
57
58 nativeCheckInputs = [
59 python-dateutil
60 pytestCheckHook
61 pytest-xdist
62 ];
63
64 pytestFlagsArray = [
65 "-p no:cacheprovider"
66 "-W"
67 "ignore::DeprecationWarning"
68 ];
69
70 makeWrapperArgs = [ "--prefix PATH : ${dialog}/bin" ];
71
72 # certbot.withPlugins has a similar calling convention as python*.withPackages
73 # it gets invoked with a lambda, and invokes that lambda with the python package set matching certbot's:
74 # certbot.withPlugins (cp: [ cp.certbot-dns-foo ])
75 passthru.withPlugins =
76 f:
77 let
78 pythonEnv = python.withPackages f;
79 in
80 runCommand "certbot-with-plugins" { } ''
81 mkdir -p $out/bin
82 cd $out/bin
83 ln -s ${pythonEnv}/bin/certbot
84 '';
85
86 meta = with lib; {
87 homepage = "https://github.com/certbot/certbot";
88 changelog = "https://github.com/certbot/certbot/blob/${src.tag}/certbot/CHANGELOG.md";
89 description = "ACME client that can obtain certs and extensibly update server configurations";
90 platforms = platforms.unix;
91 mainProgram = "certbot";
92 maintainers = with maintainers; [ domenkozar ];
93 license = with licenses; [ asl20 ];
94 };
95}