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