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.1.1";
27 pyproject = true;
28
29 src = fetchFromGitHub {
30 owner = "certbot";
31 repo = "certbot";
32 tag = "v${version}";
33 hash = "sha256-nlNjBbXd4ujzVx10+UwqbXliuLVVf+UHR8Dl5CQzsZo=";
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 pytestFlags = [
65 "-pno:cacheprovider"
66 "-Wignore::DeprecationWarning"
67 ];
68
69 disabledTests = [
70 # network access
71 "test_lock_order"
72 ];
73
74 makeWrapperArgs = [ "--prefix PATH : ${dialog}/bin" ];
75
76 # certbot.withPlugins has a similar calling convention as python*.withPackages
77 # it gets invoked with a lambda, and invokes that lambda with the python package set matching certbot's:
78 # certbot.withPlugins (cp: [ cp.certbot-dns-foo ])
79 passthru.withPlugins =
80 f:
81 let
82 pythonEnv = python.withPackages f;
83 in
84 runCommand "certbot-with-plugins" { } ''
85 mkdir -p $out/bin
86 cd $out/bin
87 ln -s ${pythonEnv}/bin/certbot
88 '';
89
90 meta = with lib; {
91 homepage = "https://github.com/certbot/certbot";
92 changelog = "https://github.com/certbot/certbot/blob/${src.tag}/certbot/CHANGELOG.md";
93 description = "ACME client that can obtain certs and extensibly update server configurations";
94 platforms = platforms.unix;
95 mainProgram = "certbot";
96 maintainers = with maintainers; [ ];
97 license = with licenses; [ asl20 ];
98 };
99}